diff --git a/.cvsignore b/.gitignore similarity index 100% rename from .cvsignore rename to .gitignore diff --git a/bin/linux/dummy b/bin/linux/dummy deleted file mode 100644 index e69de29..0000000 diff --git a/bin/linuxelf/dummy b/bin/linuxelf/dummy deleted file mode 100644 index e69de29..0000000 diff --git a/obj/linux/.cvsignore b/obj/linux/.cvsignore deleted file mode 100644 index bfe9bed..0000000 --- a/obj/linux/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -.directory -*.o diff --git a/obj/linuxelf/.cvsignore b/obj/linuxelf/.cvsignore deleted file mode 100644 index bfe9bed..0000000 --- a/obj/linuxelf/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -.directory -*.o diff --git a/obj/win/.cvsignore b/obj/win/.cvsignore deleted file mode 100644 index bfe9bed..0000000 --- a/obj/win/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -.directory -*.o diff --git a/v/Config.mk b/v/Config.mk deleted file mode 100644 index 4d5d510..0000000 --- a/v/Config.mk +++ /dev/null @@ -1,304 +0,0 @@ -#=============================================================== -# V Make Configuration file - Version 1.24 - 3/3/2000 -# -# Copyright (C) 1995-2000 Bruce E. Wampler -# date: -# -# THIS IS THE Config.mk FILE FOR THE X Athena VERSION OF V -# -# To build an X version, set the TOOLKIT variable to Athena -# for the generic Athena version, or to Motif -# for the Lesstif/Motif version. (See comment below) -# -# This file is part of the V C++ GUI Framework, and is covered -# under the terms of the GNU Lesser General Public License, -# Version 2.1. This library has NO WARRANTY. See the source file -# vapp.cxx for more complete information about license terms. -#=============================================================== - - -#--------------------------------------------------------------------- -# Version info -#--------------------------------------------------------------------- -VV = 1.25 -VVW = 125 - - -#--------------------------------------------------------------------- -# HOMEV info -#--------------------------------------------------------------------- -HOMEV = your_ponyprog_path/software/v -#HOMEV = $(HOME)/Progetti/PonyProg_Sourceforge/software/v - -INSTALL_PREFIX = /usr/local - -#--------------------------------------------------------------------- -# Tools used in the makefile execution -#--------------------------------------------------------------------- -CC = gcc -CXX = g++ -#CC = gcc-4.1 -#CXX = g++-4.1 - -#--------------------------------------------------------------------- -# VPATH for dependencies on header files -#--------------------------------------------------------------------- -VPATH=$(HOMEV)/includex/v - - -#--------------------------------------------------------------------- -# Select the architecture of your system. -# These are the architectures that V has been extensively tested with: -# linux, linuelf, sun4, mips, sgi -# -# User contributed definitions are available for: -# hpux, aix, solaris, bsd -#--------------------------------------------------------------------- -ARCH = linux -#ARCH = linuxelf -#ARCH = sun4 -#ARCH = mips -#ARCH = sgi -#ARCH = hpux -#ARCH = aix -#ARCH = solaris -#ARCH = bsd -Arch = $(ARCH) - - -#--------------------------------------------------------------------- -# Select Athena or Motif TOOLKIT option. -#--------------------------------------------------------------------- -TOOLKIT = Athena -#TOOLKIT = Motif - -#--------------------------------------------------------------------- -# Use this define for NO 3D on Athena Widgets -# For Motif use NO 3D i.e. USE_3D=no. -#--------------------------------------------------------------------- -ifeq ($(TOOLKIT),Motif) -USE_3D = no -else -USE_3D = yes -endif - - -#--------------------------------------------------------------------- -# Select X11R-version -#--------------------------------------------------------------------- -#X11RV = X11R5 -X11RV = X11R6 - -# where X11 files are -Xdir11 = X11R6 -#Xdir11 = X11 - - -#--------------------------------------------------------------------- -# Select Debug or no Debug -#--------------------------------------------------------------------- -#DEBUG = yes -DEBUG = no - - -#--------------------------------------------------------------------- -# Select Develop or not - used for original development -#--------------------------------------------------------------------- -#DEVEL = yes -DEVEL = no - -#--------------------------------------------------------------------- -# Define filename extensions that are targeted by cleanup's -#--------------------------------------------------------------------- -CLEANEXTS= *.bak *~ *.tmp core *.o *.obj - - -#--------------------------------------------------------------------- -# Architecture dependent directory locations -#--------------------------------------------------------------------- -VLibDir = $(HOMEV)/lib -ifeq ($(TOOLKIT),Motif) -oDir = $(HOMEV)/obj -endif -ifeq ($(TOOLKIT),Athena) -oDir = $(HOMEV)/objx -endif -LibDir = $(HOMEV)/lib -Bin = $(HOMEV)/bin - - -#--------------------------------------------------------------------- -# Architecture independent -#--------------------------------------------------------------------- -INCDIR = -I$(HOMEV)/includex -LIBDIR = -L$(LibDir) -ifeq ($(TOOLKIT),Athena) - LIBNAME = libVx - V1NAME = v1x - LIBS = -lVx -lXaw -endif -ifeq ($(TOOLKIT),Motif) - LIBNAME = libV - V1NAME = v1 - LIBS = -lV -lXm -lXp -endif - - -#--------------------------------------------------------------------- -# Linux -#--------------------------------------------------------------------- -ifeq ($(Arch),linux) -INCDIR += -I/usr/$(X11RV)/include -LIBDIR += -L/usr/$(X11RV)/lib -LIBS += -lXmu -lXt -lXext -lX11 -TARZ = z -RANLIB = ranlib -VGPATH = LINUX -endif - - -#--------------------------------------------------------------------- -# Linux ELF shared library -#--------------------------------------------------------------------- -ifeq ($(Arch),linuxelf) -INCDIR += -I/usr/$(X11RV)/include -LIBDIR += -L/usr/$(X11RV)/lib -LIBS += -lXmu -lXt -lXext -lX11 -TARZ = z -RANLIB = ranlib -VGPATH = LINUX -endif - - -#--------------------------------------------------------------------- -# Sun4 - unm -#--------------------------------------------------------------------- -ifeq ($(TOOLKIT),Athena) -ifeq ($(Arch),sun4) -INCDIR += -I/usr/local/X11/include -LIBDIR += -L/usr/local/X11/lib -LIBS += -lXaw -lXmu -lXt -lXext -lX11 -TARZ = -RANLIB = ranlib -VGPATH = UNIX -endif -endif - - -#---------------------------------------------------------------------- -# solaris - shared Motif/CDE libraries -#---------------------------------------------------------------------- -ifeq ($(TOOLKIT),Motif) -ifeq ($(Arch),solaris) -INCDIR += -I/usr/openwin/include -I/usr/dt/share/include -I$(HOMEV)/includex -LIBDIR += -R/usr/dt/lib:/usr/openwin/lib -L/usr/dt/lib -LIBS += -lXmu -lXt -lXext -lX11 -lnsl -lsocket -TARZ = -RANLIB = true -VGPATH = UNIX -endif -endif - -#--------------------------------------------------------------------- -# mips - unm -#--------------------------------------------------------------------- -ifeq ($(Arch),mips) -INCDIR += -I/usr/local/X11/include -LIBDIR += -L/usr/local/X11/lib -LIBS += -lXaw -lXmu -lXt -lXext -lX11 -TARZ = -RANLIB = ranlib -VGPATH = UNIX -endif - -#--------------------------------------------------------------------- -# sgi -# - the native compiler on IRIX 5.3 complains ad nauseam -# about parameters that are declared but not referenced -# in virtual functions; the -woff turns that warning off -#--------------------------------------------------------------------- -ifeq ($(Arch),sgi) -INCDIR += -I/usr/include -LIBDIR += -L/usr/lib -LIBS += -lXmu -lXt -lXext -lX11 -lm -TARZ = -RANLIB = true -VGPATH = UNIX -ifneq ($(CXX),g++) - CFLAGS += -woff 3262 -endif -endif - -#--------------------------------------------------------------------- -# hpux: -# - /usr/include is included explicitly because on HP-UX 10.20 -# mixing of GNU supplied and system supplied includes leads to -# problems -# - X11 is available either in /usr/contrib or /usr/local -# listing both can not hurt -#---------------------------------------------------------------------- -ifeq ($(Arch),hpux) -INCDIR += -I/usr/include -I/usr/include/$(X11RV) \ - -I/usr/contrib/$(X11RV)/include \ - -I/usr/local/$(X11RV)/include -LIBDIR += -L/usr/lib/$(X11RV) -L/usr/contrib/$(X11RV)/lib \ - -L/usr/local/$(X11RV)/lib -LIBS += -lXmu -lXt -lSM -lICE -lXext -lX11 -TARZ = -RANLIB = true -VGPATH = UNIX -endif - -#---------------------------------------------------------------------- -# solaris - unm -#---------------------------------------------------------------------- -# Note: For Solaris CC Workshop comiplers and OpenWindows linking: -#LIBDIR += -L/usr/openwin/lib -R/usr/openwin/lib -ifeq ($(Arch),solaris) -INCDIR += -I/usr/local/X11/include -I$(HOMEV)/includex -LIBDIR += -L/usr/local/X11/lib -LIBS += -lXmu -lXt -lXext -lX11 -lnsl -lsocket -TARZ = -RANLIB = true -VGPATH = UNIX -endif - - -#---------------------------------------------------------------------- -# FreeBSD with gcc -#---------------------------------------------------------------------- -ifeq ($(Arch),bsd) -INCDIR += -I/usr/$(X11RV)/include -LIBDIR += -L/usr/$(X11RV)/lib -LIBS += -lV -lXmu -lXt -lXext -lX11 -lxm -TARZ = -RANLIB = ranlib -VGPATH = UNIX -endif - - -#--------------------------------------------------------------------- -# C/C++ compile options -#--------------------------------------------------------------------- -#CFLAGS += -v $(INCDIR) -CFLAGS += $(INCDIR) -ifeq ($(DEBUG),no) -CFLAGS += -O2 -endif -ifeq ($(DEBUG),yes) -CFLAGS += -g -CFLAGS += -DvDEBUG -endif -ifeq ($(TOOLKIT),Athena) -CFLAGS += -DAthena -endif -ifeq ($(DEVEL),yes) -CFLAGS += -DDEVEL -endif - - -#--------------------------------------------------------------------- -# LINK/LOAD options -#--------------------------------------------------------------------- -LDFLAGS = $(LIBDIR) $(LIBS) - diff --git a/v/Configwin.mk b/v/Configwin.mk deleted file mode 100644 index 503eae8..0000000 --- a/v/Configwin.mk +++ /dev/null @@ -1,24 +0,0 @@ -#--------------------------------------------------------------------- -# Select Debug or no Debug -#--------------------------------------------------------------------- -#DEBUG = yes -DEBUG = no - -OSNAME := $(shell uname -s | cut -c 1-5) - -ifeq ($(OSNAME),MINGW) -TOOLCHAINPREFIX = -else -#TOOLCHAINPREFIX = i586-mingw32msvc- -TOOLCHAINPREFIX = i686-w64-mingw32- -endif - -CC = $(TOOLCHAINPREFIX)gcc -CXX = $(TOOLCHAINPREFIX)g++ -RANLIB = $(TOOLCHAINPREFIX)ranlib -WINDRES = $(TOOLCHAINPREFIX)windres - -#--------------------------------------------------------------------- -# Define filename extensions that are targeted by cleanup's -#--------------------------------------------------------------------- -CLEANEXTS= *.bak *~ *.tmp core *.o diff --git a/v/Makefile b/v/Makefile deleted file mode 100644 index a58483b..0000000 --- a/v/Makefile +++ /dev/null @@ -1,376 +0,0 @@ -#=============================================================== -# V Makefile - Version 1.25 - 22Sep00 -# -# Copyright (C) 1995-2000 Bruce E. Wampler -# -# This file is part of the V C++ GUI Framework, and is covered -# under the terms of the GNU Library General Public License, -# Version 2. This library has NO WARRANTY. See the source file -# vapp.cxx for more complete information about license terms. -# -# Many thanks to Jan Broeckhove for contributing this -# set of makefiles, which are the standard method of building -# V beginning with Version 1.16. -# -# Support for Win 3.1 removed effective 1.22 -#=============================================================== -# -# IMPORTANT NOTE: -# This Makefile is the top level makefile used to build V on -# various Unix-like platforms. First and foremost, this Makefile -# requires a version of make compatible with Gnu make. One -# specific requirement is VPATH support, for example. There -# are other incompatibilities with gmake and the old standard -# Unix make. -# -# Also, all the Makefiles in this version are controlled by -# the file Config.mk. It defines various directory locations -# and things needed to make V work correctly. You should only -# have to edit Config.mk to get V compiled correctly. -# -# There are TWO versions of Config.mk - one for the standard -# Athena widget version of V, and one for the Motif version. -# To build the Athena version, copy ConfigX.mk to Config.mk -# and edit for your system. To build the Motif version, -# copy ConfigM.mk to Config.mk and edit for your system. -# - -CONFIG = ./Config.mk -include $(CONFIG) - -#=============================================================== -# Available targets: -# -# all (default): vlib, vtest, utils, examp ... -# vlib: build V library -# vtest: build exhaustive test program v1 -# utils: vgen, viconed, vdraw, bmp2vbm -# examples: demos proto, drawex, tutor, icondemo -# clean: general cleanup -# cleanmotif: cleanup motif .o's, etc. -# cleanathena: cleanup Athena .o's, etc. -# cleanobj: cleanup .o's -# cleanbin: cleanup bins's -# cleanall: cleanup all non-source stuff -# tar: X and Windows Distribution -# tarwin: Windows only Distribution" -# tarx: X only distribution -# tarfull: everthing, including .o's, etc. -# getwin: copy MS-Windows source from /dosc -# permissions: make sources readable to world -# installv: run as root to install to /usr/local/v -# installvlinux: run as root to install to /usr/local -# installunm: install to ../pubv (UNM specific) -# -#=============================================================== - - -#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -# -# composite targets and targets for builds in subdirs -# (with some in-between targets to map target to directory) -# -#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - -SRCEXTS = *.cpp *.cxx *.c *.h Make* make* Config* *.tex *.txt - -.PHONY: default all vlib vtest utils examples testlib -.PHONY: srcx test appgen iconed draw bmp2vbm tutor examp drawex icons - -#default: all - -default: vlib - -all: vlib vtest utils examples - @echo "Library, test, utils, examples and tutorial made" - -vlib: srcx - -vtest: test - -testlib: - -rm bin/v1 - cd srcx ; $(MAKE) - cd test ; $(MAKE) - -utils: appgen iconed draw bmp2vbm - -examples: examp drawex icons tutor - -srcx test appgen iconed draw bmp2vbm tutor examp drawex icons: - cd $@ ; $(MAKE) - - -#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -# -# Platform specific MAKES -# -#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - -.PHONY: linux linuxelf sun4 sgi hpux aix solaris bsd -linux linuxelf sun4 sgi hpux aix solaris bsd: - $(MAKE) ARCH=$@ vlib - $(MAKE) ARCH=$@ vtest - (cd appgen ; $(MAKE) ARCH=$@) - (cd iconed ; $(MAKE) ARCH=$@) - - -#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -# -# targets for cleaning up -# -#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - -.PHONY: clean -clean: -# -rm -f $(CLEANEXTS) *.bkh v.tgz -# for i in srcx appgen draw drawex examp iconed icons test tutor; do \ -# (cd $$i; $(MAKE) clean); \ -# done -# for i in obj contrib vopengl includex/v includew/v srcwin; do \ -# (cd $$i; rm -f $(CLEANEXTS)); \ -# done -# -rm -f bccide/*.bak bccide/*.tmp bccide/*.csm -# -rm -f bccide/*.dsw bccide/*.obr bccide/*.tr -# -rm -f watcom/*.bak watcom/*.tmp watcom/*/*.exe watcom/*/*.obj -# -rm -f watcom/*/*.map watcom/*/*.lib watcom/*/*.err watcom/*/*.sym -# -rm -f bccide/*.bak bccide/*.tmp bccide/*.\~* bccide/*.csm - rm -f objx/*.o lib/libVx* - -.PHONY: cleanathena -cleanathena: - -rm -f objx/* lib/libVx.a bin/v1x - date > objx/ThisIs - -.PHONY: cleantestlib -cleantestlib: - -rm bin/v1 - -.PHONY: cleanbin -cleanbin: - -rm -f bin/* - date > lib/ThisIs - date > bin/ThisIs - -.PHONY: cleanobj -cleanobj: - -rm -f obj/* objx/* - -rm -f watcom/*/*.obj - date > obj/ThisIs - date > objx/ThisIs - -.PHONY: cleanall -cleanall: clean cleanobj - -rm -f lib/* bin/* - date > lib/ThisIs - date > bin/ThisIs - -#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -# -# targets for making tar files -# -#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - -.PHONY: tar -tar: clean - @echo "Making v.tgz - X and Windows Distribution" - @echo " Cleaning up old tar file" - -rm ../v-$(VV).tar$(TARZ) - cd .. ; tar cvf$(TARZ) v-$(VV).tar$(TARZ) v/Make* v/README v/C* \ - v/rd* v/vrefman/* v/examp/* v/bmp2vbm/* v/tutor/* v/includex/* \ - v/includew/* v/lib/ThisIs v/obj/ThisIs v/objx/ThisIs v/srcx/* \ - v/srcwin/* v/test/* v/draw/* v/iconed/* v/drawex/* v/bin/ThisIs \ - v/bccide v/icons/* v/watcom/* v/contrib/* v/appgen/* \ - v/vopengl/* v/msvc/* v/gnuwin32/* ; cd v - -.PHONY: tarwin -tarwin: clean - @echo "Making vwin.tar - Windows Distribution" - @echo " Cleaning up old tar file" - -rm ../vwin$(VVW).tar$(TARZ) - cd .. ; tar cvf$(TARZ) vwin$(VVW).tar$(TARZ) v/Make* v/README v/rd* v/C* \ - v/vrefman/* v/examp/* v/bmp2vbm/* v/tutor/* v/include \ - v/includew/* v/lib/ThisIs v/obj/ThisIs v/objx/ThisIs \ - v/srcwin/* v/test/* v/draw/* v/drawex/* v/bin/ThisIs \ - v/bccide v/icons/* v/iconed/* v/contrib/* \ - v/appgen/* v/vopengl/* v/msvc/* v/gnuwin32/* ; cd v - -.PHONY: tarx -tarx: clean - @echo "Making vx-$(VV).tar - X only distribution" - @echo " Cleaning up old tar file" - -rm ../vx-$(VV).tar$(TARZ) - cd .. ; tar cvf$(TARZ) vx-$(VV).tar$(TARZ) v/Make* v/README v/rd* v/C* \ - v/vrefman/* v/examp/* v/bmp2vbm/* v/tutor/* v/includex/* \ - v/lib/ThisIs v/obj/ThisIs v/objx/ThisIs v/srcx/* v/icons/* \ - v/test/* v/draw/* v/iconed/* v/drawex/* v/bin/ThisIs \ - v/contrib/* v/appgen/* v/vopengl/* ; cd v - -.PHONY: tarxsrc -tarxsrc: clean - @echo "Making vxsrc-$(VV).tar - X only distribution" - @echo " Cleaning up old tar file" - -rm ../vxsrc-$(VV).tar$(TARZ) - cd .. ; tar cvf$(TARZ) vxsrc-$(VV).tar$(TARZ) v/Make* v/README v/rd* v/C* \ - v/examp/* v/bmp2vbm/* v/tutor/* v/includex/* \ - v/lib/*/ThisIs v/obj/*/ThisIs v/objm/*/ThisIs v/srcx/* v/icons/* \ - v/test/* v/draw/* v/iconed/* v/drawex/* v/bin/ThisIs \ - v/contrib/* v/appgen/* v/vopengl/* ; cd v - -.PHONY: tarfull -tarfull: clean - @echo "Making vfull.tgz - FULL VERSION" - @echo " Cleaning up old tar file" - -rm ../vfull.tar$(TARZ) - cd .. ; tar cvf$(TARZ) vfull.tar$(TARZ) v/* ; cd v - -#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -# -# target for fixing permissions -# -#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - -PERMDIRS = . vrefman examp tutor includex includex/v includew/v lib \ - lib/* obj obj/* objm objm/* srcx srcwin test draw drawex iconed bin \ - bin/* bmp2vbm icons vopengl appgen contrib bccide watcom msvc gnuwin32 - -WINDIRS = watcom/win32 watcom/win32db \ - msvc/vgen32 msvc/viconed msvc/vmsvc32 msvc/vtstms32 \ - msvc/vgen32/release msvc/viconed/release msvc/vmsvc32/release \ - msvc/vtstms32/release - -PERMFILES = Make* README rd* C* rd* vrefman/* includex/v/* \ - includew/v/* lib/* obj/* objx/* srcx/* srcwin/* test/* \ - draw/* iconed/* drawex/* examp/* bin/* tutor/* bmp2vbm/* bccide/* \ - icons/* watcom/*/* watcom/* contrib/* \ - appgen/* vopengl/* gnuwin32/* msvc/*/* msvc/* - -EXEFILES = bin/* - -.PHONY: permissions -permissions: - -chmod 755 $(PERMDIRS) - -chmod 755 $(WINDIRS) - -chmod 644 $(PERMFILES) - -chmod 755 $(PERMDIRS) - -chmod 755 $(WINDIRS) - -chmod 755 $(EXEFILES) - - -#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -# -# installation targets -# These work best for dedicated systems where you can run as -# root. -# IMPORTANT! It will be easier if you make a symbolic link -# in the home directory of root to whereever V is before -# doing the install. E.g., -# -# [root]# cd -# [root]# ln -s /home/bruce/v v -# [root]# cd v -# [root]# make installLinux -# -# This makefile uses $(LibDir), which is -# set to HOME by default, so adding a link from the root -# directory of root to the real v directory makes this work right. -# -# The Linux version assumes that X11 binaries are at /usr/X11/bin. -# Some versions have /usr/X11R6/bin instead. If that is your case, -# you should also create a symbolic link in /usr: ln -s X11R6 X11 -# -#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - -.PHONY: installLinux -installLinux: - $(MAKE) ARCH=linux installVLinux - -.PHONY: uninstallLinux -uninstallLinux: - $(MAKE) ARCH=linux uninstallVLinux - -.PHONY: install -install: - $(MAKE) ARCH=linuxelf installVLinux - echo "#######################################" - echo " You now need to ldconfig from root..." - echo "#######################################" - -.PHONY: uninstall -uninstall: - $(MAKE) ARCH=linuxelf uninstallVLinux - -.PHONY: installv -installv: - -mkdir $(INSTALL_PREFIX)/v - -mkdir $(INSTALL_PREFIX)/v/lib - -mkdir $(INSTALL_PREFIX)/v/bin - -mkdir $(INSTALL_PREFIX)/v/include - -mkdir $(INSTALL_PREFIX)/v/include/v - -chmod 755 $(INSTALL_PREFIX)/v - -chmod 755 $(INSTALL_PREFIX)/v/lib - -chmod 755 $(INSTALL_PREFIX)/v/bin - -chmod 755 $(INSTALL_PREFIX)/v/include - -chmod 755 $(INSTALL_PREFIX)/v/include/v - cp includex/v/* $(INSTALL_PREFIX)/v/include/v - cp $(LibDir)/*.a $(INSTALL_PREFIX)/v/lib - cp $(Bin)/* $(INSTALL_PREFIX)/v/bin - -chmod 644 $(INSTALL_PREFIX)/v/include/v/* - -chmod 644 $(INSTALL_PREFIX)/v/lib/* - -chmod 755 $(INSTALL_PREFIX)/v/bin/* - -.PHONY: installgnuwin32 -installgnuwin32: -# -mkdir $(HOMEGNU)/include/v - cp includew/v/*.h $(HOMEGNU)/include/v - cp $(LibDir)/*.a $(HOMEGNU)/lib - cp $(Bin)/* $(HOMEGNU)/bin - -.PHONY: installmingw32 -installmingw32: -# -mkdir $(HOMEGNU)/include/v - rm -f $(HOMEGNU)/include/v/* - cp ./includew/v/*.h $(HOMEGNU)/include/v - cp $(LibDir)/*.a $(HOMEGNU)/lib - cp $(Bin)/* $(HOMEGNU)/bin - -.PHONY: installVLinux -installVLinux: - @echo "You must run this as root" -# -mkdir /usr/include/v -# -chmod 644 includex/v/* -# cp includex/v/* /usr/include/v -ifeq ($(Arch),linuxelf) - chmod 644 $(LibDir)/*.so.$(VV) - cp $(LibDir)/*.so.$(VV) $(INSTALL_PREFIX)/lib - rm -f $(INSTALL_PREFIX)/lib/$(LIBNAME).so.1 - ln -s $(INSTALL_PREFIX)/lib/$(LIBNAME).so.$(VV) $(INSTALL_PREFIX)/lib/$(LIBNAME).so.1 - rm -f $(INSTALL_PREFIX)/lib/$(LIBNAME).so - ln -s $(INSTALL_PREFIX)/lib/$(LIBNAME).so.$(VV) $(INSTALL_PREFIX)/lib/$(LIBNAME).so -else - -chmod 644 $(LibDir)/*.a - cp $(LibDir)/*.a $(INSTALL_PREFIX)/lib -endif -# -chmod 755 $(Bin)/* -# cp $(Bin)/* /usr/$(Xdir11)/bin - -.PHONY: uninstalVlLinux -uninstallVLinux: - @echo "You must run this as root" -# -rm /usr/include/v/* -ifeq ($(Arch),linuxelf) - rm -f $(INSTALL_PREFIX)/lib/$(LIBNAME).so.1 - rm -f $(INSTALL_PREFIX)/lib/$(LIBNAME).so - rm -f $(INSTALL_PREFIX)/lib/$(LIBNAME).so.$(VV) -else - rm -f $(INSTALL_PREFIX)/lib/libV.a - rm -f $(INSTALL_PREFIX)/lib/libVgl.a -endif -# -rm /usr/$(Xdir11)/bin/viconed -# -rm /usr/$(Xdir11)/bin/b2v -# -rm /usr/$(Xdir11)/bin/icondemo -# -rm /usr/$(Xdir11)/bin/proto -# -rm /usr/$(Xdir11)/bin/tutapp -# -rm /usr/$(Xdir11)/bin/v1 -# -rm /usr/$(Xdir11)/bin/vdraw -# -rm /usr/$(Xdir11)/bin/vdrawex diff --git a/v/Makefile.win b/v/Makefile.win deleted file mode 100644 index 83b2af2..0000000 --- a/v/Makefile.win +++ /dev/null @@ -1,345 +0,0 @@ -#======================================================================= -#@V@:Note: File automatically generated by VIDE: (10:28:19 18 Sep 2000) (g++). -# This file regenerated each time you run VIDE, so save under a -# new name if you hand edit, or it will be overwritten. -#======================================================================= - -CONFIG=Configwin.mk -include $(CONFIG) - -oDir = objwin -Bin = lib -Src = srcwin -libDirs = -incDirs = -Iincludew - -C_FLAGS = -D_WINDOWS -ifeq ($(DEBUG),no) - C_FLAGS += -O2 -else - C_FLAGS += -DvDEBUG - C_FLAGS += -O0 -g -endif - -LIBS = -C_FLAGS += -fpermissive -Wno-write-strings - -SRCS =\ - $(Src)/vapp.cpp\ - $(Src)/vawinfo.cpp\ - $(Src)/vbaseitm.cpp\ - $(Src)/vbasewin.cpp\ - $(Src)/vbglcnv.cpp\ - $(Src)/vboxlblc.cpp\ - $(Src)/vbrush.cpp\ - $(Src)/vbtncmd.cpp\ - $(Src)/vcanvas.cpp\ - $(Src)/vcbtncmd.cpp\ - $(Src)/vchkboxc.cpp\ - $(Src)/vclabelc.cpp\ - $(Src)/vcmd.cpp\ - $(Src)/vcmdpane.cpp\ - $(Src)/vcmdprnt.cpp\ - $(Src)/vcmdwin.cpp\ - $(Src)/vcolor.cpp\ - $(Src)/vcomboc.cpp\ - $(Src)/vcpdc.cpp\ - $(Src)/vdebug.cpp\ - $(Src)/vdialog.cpp\ - $(Src)/vfilesel.cpp\ - $(Src)/vfinddlg.cpp\ - $(Src)/vfont.cpp\ - $(Src)/vfontsel.cpp\ - $(Src)/vframec.cpp\ - $(Src)/vicon.cpp\ - $(Src)/vlabelc.cpp\ - $(Src)/vlistc.cpp\ - $(Src)/vmemdc.cpp\ - $(Src)/vmenu.cpp\ - $(Src)/vmodald.cpp\ - $(Src)/vnotice.cpp\ - $(Src)/vos.cpp\ - $(Src)/vpen.cpp\ - $(Src)/vpopmenu.cpp\ - $(Src)/vprogrsc.cpp\ - $(Src)/vradioc.cpp\ - $(Src)/vrepldlg.cpp\ - $(Src)/vreply.cpp\ - $(Src)/vsliderc.cpp\ - $(Src)/vslist.cpp\ - $(Src)/vspinc.cpp\ - $(Src)/vstartup.cpp\ - $(Src)/vtextc.cpp\ - $(Src)/vtextcnv.cpp\ - $(Src)/vtexted.cpp\ - $(Src)/vtextinc.cpp\ - $(Src)/vthislst.cpp\ - $(Src)/vtimer.cpp\ - $(Src)/vwindc.cpp\ - $(Src)/vutil.cpp\ - $(Src)/vwindow.cpp\ - $(Src)/vwinprdc.cpp\ - $(Src)/vwinprtr.cpp\ - $(Src)/vynreply.cpp - -EXOBJS =\ - $(oDir)/vapp.o\ - $(oDir)/vawinfo.o\ - $(oDir)/vbaseitm.o\ - $(oDir)/vbasewin.o\ - $(oDir)/vbglcnv.o\ - $(oDir)/vboxlblc.o\ - $(oDir)/vbrush.o\ - $(oDir)/vbtncmd.o\ - $(oDir)/vcanvas.o\ - $(oDir)/vcbtncmd.o\ - $(oDir)/vchkboxc.o\ - $(oDir)/vclabelc.o\ - $(oDir)/vcmd.o\ - $(oDir)/vcmdpane.o\ - $(oDir)/vcmdprnt.o\ - $(oDir)/vcmdwin.o\ - $(oDir)/vcolor.o\ - $(oDir)/vcomboc.o\ - $(oDir)/vcpdc.o\ - $(oDir)/vdebug.o\ - $(oDir)/vdialog.o\ - $(oDir)/vfilesel.o\ - $(oDir)/vfinddlg.o\ - $(oDir)/vfont.o\ - $(oDir)/vfontsel.o\ - $(oDir)/vframec.o\ - $(oDir)/vicon.o\ - $(oDir)/vlabelc.o\ - $(oDir)/vlistc.o\ - $(oDir)/vmemdc.o\ - $(oDir)/vmenu.o\ - $(oDir)/vmodald.o\ - $(oDir)/vnotice.o\ - $(oDir)/vos.o\ - $(oDir)/vpen.o\ - $(oDir)/vpopmenu.o\ - $(oDir)/vprogrsc.o\ - $(oDir)/vradioc.o\ - $(oDir)/vrepldlg.o\ - $(oDir)/vreply.o\ - $(oDir)/vsliderc.o\ - $(oDir)/vslist.o\ - $(oDir)/vspinc.o\ - $(oDir)/vstartup.o\ - $(oDir)/vtextc.o\ - $(oDir)/vtextcnv.o\ - $(oDir)/vtexted.o\ - $(oDir)/vtextinc.o\ - $(oDir)/vthislst.o\ - $(oDir)/vtimer.o\ - $(oDir)/vwindc.o\ - $(oDir)/vutil.o\ - $(oDir)/vwindow.o\ - $(oDir)/vwinprdc.o\ - $(oDir)/vwinprtr.o\ - $(oDir)/vynreply.o - -ALLOBJS = $(EXOBJS) -ALLBIN = $(Bin)/libV.a -ALLTGT = $(Bin)/libV.a - -# User defines: - -#@# Targets follow --------------------------------- - -all: $(ALLTGT) - -objs: $(ALLOBJS) - -cleanobjs: - rm -f $(ALLOBJS) - -cleanbin: - rm -f $(ALLBIN) - -clean: cleanobjs cleanbin - -cleanall: cleanobjs cleanbin - -#@# User Targets follow --------------------------------- - - -#@# Dependency rules follow ----------------------------- - -$(Bin)/libV.a: $(EXOBJS) - rm -f $(Bin)/libV.a - ar cr $(Bin)/libV.a $(EXOBJS) - $(RANLIB) $(Bin)/libV.a - -$(oDir)/vapp.o: $(Src)/vapp.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vawinfo.o: $(Src)/vawinfo.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vbaseitm.o: $(Src)/vbaseitm.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vbasewin.o: $(Src)/vbasewin.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vbglcnv.o: $(Src)/vbglcnv.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vboxlblc.o: $(Src)/vboxlblc.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vbrush.o: $(Src)/vbrush.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vbtncmd.o: $(Src)/vbtncmd.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vcanvas.o: $(Src)/vcanvas.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vcbtncmd.o: $(Src)/vcbtncmd.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vchkboxc.o: $(Src)/vchkboxc.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vclabelc.o: $(Src)/vclabelc.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vcmd.o: $(Src)/vcmd.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vcmdpane.o: $(Src)/vcmdpane.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vcmdprnt.o: $(Src)/vcmdprnt.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vcmdwin.o: $(Src)/vcmdwin.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vcolor.o: $(Src)/vcolor.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vcomboc.o: $(Src)/vcomboc.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vcpdc.o: $(Src)/vcpdc.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vdebug.o: $(Src)/vdebug.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vdialog.o: $(Src)/vdialog.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vfilesel.o: $(Src)/vfilesel.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vfinddlg.o: $(Src)/vfinddlg.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vfont.o: $(Src)/vfont.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vfontsel.o: $(Src)/vfontsel.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vframec.o: $(Src)/vframec.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vicon.o: $(Src)/vicon.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vlabelc.o: $(Src)/vlabelc.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vlistc.o: $(Src)/vlistc.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vmemdc.o: $(Src)/vmemdc.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vmenu.o: $(Src)/vmenu.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vmodald.o: $(Src)/vmodald.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vnotice.o: $(Src)/vnotice.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vos.o: $(Src)/vos.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vpen.o: $(Src)/vpen.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vpopmenu.o: $(Src)/vpopmenu.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vprogrsc.o: $(Src)/vprogrsc.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vradioc.o: $(Src)/vradioc.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vrepldlg.o: $(Src)/vrepldlg.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vreply.o: $(Src)/vreply.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vsliderc.o: $(Src)/vsliderc.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vslist.o: $(Src)/vslist.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vspinc.o: $(Src)/vspinc.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vstartup.o: $(Src)/vstartup.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vtextc.o: $(Src)/vtextc.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vtextcnv.o: $(Src)/vtextcnv.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vtexted.o: $(Src)/vtexted.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vtextinc.o: $(Src)/vtextinc.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vthislst.o: $(Src)/vthislst.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vtimer.o: $(Src)/vtimer.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vwindc.o: $(Src)/vwindc.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vutil.o: $(Src)/vutil.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vwindow.o: $(Src)/vwindow.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vwinprdc.o: $(Src)/vwinprdc.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vwinprtr.o: $(Src)/vwinprtr.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vynreply.o: $(Src)/vynreply.cpp - $(CXX) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(shell mkdir -p $(oDir) 2>/dev/null) -$(shell mkdir -p $(Bin) 2>/dev/null) - diff --git a/v/Readme b/v/Readme deleted file mode 100644 index 4855fad..0000000 --- a/v/Readme +++ /dev/null @@ -1,41 +0,0 @@ -Welcome to the V FTP site. This site contains the main -distribution for the V, a free, portable C++ GUI Framework. - -This file was last updated 26 Sept 2000 - --------------------------------------------------------------- --------------------------------------------------------------- -The files of interest: - -v-1.25.tar.gz -- Gzipped tar file of the Full version - X and Windows. - This includes all source for X and MS-Windows, as well - as full documentation. - -vos2-121.zip -- ZIP file with V for OS/2, Version 1.21. - - -videsrc118.tar.gz -- Gzipped tar file of VIDE source. - -videsetup.exe -- VIDE for MS-Windows - -vide-linux.tar.gz -- Static Linux executable of VIDE. - -winutils.zip -- MS-Windows ZIP file of some essential tools used - by V and VIDE, including gunzip and tar. You will need a - version of ZIP for windows. See http://zipcentral.iscool.net - for a completely free ZIP program. (Virus-free version) - - -******************* LATEST NEWS ABOUT V *********************** -September 26, 2000 - -This is the V 1.25 release. See the full V documentation -for a description of what is new in V 1.25 at - - http://objectcentral.com/vgui/vrefman/install.htm - ----------------- ----------------- -January 10, 1996 - -Version 1.0 posted. diff --git a/v/copying b/v/copying deleted file mode 100644 index a43ea21..0000000 --- a/v/copying +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - Appendix: How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) 19yy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/v/copying.lib b/v/copying.lib deleted file mode 100644 index 7d78362..0000000 --- a/v/copying.lib +++ /dev/null @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/v/includew/v/v_defs.h b/v/includew/v/v_defs.h deleted file mode 100644 index cf39043..0000000 --- a/v/includew/v/v_defs.h +++ /dev/null @@ -1,429 +0,0 @@ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// - -#ifndef V_DEFS_H -#define V_DEFS_H -// -// Windows -// -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// -// // -// VV VV VV VV // -// VV VV V - A Portable C++ GUI Framework VV VV // -// VV VV designed and written by VV VV // -// VV VV VV VV // -// VV VV Bruce E. Wampler, Ph.D. VV VV // -// VVV e-mail: bruce@objectcentral.com VVV // -// V V // -// // -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// -// // -// v_defs.h - Standard V definitions // -// // -// Copyright (C) 1995-2000 Bruce E. Wampler // -// // -// This file is part of the V C++ GUI Framework. // -// // -// This library is free software; you can redistribute it and/or // -// modify it under the terms of the GNU Lesser General Public // -// License as published by the Free Software Foundation; either // -// version 2.1 of the License, or (at your option) any later version. // -// // -// This library is distributed in the hope that it will be useful, // -// but WITHOUT ANY WARRANTY; without even the implied warranty of // -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // -// Library General Public License for more details. // -// // -// You should have received a copy of the GNU Lesser General Public // -// License along with this library (see COPYING.LIB); if not, write to the // -// Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -// // -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// - -//#ifndef vDEBUG // force DEBUG for now -//#define vDEBUG -//#endif -//#undef vDEBUG - -#ifdef WIN32 -#undef VWIN16 -#endif - -#include -#include -#include -#include - -#define V_VersMajor 1 -#define V_VersMinor 25 -#define V_Version "V 1.25 - 15 Sep 2000" -#define V_VersionWindows 1 - -// VCONST can be defined as const, but that will require changes -// to apps. We will wait until V 2.0 for that to happen officially, -// but for now, this is available, at least on some classes. -// The VMUTABLE const is associated with VCONST. - -//#define VCONST const -//#define VMUTABLE mutable - -#define VCONST -#define VMUTABLE - -// V_DLL support - added in 1.22 -#include - - // system error functions - extern void vSysWarning(VCONST char* msg); - extern void vSysError(VCONST char* msg); - - // Define basic types - - typedef unsigned int vKey; // Value for a Key - typedef int ItemVal; // Value for an Item (menu,button, etc) - typedef unsigned long CmdAttribute; // Attributes of commands - -#define vRGB (v,x,y,z) v.r = x ; v.g = y ; v.z = b; -#define vpRGB (v,x,y,z) v->r = x ; v->g = y ; v->z = b; -const int maxFileNameSize = 262; - - typedef struct DebugMask - { - unsigned - System : 1, // System debug messages - CmdEvents : 1, // Show command events (buttons, etc.) - MouseEvents : 1, // Show mouse events - WindowEvents : 1, // Window events (resize, etc.) - Build : 1, // Define/Build window - BadVals: 1, // Error values - Misc : 1, // Misc stuff - Text : 1, // Text events - Constructor : 1, // Show constructors - Destructor : 1, // Show destructors - User: 1, // Debug user events - UserApp1 : 1, // Level 1 User App - UserApp2 : 1, // Level 2 User App - UserApp3 : 1; - } DebugMask; - - extern DebugMask DebugState; // allow everyone to see DebugState - -// Define some macros to make adding debugging stuff easy - -#ifdef vDEBUG -#define UserDebug(u,v) if (DebugState.u && DebugState.User) { FILE *fh=fopen("vdebug.log", "a"); fprintf(fh,v); fclose(fh); } -#define UserDebug1(u,v,w) if (DebugState.u && DebugState.User) { FILE *fh=fopen("vdebug.log", "a"); fprintf(fh,v,w); fclose(fh); } -#define UserDebug2(u,v,w,x) if (DebugState.u && DebugState.User) { FILE *fh=fopen("vdebug.log", "a"); fprintf(fh,v,w,x); fclose(fh); } -#define UserDebug3(u,v,w,x,z) if (DebugState.u && DebugState.User) { FILE *fh=fopen("vdebug.log", "a"); fprintf(fh,v,w,x,z); fclose(fh); } - -#define SysDebug(u,v) if (DebugState.u && DebugState.System) fprintf(stderr,v); -#define SysDebug1(u,v,w) if (DebugState.u && DebugState.System) fprintf(stderr,v,w); -#define SysDebug2(u,v,w,x) if (DebugState.u && DebugState.System) fprintf(stderr,v,w,x); -#define SysDebug3(u,v,w,x,z) if (DebugState.u && DebugState.System) fprintf(stderr,v,w,x,z); - -#else - -#define UserDebug(u,v) // Nothing -#define UserDebug1(u,v,w) // Nothing -#define UserDebug2(u,v,y,x) // Nothing -#define UserDebug3(u,v,y,x,z) // Nothing - -#define SysDebug(u,v) // Nothing -#define SysDebug1(u,v,w) // Nothing -#define SysDebug2(u,v,w,x) // Nothing -#define SysDebug3(u,v,w,x,z) // Nothing -#endif - -// Define some standard font ids, which will internally correspond -// to both the id and the index of the vApp font array. - - - enum WindowType { WINDOW, CMDWINDOW, DIALOG }; // Types of windows - - // How Items can be set - enum ItemSetType {Checked, Sensitive, Value, Hidden, ChangeList, - ChangeListPtr, Red, Green, Blue, ChangeColor}; - - enum CmdType // types of dialog commands - { - C_EndOfList, // Used to denote end of command list - C_ArrowButton, // An arrow button - C_Blank, // filler to help RightOfs, Belows work - C_BoxedLabel, // A status bar boxed label (Win only) - C_Button, // Boxed Label - C_CheckBox, // Checked Item - C_ColorButton, // A colored button - C_ColorLabel, // A colored label - C_Custom, // A custom control - C_ComboBox, // Popup combo list - C_Frame, // General purpose frame - C_Icon, // a display only Icon - C_IconButton, // a command button Icon - C_Label, // Regular text label - C_List, // List of items (scrollable) - C_Menu, // Menu item - C_ProgressBar, // Bar to show progress - C_RadioButton, // Radio button - C_SComboBox, // Popup string combo list - C_Slider, // Slider to enter value - C_SList, // String List of items (scrollable) - C_Spinner, // a spinner box - C_TextIn, // Text input field - C_Text, // wrapping text out - C_ToggleButton, // A toggle button - C_ToggleFrame, // A toggle frame - C_ToggleIconButton, // A toggle icon button - C_ZZZ // make my life easy - }; - - enum PaneType // Kinds of Panes - { - P_Canvas, // Drawing Canvas - P_TextCanvas, // TextCanvas - P_Menu, // Menu - P_Commands, // Commands - P_Icons, // Icon Bar - P_Buttons, // Button Bar - P_Status, // Status Bar - P_Dialog // Dialog - }; - - - const CmdAttribute CA_None = 0; // No special attributes - const CmdAttribute CA_MainMsg = 0x01; // Gets replacement message - const CmdAttribute CA_DefaultButton = 0x02; // Special Default Button - - const CmdAttribute CA_Large = 0x04; // Command larger than normal - const CmdAttribute CA_Small = 0x08; // Command smaller than normal - const CmdAttribute CA_Hidden = 0x10; // Starts out hidden - const CmdAttribute CA_Horizontal = 0x20; // Horizontal orentation - const CmdAttribute CA_Vertical = 0x40; // Vertical orentation - const CmdAttribute CA_NoNotify = 0x100; // Don't notify on all events - const CmdAttribute CA_NoLabel = 0x100; // No label (ProgressCmd only) - const CmdAttribute CA_Simple = 0x100; // backward compatible - const CmdAttribute CA_Password = 0x100; // for text in control only - const CmdAttribute CA_Text = 0x200; // A Spin/Text command - const CmdAttribute CA_TextInNotify = 0x200; // Notify when TextIn changes - const CmdAttribute CA_NoBorder = 0x400; // No border (frames, status bar) - const CmdAttribute CA_NoSpace = 0x800; // No space between widgets - const CmdAttribute CA_ListWidth = 0x800; // Special for lists - - const CmdAttribute CA_PerControl = 0x1000; // Specific to different controls - const CmdAttribute CA_Percent = 0x1000; // Show % for ProgressCmd - const CmdAttribute CA_Size = 0x1000; // size specified in size element - - // New attributes - require 32 bit, so CmdAttribute is now a long! - const CmdAttribute CA_Flat = 0x10000; // flat icon buttons - - // These definitions go here because the user app should not need - // to know about menus and buttons - only the static data structures - // needed to define those things - and so shouldn't have to include - // the header file for each menu or command object - - // definitions for dialog box command objects - -const ItemVal NoList = 0; // no attributes, items is null list; -const ItemVal NoFrame = 0; // no frame used - - typedef struct CommandObject - { - CmdType cmdType; // what kind of item is this - ItemVal cmdId; // unique id for the item - ItemVal retVal; // value returned when picked (might be < 0) - VCONST char* title; // string - void* itemList; // a list of stuff to use for the cmd - CmdAttribute attrs; // bit map of attributes - unsigned - Sensitive : 1; // if item is sensitive or not - ItemVal cFrame; // Frame used for an item - ItemVal cRightOf; // Item placed left of this id - ItemVal cBelow; // Item placed below this one - int size; // Used for sizes - VCONST char* tip; // tip string - } CommandObject; - - -#define DialogCmd CommandObject // for backward compatibility - - typedef struct vMenu - { - VCONST char* label; // The label on the menu - ItemVal menuId; // A User assigned unique value - unsigned - sensitive : 1, // If item is sensitive or not - checked : 1; // If item is checked or not - VCONST char* keyLabel; // Label for an accelerator key - vKey accel; // Value of accelerator key - vMenu* SubMenu; // Ptr to a submenu - unsigned int kShift; // Shift state for accel - } vMenu; - -#define vStatusPane vCommandPane // stat bars are really command bars - - typedef struct vStatus // for status bars - { - VCONST char* label; // label of button - ItemVal statId; // value - CmdAttribute attrs; // bit map of attributes - unsigned - sensitive : 1; // if button is sensitive or not - int width; // if need to specify width (0 => default) - } vStatus; - - // symbols for defining menus - -const int noKey = 0; -const int noKeyLbl = 0; -const int isSens = 1; -const int notSens = 0; -const int isChk = 1; -const int notChk = 0; -const int noSub = 0; -const int notUsed = 0; -const int noIcon = 0; - - // standard menu definitions -const ItemVal M_File = 32000; -const ItemVal M_Edit = 32001; -const ItemVal M_Search = 32002; -const ItemVal M_Help = 32003; -const ItemVal M_Window = 32004; -const ItemVal M_Options = 32005; -const ItemVal M_Tools = 32006; -const ItemVal M_Font = 32007; -const ItemVal M_View = 32008; -const ItemVal M_Format = 32009; -const ItemVal M_Insert = 32010; -const ItemVal M_Test = 32011; - -const ItemVal M_Line = 32090; - -const ItemVal M_New = 32100; -const ItemVal M_Open = 32101; -const ItemVal M_Close = 32102; -const ItemVal M_Save = 32103; -const ItemVal M_SaveAs = 32104; -const ItemVal M_Print = 32105; -const ItemVal M_PrintPreview = 32106; -const ItemVal M_About = 32107; -const ItemVal M_Exit = 32108; -const ItemVal M_CloseFile = 32109; // V:1.13 - -const ItemVal M_Cut = 32110; -const ItemVal M_Copy = 32111; -const ItemVal M_Paste = 32112; -const ItemVal M_Delete = 32113; -const ItemVal M_Clear = 32114; - -const ItemVal M_UnDo = 32120; -const ItemVal M_SetDebug = 32121; -const ItemVal M_SaveClose = 32122; -const ItemVal M_Abandon = 32123; - -const ItemVal M_Find = 32130; -const ItemVal M_FindAgain = 32131; -const ItemVal M_Replace = 32132; -const ItemVal M_Preferences = 32135; -const ItemVal M_FontSelect = 32136; - -const ItemVal M_User0 = 32140; -const ItemVal M_User1 = 32141; -const ItemVal M_User2 = 32142; -const ItemVal M_User3 = 32143; -const ItemVal M_User4 = 32144; -const ItemVal M_User5 = 32145; -const ItemVal M_User6 = 32146; -const ItemVal M_User7 = 32147; -const ItemVal M_User8 = 32148; -const ItemVal M_User9 = 32149; - -const ItemVal M_Cancel = 32150; -const ItemVal M_Done = 32151; -const ItemVal M_OK = 32152; -const ItemVal M_Yes = 32153; -const ItemVal M_No = 32154; -const ItemVal M_All = 32155; -const ItemVal M_None = 32156; - -const ItemVal M_TextInChange = 32158; -const ItemVal M_TextInLeaveFocus = 32159; - -const ItemVal M_Cascade = 32160; -const ItemVal M_Tile = 32161; -const ItemVal M_Arrange = 32162; -const ItemVal M_CloseAll = 32163; -const ItemVal M_OpenPath = 32164; -const ItemVal M_WindowsReserved1 = 32170; // mdi frame new -const ItemVal M_WindowsReserved2 = 32171; // mdi frame open -const ItemVal M_WindowsReserved3 = 32172; // mdi frame exit -const ItemVal M_WindowsReserved4 = 32173; -const ItemVal M_WindowsReserved5 = 32174; -#define M_FIRSTCHILD 32200 // higher than everything else - -//-------------------------------------------------------------------------- - -// Definitions for drawing - - typedef struct vPoint // a point - { - int x, y; // WIN16 version - } vPoint; - - typedef struct vRect - { - int x,y,w,h; - } vRect; - - typedef struct vLine - { - int x,y,xend,yend; - } vLine; - -// for brushes and pens - -const int vSolid = 1; -const int vTransparent = 2; - -// for brushes - -const int vHorizontalHatch = 3; -const int vVerticleHatch = 4; -const int vVerticalHatch = 4; -const int vLeftDiagonalHatch = 5; -const int vRightDiagonalHatch = 6; -const int vCrossHatch = 7; -const int vDiagonalCrossHatch = 8; - -// for pens -const int vDash = 9; -const int vDot = 10; -const int vDashDot = 11; - -// for filling -const int vAlternate = 12; -const int vWinding = 13; - -//-------------------------------------------------------------------------- - -// Some messages needed to manage things in Windows -#define vWM_MDIChildDestroy (WM_USER + 0) -// void OnMDIChildDestroy(HWND hwnd) -#define HANDLE_vWM_MDIChildDestroy(hwnd,wParam,lParam, fn) \ - ((fn)((hwnd)), 0L) -#define FORWARD_vWM_MDIChildDestroy(hwnd, fn) \ - (void)(fn)((hwnd), vWM_MDIChildDestroy, (WPARAM)0, (LPARAM)0) - -#define vWM_ResizeMDIClient (WM_USER + 1) -// void OnResizeMDIClient(HWND hwnd) -#define HANDLE_vWM_ResizeMDIClient(hwnd,wParam,lParam, fn) \ - ((fn)((hwnd)), 0L) -#define FORWARD_vWM_ResizeMDIClient(hwnd, fn) \ - (void)(fn)((hwnd), vWM_ResizeMDIClient, (WPARAM)0, (LPARAM)0) - - - -#endif diff --git a/v/includew/v/vapp.h b/v/includew/v/vapp.h deleted file mode 100644 index e3a5f06..0000000 --- a/v/includew/v/vapp.h +++ /dev/null @@ -1,213 +0,0 @@ -//=============================================================== -// vapp.h - the vapp base object - Windows version -// -// Copyright (C) 1995-1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VAPP_H -#define VAPP_H - -#include // our parent class -#include // our parent class -#include -#include -#include - -#define MaxAppFonts FontIdsUsed - -// DLL definitions - beginning with V 1.24 and mingw 2.95.2-1 -// These definitions contributed by Franco Bez -#if defined(USE_V_DLL) && !defined(BUILD_V_DLL) -#if defined (__MINGW32__) || defined(__CYGWIN32__) - // This forces the GNU Linker to include vstartup.o in the executable - // Only needed here for DLL use, it must be in one of the Applications - // object files for the static library -> see vApp.cpp - // bug in mingw32 and cygwin loader - static int (*gnuw32dummy)(HINSTANCE,HINSTANCE,LPSTR,int)=WinMain; -#endif -#endif - - class V_EXPORT vWindow; - class V_EXPORT vCmdWindow; - class V_EXPORT vCommandPane; - - typedef struct WindList - { - vWindow* window; - vAppWinInfo* info; - WindList* nextWinList; - } WindList; - - typedef struct CmdPaneList - { - vCommandPane* commandPane; - CmdPaneList* nextCPList; - } CmdPaneList; - - long CALLBACK PMdiFrameProc(HWND, UINT, UINT, LPARAM); - long CALLBACK PMdiWindowProc(HWND, UINT, UINT, LPARAM); - - class V_EXPORT _appWorkTimer : public vTimer - { - public: //---------------------------------------- public - _appWorkTimer() {} - ~_appWorkTimer() {} - virtual void TimerTick(); - private: //--------------------------------------- private - }; - - class V_EXPORT vApp : public vBaseItem - { - // give friend access to some special things - friend class V_EXPORT vWindow; // Provide access for vWindow class - friend class V_EXPORT vCmdWindow; // Provide access for vWindow class - friend class V_EXPORT vMenuPane; // Menu Pane needs access - friend class V_EXPORT vCommandPane; - friend V_EXPORT int CMain(HANDLE hInstance, HANDLE hPrevInstance, - LPSTR lpszCmdLine, int nCmdShow); // give main access - friend long WINAPI V_EXPORT PMdiFrameProc(HWND, UINT, UINT, LPARAM); - friend long WINAPI V_EXPORT PMdiWindowProc(HWND, UINT, UINT, LPARAM); - friend class _appWorkTimer; - - - public: //---------------------------------------- public - - vApp(VCONST char* appName, int simSDI = 0, int frameHeight = 0, int frameWidth = 0); // constructor - virtual ~vApp(); // destructor - - // Methods to override - - virtual void AppCommand(vWindow* win, ItemVal id, ItemVal retval, - CmdType ctype); - virtual void CloseLastCmdWindow(vWindow* win, int exitcode); - virtual int CloseAppWin(vWindow* win); - virtual int CloseHelpWin(vWindow* win); - int IsHelpWin(vWindow *Win); - virtual void Exit(void); - virtual void KeyIn(vWindow* win, vKey key, unsigned int shift); - virtual vWindow* NewAppWin(vWindow* win, VCONST char* name, - int w = 0, int h = 0, vAppWinInfo* winInfo = 0); - virtual vWindow* NewHelpWin(vWindow* win, VCONST char* name, - int w, int h); - - virtual void DropFile(const char *fn); - - // Utlity methods - - void showAppWin(bool show); - - vFont GetDefaultFont(); - - void GetVVersion(int& major, int& minor) - { major = V_VersMajor; minor = V_VersMinor;} - int DefaultHeight() { return _DefaultHeight; } - int DefaultWidth() {return _DefaultWidth; } - int IsRunning() {return _running;} // see if app is running - void SendWindowCommandAll(ItemVal id, int val, CmdType ctype); - void UpdateAllViews(vWindow* sender = NULL, int hint = 0, - void* pHint = NULL); - void SetValueAll(ItemVal id, int val, ItemSetType setType); - void SetAppTitle(VCONST char* title); - void SetStringAll(ItemVal id, VCONST char* str); - int ShowList(); - vAppWinInfo *getAppWinInfo(vWindow* Win); - void AppExit(int exitVal); - int InExit() { return _inExit; } - - - int ClipboardSetText(VCONST char* text) VCONST; - char* ClipboardGetText() VCONST; - int ClipboardCheckText() VCONST; - void ClipboardClear() VCONST; - - // Tasking - void CheckEvents(); - - int EnableWorkSlice(long slice); - virtual void WorkSlice() {} // No op by default - - // Windows stuff - - HWND winHwnd() VCONST { return _Frame; } - HWND winClientHwnd() VCONST { return _Client; } - int simSDI() VCONST {return _simSDI;} - - HMENU AppFrameMenu() {return hFrameMenu;} - - HPEN _WhitePen; - HPEN _GrayPen; // for drawing stuff - HPEN _LightPen; - HPEN _ShadowPen; - HBRUSH _BarBrush; - - - protected: //--------------------------------------- protected - - WindList* _WindowList; // List of "top level" windows - CmdPaneList* _CmdPaneList; // List of command panes - - - int _running; // if we are running - - // The following two are called from main. - void initialize(int& argc, char** argv, - HANDLE hInstance, HANDLE hPrevInstance, int nCmdShow); - int doEventLoop(); - - private: //--------------------------------------- private - - int _DefaultHeight; - int _DefaultWidth; - int _frameWidth, _frameHeight; - int _inExit; // If in exit procudure - int _simSDI; // if Simulate SDI interface - - WindList* _DeleteList; // List of windows to delete - - VMUTABLE char* _clipText; - - _appWorkTimer* _workTimer; // timer for work slice - - void addToDeleteList(vWindow *Win); - void registerWindow(vWindow* Win, vAppWinInfo* awinfo); - void unregisterWindow(vWindow* Win); - void DispatchWork(void); - - void registerCmdPane(vCommandPane* cmdPane); - void unregisterCmdPane(vCommandPane* cmdPane); - void selectCmdPanes(vWindow* parent); - - // Windows stuff - - long MdiFrameProc(HWND hwnd, UINT message, - UINT wParam, LPARAM lParam); - void OnDnD(HWND hWnd, HDROP wParam); - int OnCreate(HWND hwnd, CREATESTRUCT FAR* lpCreateStruct); - void OnClose(HWND hwnd); - int OnQueryEndSession(HWND hwnd); - void OnDestroy(HWND hwnd); - void OnSysCommand(HWND hwnd, UINT cmd, int x, int y); - void OnSize(HWND hwnd, UINT state, int cx, int cy); - void OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify); - LRESULT Frame_DefProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); - void OnResizeMDIClient(HWND hwnd); - - HMENU hFrameMenu, hFrameSubMenu; // Default menu - HWND _Frame, _Client ; // Need these for MDI frame - HANDLE hAccel; - vWindow* _curThis; // Needed to fake things out at the start - - HICON _appicon, _winicon; - }; -// theApp is accessed by a function call. -// - V_EXPORT DWORD vGetApp(); -#define theApp ((vApp*)vGetApp()) - -// extern vApp *theApp; // Pointer to single global instance -#endif diff --git a/v/includew/v/vawinfo.h b/v/includew/v/vawinfo.h deleted file mode 100644 index 6d44516..0000000 --- a/v/includew/v/vawinfo.h +++ /dev/null @@ -1,35 +0,0 @@ -//=============================================================== -// vawinfo.h - vAppWinInfo utility class for tracking windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VAWINFO_H -#define VAWINFO_H - -#include // include basic defs - - class V_EXPORT vAppWinInfo - { - public: //---------------------------------------- public - - vAppWinInfo(VCONST char* name = "", VCONST void* ptr = 0); - virtual ~vAppWinInfo(); - - virtual VCONST char* infoName() {return _infoName;} - virtual VCONST void* getPtr() {return _ptr;} - - protected: //--------------------------------------- protected - - char* _infoName; // name of item - VCONST void* _ptr; - - private: //--------------------------------------- private - - }; -#endif diff --git a/v/includew/v/vbaseitm.h b/v/includew/v/vbaseitm.h deleted file mode 100644 index f9c49d2..0000000 --- a/v/includew/v/vbaseitm.h +++ /dev/null @@ -1,39 +0,0 @@ -//=============================================================== -// vbaseitm.h - the base class that holds handle information -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VBASEITEM_H -#define VBASEITEM_H - -#include // include basic defs - - - class V_EXPORT vBaseItem - { - public: //---------------------------------------- public - - vBaseItem(const vBaseItem& b); // Copy constructor - virtual ~vBaseItem(); // needed to free name - - const HANDLE vHandle() VCONST { return _vHandle; } - const char* name() VCONST { return (const char*) _name;} - - protected: //--------------------------------------- protected - - char* _name; // name of item - HANDLE _vHandle; // Window HANDLE widget - int _copied; - - vBaseItem(VCONST char* name); // Protected makes this a base class - // prevents instantiation - - private: //--------------------------------------- private - }; -#endif diff --git a/v/includew/v/vbasewin.h b/v/includew/v/vbasewin.h deleted file mode 100644 index 2121c7f..0000000 --- a/v/includew/v/vbasewin.h +++ /dev/null @@ -1,48 +0,0 @@ -//=============================================================== -// vbasewin.h - vBaseWindow class definitions - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VBASEWIN_H -#define VBASEWIN_H - -#include // base info class - - class V_EXPORT vBaseWindow : public vBaseItem - { - public: //---------------------------------------- public - - vBaseWindow(VCONST char* name); // Constructor - vBaseWindow(const vBaseWindow& w); // Copy Constructor - virtual ~vBaseWindow(); // Destructor - - virtual void initialize(void) {} // Pure virtual function - - virtual void ShowWindow(void) { showBaseWindow(); } - - void closeBaseWindow(void); // Kill window - - WindowType wType() VCONST {return _wType;} // what kind of window we are - - HWND winHwnd() VCONST {return _myHwnd;} - - - protected: //--------------------------------------- protected - - HWND _myHwnd; // my MDI window - WindowType _wType; // what kind of window we are building - - void showBaseWindow(void) - { } // Pop us up - - - private: //--------------------------------------- private - - }; -#endif diff --git a/v/includew/v/vbglcnv.h b/v/includew/v/vbglcnv.h deleted file mode 100644 index 09975aa..0000000 --- a/v/includew/v/vbglcnv.h +++ /dev/null @@ -1,89 +0,0 @@ -//=============================================================== -// vglcnv.h GL Canvas C++ class .h file - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VGLCNV_H -#define VGLCNV_H - -#include - -#ifndef WIN32 -#define WIN32 -#endif - -extern "C" -{ -// OpenGL stuff here -#include -#include -} - -const unsigned int vGL_Default = 0; // Note for Win32 : -const unsigned int vGL_RGB = 0x0001; // RGBA is used (with alpha) -const unsigned int vGL_Alpha = 0x0002; // No independant alphamode on Win32 - // if Alpha is set, RGBA is used -const unsigned int vGL_Indexed = 0x0004; -const unsigned int vGL_DoubleBuffer = 0x0008; -const unsigned int vGL_Stereo = 0x0010; -const unsigned int vGL_Stencil = 0x0020; -const unsigned int vGL_Accum = 0x0040; -const unsigned int vGL_Depth = 0x0080; - - - class vWindow; // we are part of a window - - class vBaseGLCanvasPane : public vCanvasPane - { - - public: //---------------------------------------- public - - vBaseGLCanvasPane(unsigned int vGLmode = vGL_Default, PaneType pt = P_Canvas); - - virtual ~vBaseGLCanvasPane(); - - - // Expose/redraw event - virtual void Resize(int newW, int newH); // Resize event - - // OpenGL specific stuff - - virtual void graphicsInit(void); - - void vglMakeCurrent(void); - - virtual void vglFlush(); - - - // Platform dependent - - - protected: //--------------------------------------- protected - - virtual void initialize(vWindow* pWindow, HWND pWidget); -// virtual void CreateDC(void); - - // Drawing and OpenGL for Win32 - HDC _hDC; // device context - HGLRC _hGLRC; // OpenGL context - HPALETTE _hPalette; // Palette - - - private: //--------------------------------------- private - - // OpenGL initialization of the drawings - void _setUpPixelFormat(); - void _setUpPalette(); - - // OpenGL infos - static int _pixelFormat; - static int _doubleBuffer; // if we have double buffering - static unsigned int _vGLmode; - }; -#endif diff --git a/v/includew/v/vboxlblc.h b/v/includew/v/vboxlblc.h deleted file mode 100644 index e6852ca..0000000 --- a/v/includew/v/vboxlblc.h +++ /dev/null @@ -1,43 +0,0 @@ -//=============================================================== -// vboxlblc.h - boxed label class - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VBOXLBLC_H -#define VBOXLBLC_H - -#include // We are derived from vcmd - - class V_EXPORT vCmdParent; - - class V_EXPORT vBoxedLabelCmd : public vCmd - { - - public: //---------------------------------------- public - - vBoxedLabelCmd(vCmdParent* dp, CommandObject* co); - - virtual ~vBoxedLabelCmd(); - - virtual void initialize(void); - virtual void SetCmdVal(ItemVal val, ItemSetType st); - virtual void SetCmdStr(VCONST char* str); - - virtual void CmdCallback(int id, WORD codeNotify); - - virtual int MEASUREITEM(int id, MEASUREITEMSTRUCT* mis); - virtual int DRAWITEM(int id, DRAWITEMSTRUCT* dis); - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - char _lbl[80]; - - }; -#endif diff --git a/v/includew/v/vbrush.h b/v/includew/v/vbrush.h deleted file mode 100644 index 5899064..0000000 --- a/v/includew/v/vbrush.h +++ /dev/null @@ -1,62 +0,0 @@ -//=============================================================== -// vbrush.h: brush class header for filling - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VBRUSH_H -#define VBRUSH_H - -#include // Basic defs -#include - -// Use Windows for brush styles, map to something reasonable for X - - class V_EXPORT vBrush - { - public: //---------------------------------------- public - - vBrush(unsigned int r = 0, unsigned int g = 0, unsigned int b = 0, - int style = vSolid, int fillMode = vAlternate); - - vBrush(const vBrush& p); - - vBrush& operator =(const vBrush& p); - - int operator ==(const vBrush& b2) VCONST - { return (brushColor == b2.brushColor && brushFillMode == b2.brushFillMode && - brushStyle == b2.brushStyle); } - - int operator !=(const vBrush& b2) VCONST - { return (brushColor != b2.brushColor || brushFillMode != b2.brushFillMode || - brushStyle != b2.brushStyle); } - - ~vBrush(); - - void SetStyle(int style); - int GetStyle() VCONST { return brushStyle; } - - void SetColor(vColor c); - void SetColor(unsigned int r, unsigned int g, unsigned int b); - vColor GetColor() VCONST { return brushColor; } - - void SetFillMode(int fillMode); - int GetFillMode() VCONST { return brushFillMode; } - - HBRUSH GetHBRUSH() VCONST; - - protected: //--------------------------------------- protected - private: //--------------------------------------- private - int brushFillMode; - int brushStyle; - VMUTABLE HBRUSH _hbrush; - VMUTABLE int _created; - vColor brushColor; - }; - -#endif diff --git a/v/includew/v/vbtncmd.h b/v/includew/v/vbtncmd.h deleted file mode 100644 index d3d8404..0000000 --- a/v/includew/v/vbtncmd.h +++ /dev/null @@ -1,49 +0,0 @@ -//=============================================================== -// vbtncmd.h - Button Command class -- Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VBTNCMD_H -#define VBTNCMD_H - -#include -#include // We are derived from vcmd - - class V_EXPORT vCmdParent; - class V_EXPORT vIcon; - - class V_EXPORT vButtonCmd : public vCmd - { - - public: //---------------------------------------- public - - vButtonCmd(vCmdParent* dp, CommandObject* co); - - virtual ~vButtonCmd(void); - - virtual void initialize(void); - - virtual int GetCmdValue(ItemVal id) VCONST; - virtual void ResetItemValue(void); - virtual void SetCmdVal(ItemVal val, ItemSetType st); - - virtual void SetCmdStr(VCONST char* str); - - virtual int MEASUREITEM(int id, MEASUREITEMSTRUCT* mis); - virtual int DRAWITEM(int id, DRAWITEMSTRUCT* dis); - - protected: //--------------------------------------- protected - virtual void CmdCallback(int id, WORD codeNotify); - - private: //--------------------------------------- private - void initIconButton(long style); - vIcon* _ip; - - }; -#endif diff --git a/v/includew/v/vcanvas.h b/v/includew/v/vcanvas.h deleted file mode 100644 index d2ee163..0000000 --- a/v/includew/v/vcanvas.h +++ /dev/null @@ -1,264 +0,0 @@ -//=============================================================== -// vcanvas.h Canvas C++ class .h file - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VCANVAS_H -#define VCANVAS_H - -#include // Basic defs -#include // we are derived from vPane -#include // we also derive from vDrawingCanvasDC -#include - -/* We do this since some windows header files define CreateDC as CreateDCA, - which is fine, until we don't include that header file */ -#undef CreateDC - - typedef int VCursor; // For cursors - -// Define Cursor stuff - -const VCursor VC_None = 0; // No/Default cursor -const VCursor VC_Arrow = 1; // XC_top_left_arrow -const VCursor VC_CenterArrow = 2; // XC_center_ptr -const VCursor VC_CrossHair = 3; // XC_crosshair -const VCursor VC_EWArrows = 4; // XC_sb_h_double_arrow -const VCursor VC_Hand = 5; // XC_hand2 -const VCursor VC_IBar = 6; // XC_xterm -const VCursor VC_Icon = 7; // XC_icon -const VCursor VC_NSArrows = 8; // XC_sb_v_double_arrow -const VCursor VC_Pencil = 9; // XC_Pencil -const VCursor VC_Question = 10; // XC_question_arrow -const VCursor VC_Sizer = 11; // XC_sizing -const VCursor VC_Wait = 12; // XC_watch -const VCursor VC_X = 13; // XC_X_cursor -const VCursor VC_LAST = 13; -const int maxCursors = 13; - - class V_EXPORT vWindow; // we are part of a window - class V_EXPORT vIcon; - class V_EXPORT vMemoryDC; - class V_EXPORT vColor; - - class V_EXPORT vCanvasPane : public vPane - { - friend class vWindow; - - public: //---------------------------------------- public - - vCanvasPane(PaneType pt = P_Canvas); - - virtual ~vCanvasPane(); - - virtual void ShowPane(int OnOrOff) VCONST; - - void SetWidthHeight(int width, int height); - - // Cursor - void SetCursor(VCursor id); - VCursor GetCursor() VCONST { return _currentCursor; } - - void UnSetCursor(void); - - void CompressRedraw(int val) { _compressRedraw = val; } - - // Scrolling - virtual void HPage(int Shown, int Top); // Horiz page event - virtual void VPage(int Shown, int Top); // Vert page event - virtual void HScroll(int step); // Horiz scroll event - virtual void VScroll(int step); // Vert scroll event - virtual void SetHScroll(int Shown, int Top); // Set Horiz Scroll bar - virtual void SetVScroll(int Shown, int Top); // Set Vert Scroll bar - virtual int GetVScroll(int& Shown, int& Top) VCONST; - virtual int GetHScroll(int& Shown, int& Top) VCONST; - virtual void ShowHScroll(int OnOff); - virtual void ShowVScroll(int OnOff); - - // Change messages - virtual void FontChanged(VCONST vFont& vf); - - // Events - virtual void MouseDown(int x, int y, int button); // Mouse Down at x,y - virtual void MouseUp(int x, int y, int button); // Mouse Up at x,y - virtual void MouseMove(int x, int y, int button); // Mouse Moved to x,y - virtual void MouseMotion(int x, int y) {} // No Button Mouse Move - - virtual void EnterFocus(void); - virtual void LeaveFocus(void); - - // Expose/redraw event - virtual void Redraw(int x, int y, int width , int height); - virtual void Resize(int newW, int newH); // Resize event - - // Information - virtual int GetWidth() VCONST { return _width; } // Get width of canvas - virtual int GetHeight() VCONST { return _height; } // Get Height of canvas - - // Drawing - - void Clear(void) - { _cpDC->Clear(); } - - virtual void ClearRect(int left, int top, int width, int height) - { _cpDC->ClearRect(left, top, width, height); } - - virtual void CopyFromMemoryDC(vMemoryDC* vmemdc, int destX, int destY, - int srcX = 0, int srcY = 0, int srcW = 0, int srcH = 0) // V:1.13 - { _cpDC->CopyFromMemoryDC(vmemdc,destX,destY,srcX,srcY,srcW,srcH);} - -#ifdef DRAWARC - virtual void DrawArc(int xx1, int yy1, int xx2, int yy2, int xxc, int yyc) - { _cpDC->DrawArc(xx1, yy1, xx2, yy2, xxc, yyc); } -#endif - - virtual void DrawAttrText(int x, int y, VCONST char* text, - const ChrAttr attr) - { _cpDC->DrawAttrText(x, y, text, attr); } - - virtual void DrawText(int x, int y, VCONST char* text) - { _cpDC->DrawText(x, y, text); } - - virtual void DrawEllipse(int x, int y, int width, int height) - { _cpDC->DrawEllipse(x, y, width, height); } - - virtual void DrawIcon(int x, int y, vIcon& icon) - { _cpDC->DrawIcon(x,y,icon); } - - virtual void DrawLine(int x, int y, int xend , int yend) - { _cpDC->DrawLine(x, y, xend , yend); } - - virtual void DrawLines(vLine* lineList, int count) - { _cpDC->DrawLines(lineList, count);} - - virtual void DrawLines(vPoint* pts, int count) - { _cpDC->DrawLines(pts, count);} - - virtual void DrawColorPoints(int x, int y, int nPoints, vColor* pointList) - {_cpDC->DrawColorPoints(x,y,nPoints,pointList); } - - virtual void DrawPoint(int x, int y) - { _cpDC->DrawPoint(x, y); } - - virtual void DrawPoints(vPoint* pointList, int count) - { _cpDC->DrawPoints(pointList, count); } - - virtual void DrawPolygon(int n, vPoint points[], int fillStyle = vAlternate) - { _cpDC->DrawPolygon(n, points, fillStyle); } - - virtual void DrawRectangle(int x, int y, int width, int height) - { _cpDC->DrawRectangle(x, y, width, height); } - - virtual void DrawRectangles(vRect* rectList, int count) - { _cpDC->DrawRectangles(rectList,count);} - - virtual void DrawRoundedRectangle(int x, int y, - int width, int height, int radius = 10) - { _cpDC->DrawRoundedRectangle(x, y, width, height, radius); } - - virtual void DrawRubberLine(int x, int y, int xend, int yend) - { _cpDC->DrawRubberLine(x, y, xend, yend); } - - virtual void DrawRubberEllipse(int x, int y, int width, int height) - { _cpDC->DrawRubberEllipse(x, y, width, height); } - - virtual void DrawRubberRectangle(int x, int y, int width, int height) - { _cpDC->DrawRubberRectangle(x, y, width, height); } - - virtual vBrush GetBrush(void) VCONST - { return _cpDC->GetBrush(); } - - virtual void SetBrush(VCONST vBrush& brush) - { _cpDC->SetBrush(brush); } - - virtual vFont GetFont(void) VCONST - { return _cpDC->GetFont(); } - - virtual void SetFont(VCONST vFont& ft) - { _cpDC->SetFont(ft); } - - virtual int TextWidth(VCONST char* str) VCONST - { return _cpDC->TextWidth(str);} - - virtual int TextHeight(int& asc, int& des) VCONST - { return _cpDC->TextHeight(asc, des); } - - // Appearance - - virtual void SetScale(int mult, int div) - { _cpDC->SetScale(mult,div); } - - virtual void GetScale(int& mult, int& div) VCONST - { _cpDC->GetScale(mult,div); } - - virtual void SetBackground(VCONST vColor& color) - { _cpDC->SetBackground(color); } - - virtual void SetPen(VCONST vPen& pen) - { _cpDC->SetPen(pen); } - - void SetTranslate(int x, int y) { _cpDC->SetTranslate(x,y); } - void SetTransX(int x) {_cpDC->SetTransX(x);} - void SetTransY(int y) {_cpDC->SetTransY(y);} - void GetTranslate(int& x, int& y) VCONST {_cpDC->GetTranslate(x,y);} - int GetTransX() VCONST { return _cpDC->GetTransX(); } - int GetTransY() VCONST { return _cpDC->GetTransY(); } - - vPen GetPen() VCONST - { return _cpDC->GetPen(); } - - - vDC* GetDC() VCONST { return _cpDC; } - - // Platform dependent - - HWND DrawingWindow() VCONST { return _drawWindow; } - - protected: //--------------------------------------- protected - - virtual void EnterEV(void); - virtual void LeaveEV(void); - - virtual void CreateDC(void); - - vDC* _cpDC; // pointer to our drawing canvas - - virtual void initialize(vWindow* pWindow, HWND pWidget); - - int _height; // height of draw window - int _width; // width of draw window - - HWND _drawWindow; // window for drawing - - int _hasFocus; // for focus workaround - - private: //--------------------------------------- private - - // Widgets for the canvas - HWND _drawCanvas; // whole canvas window - - int _HOn; // on or off - int _VOn; - - int _HScrlShown; - int _HScrlTop; - int _VScrlShown; - int _VScrlTop; - - int _compressRedraw; - - static VCursor _currentCursor; // for cursor - - void HScrollEV(int code, int pos, HWND control); - void VScrollEV(int code, int pos, HWND control); - - void ResizeEV(int w, int h); - void ExposeEV(void); - }; -#endif diff --git a/v/includew/v/vcb2x4.h b/v/includew/v/vcb2x4.h deleted file mode 100644 index 648ce88..0000000 --- a/v/includew/v/vcb2x4.h +++ /dev/null @@ -1,36 +0,0 @@ -//=============================================================== -// vcb2x4.h - defines a 2 row by 8 color button frame -// -// Copyright (C) 1995 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VCB2X4_H -#define VCB2X4_H -#ifndef vC_Size -#define vC_Size 8 -#endif -#ifndef vC_Frame -#define vC_Frame NoFrame -#endif -#ifndef vC_RightOf -#define vC_RightOf 0 -#endif -#ifndef vC_Below -#define vC_Below 0 -#endif -{C_Frame, M_ColorFrame,0,"",NoList,CA_NoSpace,isSens,vC_Frame,vC_RightOf,vC_Below,0}, -{C_ColorButton,M_Black, vC_Black,"",&vStdColors[vC_Black],CA_None,isSens,M_ColorFrame,0,0,vC_Size}, -{C_ColorButton,M_Red, vC_Red,"",&vStdColors[vC_Red],CA_None,isSens,M_ColorFrame,M_Black,0,vC_Size}, -{C_ColorButton,M_Green, vC_Green,"",&vStdColors[vC_Green],CA_None,isSens,M_ColorFrame,M_Red,0,vC_Size}, -{C_ColorButton,M_Blue, vC_Blue,"",&vStdColors[vC_Blue],CA_None,isSens,M_ColorFrame,M_Green,0,vC_Size}, - -{C_ColorButton,M_White, vC_White,"",&vStdColors[vC_White],CA_None,isSens,M_ColorFrame,0,M_Black,vC_Size}, -{C_ColorButton,M_Yellow, vC_Yellow,"",&vStdColors[vC_Yellow],CA_None,isSens,M_ColorFrame,M_White,M_Black,vC_Size}, -{C_ColorButton,M_Magenta, vC_Magenta,"",&vStdColors[vC_Magenta],CA_None,isSens,M_ColorFrame,M_Yellow,M_Black,vC_Size}, -{C_ColorButton,M_Cyan, vC_Cyan,"",&vStdColors[vC_Cyan],CA_None,isSens,M_ColorFrame,M_Magenta,M_Black,vC_Size}, -#endif diff --git a/v/includew/v/vcb2x8.h b/v/includew/v/vcb2x8.h deleted file mode 100644 index ec015eb..0000000 --- a/v/includew/v/vcb2x8.h +++ /dev/null @@ -1,43 +0,0 @@ -//=============================================================== -// vcb2x8.h - defines a 2 row by 8 color button frame -// -// Copyright (C) 1995 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VCB2X8_H -#define VCB2X8_H -#ifndef vC_Size -#define vC_Size 8 -#endif -#ifndef vC_Frame -#define vC_Frame NoFrame -#endif -#ifndef vC_RightOf -#define vC_RightOf 0 -#endif -#ifndef vC_Below -#define vC_Below 0 -#endif -{C_Frame, M_ColorFrame,0,"",NoList,CA_NoSpace,isSens,vC_Frame,vC_RightOf,vC_Below,0}, -{C_ColorButton,M_Black, vC_Black,"",&vStdColors[vC_Black],CA_None,isSens,M_ColorFrame,0,0,vC_Size}, -{C_ColorButton,M_White, vC_White,"",&vStdColors[vC_White],CA_None,isSens,M_ColorFrame,M_Black,0,vC_Size}, -{C_ColorButton,M_Red, vC_Red,"",&vStdColors[vC_Red],CA_None,isSens,M_ColorFrame,M_White,0,vC_Size}, -{C_ColorButton,M_Green, vC_Green,"",&vStdColors[vC_Green],CA_None,isSens,M_ColorFrame,M_Red,0,vC_Size}, -{C_ColorButton,M_Blue, vC_Blue,"",&vStdColors[vC_Blue],CA_None,isSens,M_ColorFrame,M_Green,0,vC_Size}, -{C_ColorButton,M_Yellow, vC_Yellow,"",&vStdColors[vC_Yellow],CA_None,isSens,M_ColorFrame,M_Blue,0,vC_Size}, -{C_ColorButton,M_Magenta, vC_Magenta,"",&vStdColors[vC_Magenta],CA_None,isSens,M_ColorFrame,M_Yellow,0,vC_Size}, -{C_ColorButton,M_Cyan, vC_Cyan,"",&vStdColors[vC_Cyan],CA_None,isSens,M_ColorFrame,M_Magenta,0,vC_Size}, -{C_ColorButton,M_DarkGray, vC_DarkGray,"",&vStdColors[vC_DarkGray],CA_None,isSens,M_ColorFrame,0,M_Black,vC_Size}, -{C_ColorButton,M_MedGray, vC_MedGray,"",&vStdColors[vC_MedGray],CA_None,isSens,M_ColorFrame,M_DarkGray,M_Black,vC_Size}, -{C_ColorButton,M_DimRed, vC_DimRed,"",&vStdColors[vC_DimRed],CA_None,isSens,M_ColorFrame,M_MedGray,M_Black,vC_Size}, -{C_ColorButton,M_DimGreen, vC_DimGreen,"",&vStdColors[vC_DimGreen],CA_None,isSens,M_ColorFrame,M_DimRed,M_Black,vC_Size}, -{C_ColorButton,M_DimBlue, vC_DimBlue,"",&vStdColors[vC_DimBlue],CA_None,isSens,M_ColorFrame,M_DimGreen,M_Black,vC_Size}, -{C_ColorButton,M_DimYellow, vC_DimYellow,"",&vStdColors[vC_DimYellow],CA_None,isSens,M_ColorFrame,M_DimBlue,M_Black,vC_Size}, -{C_ColorButton,M_DimMagenta, vC_DimMagenta,"",&vStdColors[vC_DimMagenta],CA_None,isSens,M_ColorFrame,M_DimYellow,M_Black,vC_Size}, -{C_ColorButton,M_DimCyan, vC_DimCyan,"",&vStdColors[vC_DimCyan],CA_None,isSens,M_ColorFrame,M_DimMagenta,M_Black,vC_Size}, -#endif diff --git a/v/includew/v/vcbtncmd.h b/v/includew/v/vcbtncmd.h deleted file mode 100644 index 366f6e3..0000000 --- a/v/includew/v/vcbtncmd.h +++ /dev/null @@ -1,46 +0,0 @@ -//=============================================================== -// vcbtncmd.h - Color Button Command class - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VCBTNCMD_H -#define VCBTNCMD_H - -#include -#include -#include // We are derived from vbtncmd -#include - - class V_EXPORT vCmdParent; - - class V_EXPORT vColorButtonCmd : public vButtonCmd - { - - public: //---------------------------------------- public - - vColorButtonCmd(vCmdParent* dp, CommandObject* co); - - virtual ~vColorButtonCmd(); - - virtual void SetCmdVal(ItemVal val, ItemSetType st); - - virtual int DRAWITEM(int id, DRAWITEMSTRUCT* dis); - - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - int _canChange; - vColor _color; // color of this button - vColor* _origColor; // ptr to orig color of this button - - void initColor(void); - - }; -#endif diff --git a/v/includew/v/vchkboxc.h b/v/includew/v/vchkboxc.h deleted file mode 100644 index 0895b4c..0000000 --- a/v/includew/v/vchkboxc.h +++ /dev/null @@ -1,46 +0,0 @@ -//=============================================================== -// vckboxc.h - CheckBox Command class - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VCKBOXC_H -#define VCKBOXC_H - -#include // We are derived from vcmd - - class V_EXPORT vCmdParent; - - class V_EXPORT vCheckBoxCmd : public vCmd - { - - public: //---------------------------------------- public - - vCheckBoxCmd(vCmdParent* dp, CommandObject* co); - - virtual ~vCheckBoxCmd(); - - virtual void initialize(void); - - virtual void ResetItemValue(void); - - virtual int GetCmdValue(ItemVal id) VCONST; - - virtual void SetCmdVal(ItemVal val, ItemSetType st); - - virtual void SetCmdStr(VCONST char* str); - - - protected: //--------------------------------------- protected - virtual void CmdCallback(int id, WORD codeNotify); - - private: //--------------------------------------- private - - - }; -#endif diff --git a/v/includew/v/vclabelc.h b/v/includew/v/vclabelc.h deleted file mode 100644 index 2cc67f5..0000000 --- a/v/includew/v/vclabelc.h +++ /dev/null @@ -1,44 +0,0 @@ -//=============================================================== -// vclabelc.h - Color Label Command class - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VCLABELC_H -#define VCLABELC_H - -#include -#include -#include // We are derived from vbtncmd -#include - - class V_EXPORT vCmdParent; - - class V_EXPORT vColorLabelCmd : public vLabelCmd - { - friend class V_EXPORT vDialog; - - public: //---------------------------------------- public - - vColorLabelCmd(vCmdParent* dp, CommandObject* co); - - virtual ~vColorLabelCmd(); - - virtual void SetCmdVal(ItemVal val, ItemSetType st); - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - - int _canChange; - vColor _color; // color of this button - vColor* _origColor; // color of this button - - void initColor(void); - }; -#endif diff --git a/v/includew/v/vcmd.h b/v/includew/v/vcmd.h deleted file mode 100644 index 54f8cc5..0000000 --- a/v/includew/v/vcmd.h +++ /dev/null @@ -1,86 +0,0 @@ -//=============================================================== -// vcmd.h - Base class for Cmds - normally used on Dialogs - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VCMD_H -#define VCMD_H - -#include // basic definitons - - const int StdMargin = 4; // Margin to leave on controls - - class V_EXPORT vCmdParent; - class V_EXPORT vDialog; - - class V_EXPORT vCmd - { - - friend class V_EXPORT vCmdParent; - friend class V_EXPORT vDialog; - friend class V_EXPORT vCommandPane; - - public: //---------------------------------------- public - - vCmd(vCmdParent* dp, CommandObject* co); - - virtual ~vCmd() {} - - virtual void initialize(void) {} - - void CopyToLocal(void); - - // define these to interface with specific Pane's setters - - virtual int GetCmdValue(ItemVal iv) VCONST {return 0;} - - virtual void ResetItemValue(void) { dlgCmd->retVal = _origVal;} - - virtual void SaveItemValue(void) { _origVal = dlgCmd->retVal;} - - virtual void SetCmdVal(ItemVal val, ItemSetType st) {} - - virtual void SetCmdStr(VCONST char* s) {} - - virtual void CmdCallback(int id, WORD codeNotify); - - // for OWNERDRAW controls - - virtual int MEASUREITEM(int id, MEASUREITEMSTRUCT* mis) {return 0;} - - virtual int DRAWITEM(int id, DRAWITEMSTRUCT* dis) {return 0;} - - virtual HWND GetMyHwnd(ItemVal id) VCONST; - - protected: //--------------------------------------- protected - - int LabelWidth(VCONST char* lbl) VCONST; - - vCmdParent* _parentWin; // parent window of this object - VCONST char* _title; // current title - void* _itemList; - - CommandObject* dlgCmd; // pointer to the static definition - - int _Sensitive; - ItemVal _cmdId; // original id - ItemVal _origVal; // original value of object - ItemVal _retVal; // the value we are using - - HWND wParent; // parent widget used for this Cmd - HWND wCmd; // main widget for this Cmd - - int _x, _y, _h, _w; // size of the object - int _CtrlOffset; // Offset into dialog structure - - private: //--------------------------------------- private - - - }; -#endif diff --git a/v/includew/v/vcmdpane.h b/v/includew/v/vcmdpane.h deleted file mode 100644 index ea2fd12..0000000 --- a/v/includew/v/vcmdpane.h +++ /dev/null @@ -1,67 +0,0 @@ -//=============================================================== -// vcmdpane.h - Command Pane class .h file - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VCMDPANE_H -#define VCMDPANE_H - -#include - -#include // we are derived from a pane -#include // and from cmdParent - - class V_EXPORT vWindow; // we are part-of a vWindow - - class V_EXPORT vCommandPane : public vPane, public vCmdParent - { - friend vCommandPane* vGetLowestCmdPane(); - friend void vSetShownCmdPane(HWND MdiWindow, int OnOff); - friend class V_EXPORT vApp; - - public: //---------------------------------------- public - - vCommandPane(CommandObject* cList); - vCommandPane(vStatus* s_bar); // status bar version - virtual ~vCommandPane(); - - virtual void ProcessCmd(ItemVal id, ItemVal rv, CmdType ct); - virtual void initialize(vWindow* pWin, HWND mdiChildWin); - virtual void ShowPane(int OnOrOff) VCONST; - - // Windows utility - - int DynamicDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); - - protected: //--------------------------------------- protected - - virtual int GetPaneValue(ItemVal id, int& val) VCONST; - virtual int GetPaneTextIn(ItemVal id, char* val, int maxlen) VCONST; - virtual void SetPaneValue(ItemVal id, int val, ItemSetType setType); - virtual void SetPaneString(ItemVal id, VCONST char* str); - - - private: //--------------------------------------- private - - int OnInitDialog (HWND hwnd, HWND hwndFocus, LPARAM lParam); - void OnEnable (HWND hwnd, BOOL fEnable); - int OnPaint (HWND hwnd); - void OnCommand (HWND hwnd, int id, HWND hwndCtl, WORD codeNotify); - - CommandObject* _origList; // handle to list of commands - CommandObject* _cmdObj; // for translated status pane - int _cmdObjCount; - - HWND _associatedMdiWindow; - - VMUTABLE int _isDisplayed; // If vWindow thinks it is displayed - VMUTABLE int _isShown; // If it has been drawn - - }; -#endif diff --git a/v/includew/v/vcmdprnt.h b/v/includew/v/vcmdprnt.h deleted file mode 100644 index 5be7c48..0000000 --- a/v/includew/v/vcmdprnt.h +++ /dev/null @@ -1,86 +0,0 @@ -//=============================================================== -// vcmdpar.h - A parent class for Cmds -- Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== -// -// This class is used by vDialog and CmdPane classes to -// allow the vCmd objects to have access to the ProcessCmd - -#ifndef VCMDPAR_H -#define VCMDPAR_H - -#include -#include - -enum DialogType { aDialog, aCmdBar,aStatBar }; - - typedef struct DlgCmdList - { - vCmd* cmdP; // pointer to a command object - DlgCmdList* nextDCL; // next button - } DlgCmdList; - - class V_EXPORT vCmdParent - { - public: //---------------------------------------- public - - vCmdParent(PaneType pt = P_Dialog); - - virtual ~vCmdParent(); - - virtual void ProcessCmd(ItemVal id, ItemVal rv, CmdType ct) {} - - virtual int GetTextIn(ItemVal id, char* strout, int maxlen); - virtual int GetValue(ItemVal id) VCONST; - int HasId(ItemVal id) VCONST; - virtual void SetValue(ItemVal id, ItemVal val, ItemSetType setType); - virtual void SetString(ItemVal id, VCONST char* str); - virtual void SetFrameChildren(ItemVal frameId, int frameVal); - - PaneType paneType() { return _pt; } - - // These are platform dependent... - vCmd* getThisFromId(ItemVal find_id); - - void SetPosition(int& x, int& y, int w, int h, ItemVal frame = 0, - ItemVal rightOf = 0, ItemVal below = 0, int isSpinner = 0); - - int CreateDlgTemplate(LONG dtStyle,int dtX, int dtY, - int dtCX, int dtCY, LPSTR dtMenuName, LPSTR dtClassName, - LPSTR dtCaption, short int PointSize, LPSTR szTypeFace); - - int AddDlgControl (int dtilX, int dtilY, int dtilCX, int dtilCY, - int dtilID, long dtilStyle, LPSTR dtilClass, - LPCSTR dtilText,BYTE dtilInfo, LPBYTE dtilData); - - void DoneAddingControls(void); - - HWND getParent(void) VCONST; // to get parent widget - DialogType _dialogType; - HWND HwndDialog() { return _wDialog; } - - protected: //--------------------------------------- protected - - DlgCmdList* _cmdList; // list of command items for this dialog - - HWND _wDialog; // handle of dialog - HGLOBAL _hTemplate; // handle for template - int _callbackID; // index to callback array - int maxX, maxY; // for calculating size of dialog - int _windowH; // height of window - int _windowY; // where a command bar is actually drawn - - virtual vCmd* AddCmd(CommandObject* cmd); // Add a Cmd to the dialog - void FixFrame(int cxr, int cyb, int margin, vCmd* frameCmd); - - private: //--------------------------------------- private - PaneType _pt; - - }; -#endif diff --git a/v/includew/v/vcmdwin.h b/v/includew/v/vcmdwin.h deleted file mode 100644 index f053ece..0000000 --- a/v/includew/v/vcmdwin.h +++ /dev/null @@ -1,44 +0,0 @@ -//=============================================================== -// vcmdwin.h - vWin class definitions - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VCMDWIN_H -#define VCMDWIN_H - -#include // we are derived from vWindow class - - class V_EXPORT vCmdWindow : public vWindow - { - friend class V_EXPORT vMenuPane; - - public: //---------------------------------------- public - // the constructor - - vCmdWindow(VCONST char* name = "+", int width = 0, int height = 0); - - virtual ~vCmdWindow(); // Destructor - - int NumCmdWindows() VCONST { return _numCmdWindows; } - - // virtual methods - virtual void CloseWin(void); // callback for close button - - protected: //--------------------------------------- protected - vCmdWindow* GetCmdWinList() VCONST { return CmdWins; } - vCmdWindow* GetNextCmdWin() { return NextCmdWin; } - - private: //--------------------------------------- private - static int _numCmdWindows; // how many total cmd windows are up - int destroyed; // prevent multiple destruction - vCmdWindow* NextCmdWin; // link to next window - - static vCmdWindow* CmdWins; // list of all command windows - }; -#endif diff --git a/v/includew/v/vcolor.h b/v/includew/v/vcolor.h deleted file mode 100644 index cc50423..0000000 --- a/v/includew/v/vcolor.h +++ /dev/null @@ -1,117 +0,0 @@ -//=============================================================== -// vcolor.h: vColor class header for drawing - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VCOLOR_H -#define VCOLOR_H - -#include // V 1.15a - -// For use in Color buttons -const int M_Black = 32020; -const int M_Red = 32021; -const int M_DimRed = 32022; -const int M_Green = 32023; -const int M_DimGreen = 32024; -const int M_Blue = 32025; -const int M_DimBlue = 32026; -const int M_Yellow = 32027; -const int M_DimYellow = 32028; -const int M_Magenta = 32029; -const int M_DimMagenta = 32030; -const int M_Cyan = 32031; -const int M_DimCyan = 32032; -const int M_DarkGray = 32033; -const int M_MedGray = 32034; -const int M_White = 32035; -const int M_ColorFrame = 32036; - -// Index into array -const int vC_Black = 0; -const int vC_Red = 1; -const int vC_DimRed = 2; -const int vC_Green = 3; -const int vC_DimGreen = 4; -const int vC_Blue = 5; -const int vC_DimBlue = 6; -const int vC_Yellow = 7; -const int vC_DimYellow = 8; -const int vC_Magenta = 9; -const int vC_DimMagenta = 10; -const int vC_Cyan = 11; -const int vC_DimCyan = 12; -const int vC_DarkGray = 13; -const int vC_MedGray = 14; -const int vC_White = 15; - - class V_EXPORT vPen; - - class V_EXPORT vColor - { - friend class V_EXPORT vPen; - friend class V_EXPORT vBrush; - public: //---------------------------------------- public - vColor(unsigned int rd = 0, unsigned int gr = 0, unsigned int bl = 0); - ~vColor() {} - - // Default shallow copy constructor and assignment ok. -#ifdef OLD_NON_DLL_CODE - int operator == (const vColor& c2) - {return (_r == c2._r && _g == c2._g && _b == c2._b);} - int operator !=(const vColor& c2) - {return (_r != c2._r || _g != c2._g || _b != c2._b);} -#endif - void ResetColor(unsigned int rd = 0, unsigned int gr = 0, - unsigned int bl = 0); - void ResetColor(VCONST vColor& c); - void Set(unsigned int rd = 0, unsigned int gr = 0, unsigned int bl = 0); - void Set(VCONST vColor& c); - void SetR(unsigned int rd = 0); - void SetG(unsigned int gr = 0); - void SetB(unsigned int bl = 0); - int BitsOfColor() VCONST; - - unsigned int r() const { return (unsigned int) _r;} - unsigned int g() const { return (unsigned int) _g;} - unsigned int b() const { return (unsigned int) _b;} - - COLORREF pixel() VCONST { return _pixel; } - - protected: //--------------------------------------- protected - - unsigned char _r; - unsigned char _g; - unsigned char _b; - unsigned char _padtoevenbyte; - - private: //--------------------------------------- private - COLORREF _pixel; - - }; -#ifdef OLD_NON_DLL_CODE - extern vColor vStdColors[16]; - extern char* vColorNames[16]; -#endif -// global variables vStdColors and vColorNames are replaced by these -// two functionsn DLL version 1.21 -// -V_EXPORT vColor* vGetStdColors(); -V_EXPORT char** vGetColorNames(); - -// Global variable name were replaced by function calls. -// -#define vStdColors (vGetStdColors()) -#define vColorNames (vGetColorNames()) - inline int operator == (const vColor& x, const vColor& y) - {return (x.r() == y.r() && x.g() == y.g() && x.b() == y.b());} - - inline int operator != (const vColor& x, const vColor& y) - {return !(x == y);} -#endif diff --git a/v/includew/v/vcomboc.h b/v/includew/v/vcomboc.h deleted file mode 100644 index 862ab4d..0000000 --- a/v/includew/v/vcomboc.h +++ /dev/null @@ -1,47 +0,0 @@ -//=============================================================== -// vcomboc.h - ComboBox - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VCOMBOC_H -#define VCOMOBC_H - -#include // We are derived from vcmd - - const int MAX_COMBO_LIST = 32; // put 8 items in the list - - class V_EXPORT vCmdParent; - - class V_EXPORT vComboBoxCmd : public vCmd - { - - public: //---------------------------------------- public - - vComboBoxCmd(vCmdParent* dp, CommandObject* dc); - - virtual ~vComboBoxCmd(); - - virtual int GetCmdValue(ItemVal id) VCONST; - virtual void SetCmdVal(ItemVal val, ItemSetType st); - - protected: //--------------------------------------- protected - - - private: //--------------------------------------- private - - char** _fullList; // alias pointer to full list - int _maxWidth; // max width of any item - int _numItems; // number of items on list - int _curSelection; // index of current selected item - - void SetupComboList(void); - - virtual void CmdCallback(int id, WORD codeNotify); - }; -#endif diff --git a/v/includew/v/vcpdc.h b/v/includew/v/vcpdc.h deleted file mode 100644 index c9ee869..0000000 --- a/v/includew/v/vcpdc.h +++ /dev/null @@ -1,57 +0,0 @@ -//=============================================================== -// vcpdc.h: CanvasPaneDC class .h file - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VCPDC_H -#define VCPDC_H - -#include - - - class V_EXPORT vWindow; // we are part of a window - class V_EXPORT vCanvasPane; - class V_EXPORT vIcon; - - class V_EXPORT vCanvasPaneDC : public vWinDC - { - - public: //---------------------------------------- public - - vCanvasPaneDC(vCanvasPane* parentPane); - - virtual ~vCanvasPaneDC(); - - // Drawing - - virtual void Clear(void); - virtual void ClearRect(int left, int top, int width, int height); - virtual void SetBackground(VCONST vColor& color); - virtual void SetFont(VCONST vFont& vf); - - protected: //--------------------------------------- protected - - // These methods are to be used only internally and are assumed to - // be used correctly - there is no error checking. The idea is to have - // the canvas use BeginPaint/EndPaint for Redraw, and the drawing - // rotuines to use GetHDC and ReleaseHDC. - - virtual void GetHDC() VCONST { if (_hdcPaint != 0) _hdc = _hdcPaint; - else {::HideCaret(_drawWidget); _hdc = ::GetDC(_drawWidget);} } - virtual void BeginPaint() {_hdcPaint = ::BeginPaint(_drawWidget, &_ps);} - virtual void EndPaint() { ::EndPaint(_drawWidget, &_ps); _hdcPaint = 0;} - virtual void ReleaseHDC() VCONST { if (_hdc != _hdcPaint) - {::ShowCaret(_drawWidget); ::ReleaseDC(_drawWidget, _hdc);}} - - private: //--------------------------------------- private - - vCanvasPane* _parentPane; - HWND _drawWidget; - }; -#endif diff --git a/v/includew/v/vdc.h b/v/includew/v/vdc.h deleted file mode 100644 index 512e4f2..0000000 --- a/v/includew/v/vdc.h +++ /dev/null @@ -1,148 +0,0 @@ -//=============================================================== -// vdc.h: vDC class .h file - Windows -// -// Copyright (C) 1995-1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VDC_H -#define VDC_H - -#include // Basic defs -#include // for fonts -#include // for our pen -#include // for our brush -#include - - class V_EXPORT vIcon; - class V_EXPORT vColor; - - typedef unsigned char ChrAttr; // An attribute for a display char - typedef unsigned char Chr; // A character to display - - typedef struct dChar // A display Char - { - ChrAttr attr; // The attribute of this char - Chr chr; // the character - } dChar; - -const ChrAttr ChNormal = 0; -const ChrAttr ChReverse = 0x01; // True Reverse -const ChrAttr ChHighlight = 0x02; // Contrasting highlight -const ChrAttr ChBlackOnBG = 0x04; // Black on background color -const ChrAttr ChWhiteOnBG = 0x08; // White on background color -const ChrAttr ChDimColor = 0x80; // dim color (half intensity) -const ChrAttr ChRed = 0x40; // various colors -const ChrAttr ChGreen = 0x20; -const ChrAttr ChBlue = 0x10; -const ChrAttr ChYellow = 0x60; -const ChrAttr ChMagenta = 0x50; -const ChrAttr ChCyan = 0x30; -const ChrAttr ChGray = 0xF0; -const ChrAttr ChWhite = 0x70; - - class V_EXPORT vMemoryDC; - - class V_EXPORT vDC - { - friend class V_EXPORT vWinDC; - public: //---------------------------------------- public - vDC(void) { _Mult = 1; _Div = 1; _hasScale = 0; _tx = 0 ; _ty = 0; - _physHeight = _physWidth = 0;} - - virtual ~vDC(void) {} - - // Drawing - virtual void Clear(void) = 0; - virtual void ClearRect(int left, int top, int width, int height) = 0; - virtual void CopyFromMemoryDC(vMemoryDC* vmemdc, int destX, int destY, - int srcX = 0, int srcY = 0, int srcW = 0, int srcH = 0) // V:1.13 - {} - -#ifdef DRAWARC - virtual void DrawArc(int xx1, int yy1, int xx2, int yy2, int xxc, int yyc) = 0; -#endif - virtual void DrawAttrText(int x, int y, VCONST char* text, const ChrAttr attr) = 0; - virtual void DrawText(int x, int y, VCONST char* text) = 0; - virtual void DrawEllipse(int x, int y, int width, int height) = 0; - virtual void DrawIcon(int x, int y, VCONST vIcon& icon) {}; - virtual void DrawLine(int x, int y, int xend , int yend) = 0; - virtual void DrawLines(vLine* lineList, int count) = 0; - virtual void DrawLines(vPoint* lineList, int n) = 0; - virtual void DrawColorPoints(int x, int y, int nPoints, vColor* pointList) {} - - virtual void DrawPoint (int x, int y) = 0; - virtual void DrawPoints (vPoint* pointList, int count) = 0; - virtual void DrawPolygon (int n, vPoint points[], - int fillStyle = vAlternate) = 0; - virtual void DrawRoundedRectangle(int x, int y, - int width, int height, int radius = 10) = 0; - virtual void DrawRectangle(int x, int y, int width, int height) = 0; - virtual void DrawRectangles(vRect* rectList, int count) = 0; - - // Not all DrawingCanvases need Rubber Lines! - virtual void DrawRubberLine(int x, int y, int xend, int yend) {} - virtual void DrawRubberEllipse(int x, int y, int width, int height) {} - virtual void DrawRubberPoint(int x, int y) {} - virtual void DrawRubberRectangle(int x, int y, int width, int height) {} - - // Printer - virtual int BeginPrinting() {return 0;} - virtual void EndPrinting() {} - virtual void BeginPage() {} - virtual void EndPage() {} - // virtual void SetPrinter(vPrinter& printer){} - - // Misc - - virtual int GetPhysHeight() VCONST { return _physHeight; } - virtual int GetPhysWidth() VCONST { return _physWidth; } - - virtual void SetBackground(VCONST vColor& color) {} - virtual void SetScale(int mult, int div) - {_Mult = mult ; _Div = div ; _hasScale = (_Mult != 1 || _Div != 1); } - virtual void GetScale(int& m, int& d) VCONST {m = _Mult; d=_Div;} - - void SetTranslate(int x, int y) { _tx = x; _ty = y; } - void SetTransX(int x) {_tx = x;} - void SetTransY(int y) {_ty = y;} - void GetTranslate(int& x, int& y) {x = _tx; y = _ty;} - int GetTransX() VCONST { return _tx; } - int GetTransY() VCONST { return _ty; } - - virtual void SetFont( VCONST vFont& vf) {} - virtual vFont GetFont() VCONST { return _font; } // Get text font id - - virtual void SetPen(VCONST vPen& pen) {} - virtual vPen GetPen() VCONST { return _pen; } - - virtual void SetBrush(VCONST vBrush& brush) {} - virtual vBrush GetBrush() VCONST { return _brush; } - - virtual int TextHeight(int& asc, int& des) VCONST {return 0;} - virtual int TextWidth(VCONST char* str) VCONST {return 0;} - - protected: //--------------------------------------- protected - - int _Mult; // scaling factors - int _Div; - int _tx; // translation - int _ty; - int _hasScale; // if have scale - int _physHeight; // maximum height of canvas - int _physWidth; // max width of canvas - - vBrush _brush; // the painting brush - VMUTABLE vFont _font; // the current font - vPen _pen; // the drawing pen - - virtual int Scale(int x) { return (_hasScale) ? ((x*_Mult)/_Div) : x; } - - private: //--------------------------------------- private - - }; -#endif diff --git a/v/includew/v/vdebug.h b/v/includew/v/vdebug.h deleted file mode 100644 index e9e527a..0000000 --- a/v/includew/v/vdebug.h +++ /dev/null @@ -1,32 +0,0 @@ -//=============================================================== -// vdebug.h - set up debug -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VDEBUG_H -#define VDEBUG_H - -#include - - class V_EXPORT vDebugDialog : public vModalDialog - { - public: //---------------------------------------- public - vDebugDialog(vBaseWindow* bw,char* title = "Debugging Options") : vModalDialog(bw,title) {}; - - ~vDebugDialog() {}; - - void SetDebug(); - - virtual void DialogCommand(ItemVal id, ItemVal val, CmdType ctype); - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - }; -#endif diff --git a/v/includew/v/vdialog.h b/v/includew/v/vdialog.h deleted file mode 100644 index 8868418..0000000 --- a/v/includew/v/vdialog.h +++ /dev/null @@ -1,87 +0,0 @@ -//=============================================================== -// vdialog.h - general purpose dialog class - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VDIALOG_H -#define VDIALOG_H -#include // We inherit form vBaseWindow -#include // We also inherit from vCmdParent - - class V_EXPORT vCmd; // Dialogs have Cmds - class V_EXPORT vApp; - - class V_EXPORT vDialog : public vBaseWindow, public vCmdParent - { - friend int vChkWinDlgMsgs(MSG *msg); - public: //---------------------------------------- public - - // One constructor for windows, one for the app - - vDialog(VCONST vBaseWindow* creator, int modal = 0, - VCONST char* title = ""); - vDialog(VCONST vApp* creator, int modal = 0, VCONST char* title = ""); - vDialog(const vDialog&); // Copy constructor - ~vDialog(); - - virtual void AddDialogCmds(CommandObject* cList); // Add a list of Cmds - virtual void AddDialogCmdObj(CommandObject* Cmd, vCmd* CmdInstance); - virtual void CancelDialog(void); // Cancel selected - virtual void CloseDialog(void); // Close dialog - virtual void SetDialogTitle(VCONST char * title); - void GetDialogPosition(int& left, int& top, int& width, - int& height) VCONST; - void SetDialogPosition(int left, int top); - - // Dialog action selected - virtual void DialogCommand(ItemVal id, ItemVal retval, CmdType ctype); - - virtual void DialogDisplayed(); - - int IsDisplayed(void) VCONST { return _IsDisplayed; } // If displayed or not - virtual void ShowDialog(VCONST char* msg); // called to invoke dialog - - // Windows utility - - int DynamicDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); - - - // functions from vCmdParent to override - - virtual void ProcessCmd(ItemVal id, ItemVal rv, CmdType ct); - - - protected: //--------------------------------------- protected - - void init(int modal, VCONST char* title); - - int _IsDisplayed; // if popped up or not - - virtual void showBaseWindow(void) { }; // no-op for dialog - HWND winHwnd() VCONST { return _parentHWND; } - HWND myHwnd() VCONST { return _myHWND; } // V:1.13 - - // V:1.13 - vDialog* _oldModal; // pointer of previous Modal this - static vDialog* _curModal; // this of current modal - - - private: //--------------------------------------- private - - HWND _parentHWND; - HWND _myHWND; // V:1.13 - - HWND hwndToolTip; // handle to my tip hwnd - - int _modal; // if modal or modeless - - vCmd* _DefaultButton; // for easy Warp to default button - vCmd* _FirstTextIn; // for SetKeyBoardFocus - }; -#endif diff --git a/v/includew/v/vdll.h b/v/includew/v/vdll.h deleted file mode 100644 index 61494da..0000000 --- a/v/includew/v/vdll.h +++ /dev/null @@ -1,25 +0,0 @@ -//=============================================================== -// vdll.h - This file has differences needed for dll/nondll versions -// -// Copyright (C) 1995-2000 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== -#ifndef VDLL_H -#define VDLL_H -//#define BUILD_V_DLL -// These definitions contributed by Franco Bez V 1.24 -#if defined (BUILD_V_DLL) -# define V_EXPORT __declspec(dllexport) -# else -# if defined (USE_V_DLL) -# define V_EXPORT __declspec(dllimport) -# else -# define V_EXPORT -# endif -#endif - -#endif diff --git a/v/includew/v/vfilesel.h b/v/includew/v/vfilesel.h deleted file mode 100644 index 6eb98d3..0000000 --- a/v/includew/v/vfilesel.h +++ /dev/null @@ -1,52 +0,0 @@ -//=============================================================== -// vfilesel.h - reply modal dialog - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VFILESEL_H -#define VFILESEL_H -#include -#include - - - class V_EXPORT vApp; - class V_EXPORT vBaseWindow; - - class V_EXPORT vFileSelect - { - public: //---------------------------------------- public - vFileSelect(vBaseWindow* bw, VCONST char* title = "File Select"); - - vFileSelect(vApp* aw, VCONST char* title = "File Select"); - ~vFileSelect() {} - - int FileSelect(const char* msg, char* filename, - const int maxlen, char** filter, int& filterIndex, - const char* initDir = 0); - int FileSelectSave(const char* msg, char* filename, - const int maxlen, char** filter, int& filterIndex, - const int findDir = 0, const char* initDir = 0); - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - - HWND _parentHWND; - - OPENFILENAME ofn; // Windows struct - - void init(); - - void buildFilter(char* fbuff, char** filter, int& fi); - - void strcatEOS(char* to, VCONST char *from); - - - }; -#endif diff --git a/v/includew/v/vfinddlg.h b/v/includew/v/vfinddlg.h deleted file mode 100644 index 8345c4d..0000000 --- a/v/includew/v/vfinddlg.h +++ /dev/null @@ -1,43 +0,0 @@ -//=============================================================== -// vFind.h - reply modal dialog - common Win/X -// -// Copyright (C) 1995-1999 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef vFind_H -#define vFind_H -#include - -#ifndef V_EXPORT -#define V_EXPORT -#endif - - class V_EXPORT vApp; - class V_EXPORT vFindDialog : protected vModalDialog - { - public: //---------------------------------------- public - vFindDialog(vBaseWindow* bw, VCONST char* title = "Find") : - vModalDialog(bw, title) - { added = 0;} - vFindDialog(vApp *aw, VCONST char* title = "Find") : - vModalDialog(aw, title) - { added = 0;} - ~vFindDialog() {} - - int AskFindPat(char* reply, const int maxlen, int& caseSens, - int& Down, int& Wrap); - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - - int added; - virtual void DialogCommand(ItemVal id, ItemVal val, CmdType ctype); - - }; -#endif diff --git a/v/includew/v/vfont.h b/v/includew/v/vfont.h deleted file mode 100644 index b32d711..0000000 --- a/v/includew/v/vfont.h +++ /dev/null @@ -1,111 +0,0 @@ -//=============================================================== -// vfont.h - The font class - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VFONT_H -#define VFONT_H - -#include -#include // For CHOOSEFONT - - class V_EXPORT vCanvasPane; // the vCanvasPane needs to the the X font - class V_EXPORT vApp; // the vApp needs Xfont, too - class V_EXPORT vListCmd; - class V_EXPORT vComboBoxCmd; - - enum vFontID // various font related ids - { - vfDefaultSystem, // system default (fixed for Windows) - vfDefaultFixed, // the system default fixed font - vfDefaultVariable, // the system default variable font - vfSerif, // serifed font - TimesRoman - vfSansSerif, // SansSerif - Swiss or Helvetica - vfFixed, // fixed font - Courier - vfDecorative, // decorative - dingbat - vfOtherFont, // for all other fonts - vfNormal, // normal style, weight - vfBold, // boldface - vfItalic, // italic style - vfEndOfList - }; - - - class V_EXPORT vFont // make the font stuff a class to make it portable - { - friend class V_EXPORT vCanvasPane; - friend class V_EXPORT vApp; - - public: //---------------------------------------- public - vFont(vFontID fam = vfDefaultFixed, int size = 10, - vFontID sty = vfNormal, vFontID wt = vfNormal, - int und = 0, int ang = 0); - - vFont(const vFont &ft); // copy constructor - - ~vFont(); - - vFont& operator =(const vFont& ft); // vFont = vFont - int operator ==(const vFont& ft) VCONST - { return (_family == ft._family && _style == ft._style && - _weight == ft._weight && _pointSize == ft._pointSize && - _underlined == ft._underlined && _angle == ft._angle); } - - int operator !=(const vFont& ft) VCONST - { return !(_family == ft._family && _style == ft._style && - _weight == ft._weight && _pointSize == ft._pointSize && - _underlined == ft._underlined && _angle == ft._angle); } - - - vFontID GetFamily() VCONST { return _family; } - - int GetPointSize() VCONST { return _pointSize; } - - vFontID GetStyle() VCONST { return _style; } - - vFontID GetWeight() VCONST { return _weight; } - - int GetUnderlined() VCONST { return _underlined; } - - int GetAngle() VCONST { return _angle; } - - - void SetFontValues(vFontID fam = vfDefaultFixed, int size = 10, - vFontID sty = vfNormal, vFontID wt = vfNormal, int und = 0); - - void GetNativeFontString(char* fontStr); - void SetNativeFontString(char* fontStr); - void SetWinFontValues(VCONST LOGFONT& lf, int pt, DWORD rgb); - - void LoadFont(HDC dc, int isPrinterDC); // make sure font with given id is loaded - - HFONT GetHFONT() VCONST { return _hFont; } - LOGFONT GetLOGFONT() VCONST { return _lf; } - COLORREF GetFontColor() VCONST { return _fontColor; } - - protected: //--------------------------------------- protected - char* getSubstring(char* str, char* substr); - - private: //--------------------------------------- private - vFontID _family; // family - vfSerif, etc. - vFontID _style; // style - nomal, italic, slant - vFontID _weight; // weight - normal, light, bold - int _pointSize; // point size of font - int _underlined; // if underlined or not - int _angle; // angle to print at - - int _isStockFont; // if a stock font - - COLORREF _fontColor; - - HFONT _hFont; // windows handle to font - LOGFONT _lf; // Window full font inf - }; - -#endif diff --git a/v/includew/v/vfontsel.h b/v/includew/v/vfontsel.h deleted file mode 100644 index a6fe1db..0000000 --- a/v/includew/v/vfontsel.h +++ /dev/null @@ -1,42 +0,0 @@ -//=============================================================== -// vfontsel.h - font select modal dialog - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VSELFONT_H -#define VSELFONT_H -#include -#include -#include - - - class V_EXPORT vApp; - class V_EXPORT vBaseWindow; - - class V_EXPORT vFontSelect - { - public: //---------------------------------------- public - vFontSelect(vBaseWindow* bw, VCONST char* title = "Select Font"); - vFontSelect(vApp* aw, VCONST char* title = "Select Font"); - ~vFontSelect() {} - - int FontSelect(vFont& font, const char* msg = "Select Font", - int fixedOnly = 0 ); - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - HWND _parentHWND; - CHOOSEFONT _cf; - LOGFONT _lf; - - void init(); - - }; -#endif diff --git a/v/includew/v/vframec.h b/v/includew/v/vframec.h deleted file mode 100644 index 2ff7b18..0000000 --- a/v/includew/v/vframec.h +++ /dev/null @@ -1,41 +0,0 @@ -//=============================================================== -// vframec.h - Frame Command class - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VFRAMEC_H -#define VFRAMEC_H - -#include // We are derived from vcmd - - class V_EXPORT vCmdParent; - - class V_EXPORT vFrameCmd : public vCmd - { - - public: //---------------------------------------- public - - vFrameCmd(vCmdParent* dp, CommandObject* co); - - virtual ~vFrameCmd(); - - virtual void initialize(void); - virtual void SetCmdVal(ItemVal val, ItemSetType st); - - virtual void CmdCallback(int id, WORD codeNotify); - - virtual int MEASUREITEM(int id, MEASUREITEMSTRUCT* mis); - virtual int DRAWITEM(int id, DRAWITEMSTRUCT* dis); - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - - }; -#endif diff --git a/v/includew/v/vicon.h b/v/includew/v/vicon.h deleted file mode 100644 index e1b98a4..0000000 --- a/v/includew/v/vicon.h +++ /dev/null @@ -1,53 +0,0 @@ -//=============================================================== -// vicon.h - Icon class - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== -#ifndef VICON_H -#define VICON_H -#include -#include - - - enum IconType {Normal, Transparent}; // types of icons - - class V_EXPORT vIcon // an icon - { - //friend class vWinDC; - //friend class vLabelCmd; - //friend class vButtonCmd; - - public: //---------------------------------------- public - vIcon(); - vIcon(unsigned char* ic, int h, int w, int d = 1, IconType it = Normal); - ~vIcon(); - IconType iType; // type of icon - int height; // height in pixels - int width; // width in pixels - int depth; // bits per pixel - unsigned char* icon; // ptr to icon array - - HBITMAP GetIconHBM(HDC iDC) VCONST - { - if (_hbm == 0) vIconToBMP(iDC); return _hbm; - } - HBITMAP GetIconMask(HDC iDC) VCONST - { - if ( _hmsk == 0 && depth > 1 ) vIconToBMP(iDC); - return _hmsk; - } - - protected: //--------------------------------------- protected - private: //--------------------------------------- private - - int NeedBMPBytes() VCONST; - void vIconToBMP(HDC iDC) VCONST; - - VMUTABLE HBITMAP _hbm, _hmsk; - }; -#endif diff --git a/v/includew/v/vkeys.h b/v/includew/v/vkeys.h deleted file mode 100644 index e8b7b3c..0000000 --- a/v/includew/v/vkeys.h +++ /dev/null @@ -1,92 +0,0 @@ -//=============================================================== -// vkeys.h - Defintions for V keys - Windows -// -// Copyright (C) 1995 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VKEYS_H -#define VKEYS_H - - // Masks for various shift modes - -#define VKM_Shift 1 -#define VKM_Ctrl 4 -#define VKM_Alt 8 - -#define vk_IsModifier(x) (0) // Windows doesn't give keycodes for modifiers -#define vk_None 0x0 /* no key */ - -#define vk_BackSpace 0x08 -#define vk_Tab 0x09 -#define vk_Linefeed 0x0A -#define vk_Return 0x0D -#define vk_Pause 0x13 -#define vk_Escape 0x1B -#define vk_Delete 0x7F - -#define vk_BackTab 0xFF09 - -#define vk_Home 0xFF50 -#define vk_Left 0xFF51 -#define vk_Up 0xFF52 -#define vk_Right 0xFF53 -#define vk_Down 0xFF54 -#define vk_Page_Up 0xFF55 -#define vk_Page_Down 0xFF56 -#define vk_End 0xFF57 -#define vk_Insert 0xFF58 - -#define vk_KP_Enter 0xFF0D -#define vk_KP_Home 0xFF95 -#define vk_KP_Left 0xFF96 -#define vk_KP_Up 0xFF97 -#define vk_KP_Right 0xFF98 -#define vk_KP_Down 0xFF99 -#define vk_KP_Page_Up 0xFF9A -#define vk_KP_Page_Down 0xFF9B -#define vk_KP_End 0xFF9C -#define vk_KP_Insert 0xFF9E -#define vk_KP_Delete 0xFF7F -#define vk_KP_Equal 0xFF3D -#define vk_KP_Multiply 0xFF2A -#define vk_KP_Add 0xFF2B -#define vk_KP_Subtract 0xFF2D -#define vk_KP_Decimal 0xFF2E -#define vk_KP_Divide 0xFF2F - -#define vk_KP_0 0xFF30 -#define vk_KP_1 0xFF31 -#define vk_KP_2 0xFF32 -#define vk_KP_3 0xFF33 -#define vk_KP_4 0xFF34 -#define vk_KP_5 0xFF35 -#define vk_KP_6 0xFF36 -#define vk_KP_7 0xFF37 -#define vk_KP_8 0xFF38 -#define vk_KP_9 0xFF39 - -#define vk_F1 0xFFC1 -#define vk_F2 0xFFC2 -#define vk_F3 0xFFC3 -#define vk_F4 0xFFC4 -#define vk_F5 0xFFC5 -#define vk_F6 0xFFC6 -#define vk_F7 0xFFC7 -#define vk_F8 0xFFC8 -#define vk_F9 0xFFC9 -#define vk_F10 0xFFCA -#define vk_F11 0xFFCB -#define vk_F12 0xFFCC -#define vk_F13 0xFFCD -#define vk_F14 0xFFCE -#define vk_F15 0xFFCF -#define vk_F16 0xFFD0 - -#define vk_space 0x020 -#define vk_asciitilde 0x07e -#endif diff --git a/v/includew/v/vlabelc.h b/v/includew/v/vlabelc.h deleted file mode 100644 index 8dcd04d..0000000 --- a/v/includew/v/vlabelc.h +++ /dev/null @@ -1,45 +0,0 @@ -//=============================================================== -// vlablec.h - Lable Command Class - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VLABELC_H -#define VLABELC_H - -#include -#include // We are derived from vcmd - - class V_EXPORT vCmdParent; - class V_EXPORT vIcon; - - class V_EXPORT vLabelCmd : public vCmd - { - - public: //---------------------------------------- public - - vLabelCmd(vCmdParent* dp, CommandObject* co); - - virtual ~vLabelCmd(); - - virtual void initialize(void); - - virtual void SetCmdStr(VCONST char* str); - virtual void SetCmdVal(ItemVal val, ItemSetType st); - virtual void CmdCallback(int id, WORD codeNotify); - - virtual int MEASUREITEM(int id, MEASUREITEMSTRUCT* mis); - virtual int DRAWITEM(int id, DRAWITEMSTRUCT* dis); - - protected: //--------------------------------------- protected - void initIcon(void); - private: //--------------------------------------- private - vIcon* _ip; - - }; -#endif diff --git a/v/includew/v/vlayoutp.h b/v/includew/v/vlayoutp.h deleted file mode 100644 index 7e10f39..0000000 --- a/v/includew/v/vlayoutp.h +++ /dev/null @@ -1,83 +0,0 @@ -//=============================================================== -// vlayoutp.h - Layout Pane C++ class .h file - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VLAYOUTP_H -#define VLAYOUTP_H - -#include // Basic defs -#include // we are derived from vPane - - class vWindow; // we are part of a window - - class vLayoutPane : public vPane - { - friend vWindow; - public: //---------------------------------------- public - - vLayoutPane(PaneType pt = P_Canvas); - - virtual ~vLayoutPane(); - - virtual void ShowPane(int OnOrOff); - - void SetWidthHeight(int width, int height); - - - // Events - virtual void MouseDown(int x, int y, int button) {} // Mouse Down at x,y - virtual void MouseUp(int x, int y, int button) {} // Mouse Up at x,y - virtual void MouseMove(int x, int y, int button) {} // Mouse Moved to x,y - virtual void MouseMotion(int x, int y) {} // No Button Mouse Move - - virtual void EnterFocus(void); - virtual void LeaveFocus(void); - - // Expose/redraw event - virtual void Redraw(int x, int y, int width , int height); - virtual void Resize(int newW, int newH); // Resize event - - // Information - virtual int GetWidth() { return _width; } // Get width of canvas - virtual int GetHeight() { return _height; } // Get Height of canvas - - // Appearance - - // Platform dependent - - - protected: //--------------------------------------- protected - - virtual void EnterEV(void); - virtual void LeaveEV(void); - - virtual void initialize(vWindow* pWindow, HWND pWidget); - - int _height; // height of draw window - int _width; // width of draw window - - HWND _drawWindow; // window for drawing - - int _hasFocus; // for focus workaround - - private: //--------------------------------------- private - - // Widgets for the canvas - - - static VCursor _currentCursor; // for cursor - - void HScrollEV(int code, int pos, HWND control) {} - void VScrollEV(int code, int pos, HWND control) {} - - void ResizeEV(int w, int h); - void ExposeEV(void); - }; -#endif diff --git a/v/includew/v/vlistc.h b/v/includew/v/vlistc.h deleted file mode 100644 index 25ce9fe..0000000 --- a/v/includew/v/vlistc.h +++ /dev/null @@ -1,46 +0,0 @@ -//=============================================================== -// vlistc.h - List Command class - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VLISTC_H -#define VLISTC_H - -#include // We are derived from vcmd - - class V_EXPORT vCmdParent; - - class V_EXPORT vListCmd : public vCmd - { - - public: //---------------------------------------- public - - vListCmd(vCmdParent* dp, CommandObject* co); - - virtual ~vListCmd(); - - virtual int GetCmdValue(ItemVal id) VCONST; - virtual void SetCmdVal(ItemVal val, ItemSetType st); - - protected: //--------------------------------------- protected - - - private: //--------------------------------------- private - - virtual void CmdCallback(int id, WORD codeNotify); - - char** _fullList; // alias pointer to full list - int _maxWidth; // max width of any item - int _numItems; // number of items on list - int _curSelection; // index of current selected item - int _listRows; // how many rows to display - - void SetupList(void); - }; -#endif diff --git a/v/includew/v/vmemdc.h b/v/includew/v/vmemdc.h deleted file mode 100644 index 21086a1..0000000 --- a/v/includew/v/vmemdc.h +++ /dev/null @@ -1,46 +0,0 @@ -//=============================================================== -// vcpdc.h: MemoryDC class .h file - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VMEMDC_H -#define VMEMDC_H - -#include - - class V_EXPORT vMemory; - - class V_EXPORT vMemoryDC : public vWinDC - { - - public: //---------------------------------------- public - - vMemoryDC(int width = 256, int height = 256); - - virtual ~vMemoryDC(); - - virtual void Clear(void); - virtual void ClearRect(int left, int top, int width, int height); - virtual void SetBackground(VCONST vColor& color); - virtual void SetFont(VCONST vFont& vf); - - virtual void GetHDC() VCONST; - virtual void ReleaseHDC() VCONST; - - int CreatedOK() VCONST {return _memBM != 0;} - - protected: //--------------------------------------- protected - - - private: //--------------------------------------- private - - VMUTABLE HBITMAP _memBM; - VMUTABLE HBITMAP _oldBM; - }; -#endif diff --git a/v/includew/v/vmenu.h b/v/includew/v/vmenu.h deleted file mode 100644 index 90ddf31..0000000 --- a/v/includew/v/vmenu.h +++ /dev/null @@ -1,100 +0,0 @@ -//=============================================================== -// vmenu.h - vmenu class definitions - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VMENU_H -#define VMENU_H - -#include -#include // we are derived from a pane - -// The _menuButton array will point to static arrays of menus. -// The user will allocate these, e.g.: -// -// vMenu EditMenu[] = -// { -// {"Item 1", MENU_1, isSens, notChk, noKeyLbl, noKey, noSub}, -// {"Item 2", MENU_2, isSens, notChk, noKeyLbl, noKey, noSub}, -// {NULL} -// }; -// -// and to define the menu bar -// -// vMenu myMenu[] = -// { -// {"Edit", M_File, isSens, notChk, noKeyLbl, noKey, &EditMenu[0]}, -// {NULL} -// }; -// -// the _menuButton will be done dynamically. The call back -// will pass the value of an item to a given window. - - typedef struct MenuInfo // Implementation dependent stuff - { - int ItemIndex; - int SubMenuIndex; - MenuInfo* NxtInfo; - } MenuInfo; - - typedef struct MenuButton - { - VCONST char* label; // Label for button - vMenu* SubMenu; // the menu items associated with this button - MenuInfo* mInfo; // dynamically allocated info list - - // System dependent handles - HMENU hPullDown; // handle for the pulldown - - } MenuButton; - - const int MAX_MENU_BUTTONS = 80; // Up to 20 menu buttons + submenus - // per window - - class V_EXPORT vWindow; - class V_EXPORT vCmdWindow; // we are part of a vCmdWindow - - class V_EXPORT vMenuPane : public vPane - { - friend class V_EXPORT vWindow; - friend class V_EXPORT vCmdWindow; - - public: //---------------------------------------- public - // the constructors - vMenuPane(VCONST vMenu* menu); - vMenuPane(const vMenuPane& m); // Copy constructor - virtual ~vMenuPane(); // Destructor - - - // non-virtual methods - - void initialize(vWindow* pWin, HWND hMenu); - void fixLabel(VCONST char* lbl, VCONST char* key) VCONST; - int CheckAccel(vKey vkey, unsigned int shift, ItemVal& id) VCONST; - - protected: //--------------------------------------- protected - - virtual int GetPaneValue(ItemVal id, int& val) VCONST; - virtual void SetPaneValue(ItemVal id, int val, ItemSetType setType); - - virtual void SetPaneString(ItemVal id, VCONST char* str); // set menu item label - - private: //--------------------------------------- private - // data - - int _nextMenuButton; - int _nextSubMenu; - MenuButton _mb[MAX_MENU_BUTTONS]; // Up to 10 menu items per window - HMENU _topLevelMenu; - - // methods - void doAddMenu(int id, HMENU parent); // build the menu - }; - -#endif diff --git a/v/includew/v/vmodald.h b/v/includew/v/vmodald.h deleted file mode 100644 index 1e35491..0000000 --- a/v/includew/v/vmodald.h +++ /dev/null @@ -1,44 +0,0 @@ -//=============================================================== -// vmodald.h - general purpose modal dialog class - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VMODALD_H -#define VMODALD_H - -#include // derived from vDialog - - class V_EXPORT vApp; - - class V_EXPORT vModalDialog : public vDialog - { - public: //---------------------------------------- public - - vModalDialog(VCONST vBaseWindow* creator, VCONST char* title = ""); - vModalDialog(VCONST vApp* creator, VCONST char* title = ""); - virtual ~vModalDialog(); - - virtual void CloseDialog(void); - - // called when command entered - virtual void DialogCommand(ItemVal id, ItemVal retval, CmdType ctype); - - virtual ItemVal ShowModalDialog(VCONST char* msg, ItemVal& retval); - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - - ItemVal _mdItemVal; - ItemVal _mdItemID; - CmdType _mdCmdType; - char* _mdStrVal; - - }; -#endif diff --git a/v/includew/v/vnlprntr.h b/v/includew/v/vnlprntr.h deleted file mode 100644 index d64c4a4..0000000 --- a/v/includew/v/vnlprntr.h +++ /dev/null @@ -1,78 +0,0 @@ -//=============================================================== -// vnlprntr.h: null Printer class .h file - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VNLPRNTR_H -#define VNLPRNTR_H - -#define vPaperLetter 0 -#define vPaperLegal 1 -#define vPaperTabloid 2 -#define vPaperLedger 3 -#define vPaperStatement 4 -#define vPaperExecutive 5 -#define vPaperA3 6 -#define vPaperA4 7 -#define vPaperA5 8 -#define vPaperB4 9 -#define vPaperB5 10 -#define vPaperFolio 11 -#define vPaperQuarto 12 -#define vPaper10x14 13 - -#define vPaperDefault vPaperLetter // Index to default paper -#include - - class V_EXPORT vNullPrinter - { -// class ofstream; - public: //---------------------------------------- public - vNullPrinter(){} - ~vNullPrinter(){} - - ofstream* OpenPrinter() VCONST {return 0;} - void ClosePrinter() {} - - int GetHeight() VCONST {return _height;} - int GetWidth() VCONST {return _width;} - - VCONST char* GetDocName() VCONST {return 0;} - - int GetPortrait() VCONST {return _portrait;} - void SetPortrait(int p) {_portrait = p;} - - int GetUseColors() VCONST {return _useColor;} - void SetUseColors(int c) {_useColor = c;} - - int GetPaper() VCONST {return _paperType;} - VCONST char* GetPaperName() VCONST {return 0;} - - int GetCopies() VCONST {return _copies;} - void SetCopies(int s) {_copies = s;} - - int GetToFile() VCONST {return _toFile;} - - int Setup( VCONST char* fn = 0) VCONST {return 0;} - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - - int _width; // width of printer - int _height; // height of printer - int _portrait; // true if portrait, else landscape - int _useColor; // true if printer supports colors - - int _paperType; - int _copies; - int _toFile; - }; - -#endif diff --git a/v/includew/v/vnotice.h b/v/includew/v/vnotice.h deleted file mode 100644 index bd7b4fc..0000000 --- a/v/includew/v/vnotice.h +++ /dev/null @@ -1,38 +0,0 @@ -//=============================================================== -// vnotice.h - notice modal dialog - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VNOTICE_H -#define VNOTICE_H -#include - - class V_EXPORT vApp; - - class V_EXPORT vNoticeDialog : protected vModalDialog - { - public: //---------------------------------------- public - vNoticeDialog(VCONST vBaseWindow* bw, VCONST char* title = "Notice") : - vModalDialog(bw,title) { _cmdsAdded = 0; } - vNoticeDialog(VCONST vApp* aw, VCONST char* title = "Notice") : - vModalDialog(aw,title) { _cmdsAdded = 0; } - ~vNoticeDialog() {} - - void Notice(VCONST char* msg); - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - - int _cmdsAdded; - virtual void DialogCommand(ItemVal id, ItemVal val, CmdType ctype); - virtual void DialogDisplayed(); // TEH Dec97 - - }; -#endif diff --git a/v/includew/v/vnulldc.h b/v/includew/v/vnulldc.h deleted file mode 100644 index 9a5cca0..0000000 --- a/v/includew/v/vnulldc.h +++ /dev/null @@ -1,75 +0,0 @@ -//=============================================================== -// vnulldc.h: a NULL DC class .h file - All platforms -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VNULLDC_H -#define VNULLDC_H - -#include - -class V_EXPORT vNullDC : public vDC -{ -public: //---------------------------------------- public - vNullDC(void) {} - virtual ~vNullDC() {} - - // Drawing - virtual void Clear(void) {} - virtual void ClearRect(int left, int top, int width, int height) {} - virtual void DrawAttrText(int x, int y, VCONST char* text, VCONST ChrAttr attr) {} - virtual void DrawText(int x, int y, VCONST char* text) {} - virtual void DrawEllipse(int x, int y, int width, int height) {} - virtual void DrawIcon(int x, int y, VCONST vIcon& icon) {} - virtual void DrawLine(int x, int y, int xend , int yend) {} - virtual void DrawPoint (int x, int y) {} - virtual void DrawPolygon (int n, vPoint points[], - int fillStyle = vAlternate) {} - virtual void DrawRoundedRectangle(int x, int y, - int width, int height, int radius = 10) {} - virtual void DrawRectangle(int x, int y, int width, int height) {} - virtual void DrawLines(vLine* lineList){}; - virtual void DrawPoints (vPoint* pointList){}; - virtual void DrawRectangles(vRect* rectList){}; - - // Misc - - virtual int GetPhysHeight() VCONST { return 0; } - virtual int GetPhysWidth() VCONST { return 0; } - - virtual void SetBackground(VCONST vColor& color) {} - - virtual void SetScale(int mult, int div) {} - virtual void GetScale(int& m, int& d) VCONST { m = 1; d = 1; } - - void SetTranslate(int x, int y) { } - void SetTransX(int x) {} - void SetTransY(int y) {} - void GetTranslate(int& x, int& y) VCONST {x = 0; y = 0;} - int GetTransX() VCONST { return 0; } - int GetTransY() VCONST { return 0; } - - virtual void SetFont(VCONST vFont& vf) {} - virtual vFont GetFont() VCONST { return _vf; } - - virtual void SetPen(VCONST vPen& /*pen*/) {} - virtual vPen GetPen() VCONST { return _vp; } - - virtual void SetBrush(VCONST vBrush& brush) {}; - virtual vBrush GetBrush() VCONST { return _vb; } - - virtual int TextHeight(int& asc, int& des) VCONST {asc = des = 0; return 0;} - virtual int TextWidth(VCONST char* str) VCONST {return 0;} - -private: - vFont _vf; - vBrush _vb; - vPen _vp; -}; -#endif diff --git a/v/includew/v/vos.h b/v/includew/v/vos.h deleted file mode 100644 index 6ff3130..0000000 --- a/v/includew/v/vos.h +++ /dev/null @@ -1,37 +0,0 @@ -//=============================================================== -// vos. - the OS interface object -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VOS_H -#define VOS_H -#include - - class V_EXPORT vOS - { - public: - vOS(); - ~vOS(); - - - int vChDrive(int drive); - int vGetEnvVal(char* name, char* val, int maxlen=255); - int vGetUserName( char* s, int len); - void vGetHostName(char* s, int len); - long vGetPid(); - int vGetCWD(char* buf, int len); - int vChDir(const char* path); - - int vDeleteFile(const char* filename); - int vRenameFile(const char* oldFilename, const char* newFilename); - void vSleep(long MSec); - int vRunProcess(const char* cmd, const char* StdOut = 0, - const char* StdErr = 0, const int Wait = 0, const int minimize = 0); - }; -#endif diff --git a/v/includew/v/vpane.h b/v/includew/v/vpane.h deleted file mode 100644 index 82a9c38..0000000 --- a/v/includew/v/vpane.h +++ /dev/null @@ -1,69 +0,0 @@ -//=============================================================== -// vpane.h - Base class for window panes - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VPANE_H -#define VPANE_H - -// panes will be canvases, menus, and command bars - -#include // basic definitons - -// This is a small class, and everything is inline here -// in the .h file. - - class V_EXPORT vWindow; // all panes are part-of a vWindow - - class V_EXPORT vPane - { - friend class V_EXPORT vWindow; - friend class V_EXPORT vCmdWindow; - - public: //---------------------------------------- public - - vPane(PaneType pt) - { - SysDebug1(Constructor,"vPane::vPane(type: %d) constructor\n",pt) - _paneType = pt; - } - - virtual ~vPane() - { - SysDebug(Destructor,"vPane::~vPane() destructor\n") - } - - virtual void initialize(vWindow* pw, HWND bw) - {_parentWin = pw; _baseW = (HWND)bw; } - - // define these to interface with specific Pane's setters - - virtual int GetPaneValue(ItemVal /* id */, int& /* v */) VCONST {return 0;} - virtual int GetPaneTextIn(ItemVal /* id */, char* /* v */, int /*max*/) VCONST {return 0;} - - virtual void SetPaneValue(ItemVal /* id */, int /* v */, ItemSetType /* st */) {} - - virtual void SetPaneString(ItemVal /*id */, VCONST char* /* s */) {} - - virtual void ShowPane(int /* OnOrOff */) VCONST {} - virtual vWindow* GetPaneParent() {return _parentWin; } - - protected: //--------------------------------------- protected - - vWindow* _parentWin; // parent window of this object - - HWND _baseW; // base widget used for this pane - - PaneType _paneType; // type of this pane - - private: //--------------------------------------- private - - - }; -#endif diff --git a/v/includew/v/vpen.h b/v/includew/v/vpen.h deleted file mode 100644 index dda920a..0000000 --- a/v/includew/v/vpen.h +++ /dev/null @@ -1,67 +0,0 @@ -//=============================================================== -// vpen.h: pen class header for drawing - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VPEN_H -#define VPEN_H - -#include // Basic defs -#include - -// Use Windows for line styles, map to something reasonable for X - -// Windows: -//enum PenStyle { Solid = PS_SOLID, Dash = PS_DASH, Dot = PS_DOT, -// DashDot = PS_DASHDOT, Transparent = PS_NULL }; - - class V_EXPORT vPen - { - public: //---------------------------------------- public - - vPen(unsigned int r = 0, unsigned int g = 0, unsigned int b = 0, - int width = 1, int style = vSolid); - vPen(const vPen &pen); // copy constructor - - ~vPen(); - - vPen& operator =(const vPen& s); // vPen = vPen - int operator ==(const vPen& p2) VCONST - { return (penColor == p2.penColor && penWidth == p2.penWidth && - penStyle == p2.penStyle); } - - int operator !=(const vPen& p2) VCONST - { return (penColor != p2.penColor || penWidth != p2.penWidth || - penStyle != p2.penStyle); } - - void SetStyle(int style); - int GetStyle() VCONST { return penStyle; } - void SetWidth(int width); - int GetWidth() VCONST { return penWidth; } - void SetColor(const vColor& c); - void SetColor(unsigned int r, unsigned int g, unsigned int b); - vColor GetColor() VCONST { return penColor; } - - HPEN GetHPEN() VCONST ; - - protected: //--------------------------------------- protected - private: //--------------------------------------- private - - void ReleaseHpen() - { if (_created) {_created = 0; ::DeleteObject(_hpen); _hpen = 0;}} - - vColor penColor; - int penWidth; - int penStyle; - - VMUTABLE HPEN _hpen; - VMUTABLE int _created; - }; - -#endif diff --git a/v/includew/v/vpopmenu.h b/v/includew/v/vpopmenu.h deleted file mode 100644 index be2e779..0000000 --- a/v/includew/v/vpopmenu.h +++ /dev/null @@ -1,97 +0,0 @@ -//=============================================================== -// vmenu.h - vmenu class definitions - Windows -// -// Copyright (C) 1995-1999 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VPOPMENU_H -#define VPOPMENU_H - -#include - -// The _menuButton array will point to static arrays of menus. -// The user will allocate these, e.g.: -// -// vMenu EditMenu[] = -// { -// {"Item 1", MENU_1, isSens, notChk, noKeyLbl, noKey, noSub}, -// {"Item 2", MENU_2, isSens, notChk, noKeyLbl, noKey, noSub}, -// {NULL} -// }; -// -// and to define the menu bar -// -// vMenu myMenu[] = -// { -// {"Edit", M_File, isSens, notChk, noKeyLbl, noKey, &EditMenu[0]}, -// {NULL} -// }; -// -// the _menuButton will be done dynamically. The call back -// will pass the value of an item to a given window. - - typedef struct PMenuInfo // Implementation dependent stuff - { - int ItemIndex; - int SubMenuIndex; - PMenuInfo* NxtInfo; - } PMenuInfo; - - typedef struct PMenuButton - { - VCONST char* label; // Label for button - vMenu* SubMenu; // the menu items associated with this button - PMenuInfo* mInfo; // dynamically allocated info list - - // System dependent handles - HMENU hPullDown; // handle for the pulldown - - } PMenuButton; - - static const int MAX_PMENU_BUTTONS = 20; // Up to 20 menu buttons + submenus - // per window - class V_EXPORT vWindow; - - class V_EXPORT vPopupMenu - { - - public: //---------------------------------------- public - // the constructors - vPopupMenu(VCONST vMenu* menu, VCONST vWindow* pWin); - vPopupMenu(const vPopupMenu& m); // Copy constructor - virtual ~vPopupMenu(); // Destructor - - // non-virtual methods - - void ShowMenu(int x, int y); - - int isImplemented() { return 1; } - - int GetValue(ItemVal id) VCONST; - void SetValue(ItemVal id, int val, ItemSetType setType); - void SetString(ItemVal id, VCONST char* str); // set menu item label - - protected: //--------------------------------------- protected - - - private: //--------------------------------------- private - // data - - vWindow* _pWin; - int _nextMenuButton; - int _nextSubMenu; - PMenuButton _mb[MAX_PMENU_BUTTONS]; // Up to 10 menu items per window - HMENU _topLevelMenu; - - // methods - void initialize(); - void fixLabel(VCONST char* lbl, VCONST char* key) VCONST; - void doAddMenu(int id, HMENU parent); // build the menu - }; - -#endif diff --git a/v/includew/v/vprintdc.h b/v/includew/v/vprintdc.h deleted file mode 100644 index 870ce5e..0000000 --- a/v/includew/v/vprintdc.h +++ /dev/null @@ -1,28 +0,0 @@ -//=============================================================== -// vpsdc.h: Print DC class .h file - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VPRINTDC_H -#define VPRINTDC_H - -#include - - // This is a simple renamimg of the NullDC - - class /* V_EXPORT */ vPrintDC : public vWinPrinterDC - { - - public: //---------------------------------------- public - - vPrintDC(int scale = 0) : vWinPrinterDC(scale) {} - - virtual ~vPrintDC() {} - }; -#endif diff --git a/v/includew/v/vprinter.h b/v/includew/v/vprinter.h deleted file mode 100644 index 5073796..0000000 --- a/v/includew/v/vprinter.h +++ /dev/null @@ -1,31 +0,0 @@ -//=============================================================== -// vprinter.h: Printer class .h file -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VPRINTER_H -#define VPRINTER_H - -#include - - // For Windows version, this is a simple renaming of vWinPrinter - - class V_EXPORT vPrinter : public vWinPrinter - { - public: //---------------------------------------- public - vPrinter() {} - virtual ~vPrinter() {} - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - - }; - -#endif diff --git a/v/includew/v/vprogrsc.h b/v/includew/v/vprogrsc.h deleted file mode 100644 index 6ac7297..0000000 --- a/v/includew/v/vprogrsc.h +++ /dev/null @@ -1,51 +0,0 @@ -//=============================================================== -// vprogrsc.h - List Command class - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VPROGRESSC_H -#define VPROGRESSC_H - -#include // We are derived from vcmd - - class V_EXPORT vCmdParent; - - class V_EXPORT vProgressCmd : public vCmd - { - - public: //---------------------------------------- public - - vProgressCmd(vCmdParent* dp, CommandObject* co); - - virtual ~vProgressCmd(); - - virtual void initialize(); - - virtual int GetCmdValue(ItemVal id) VCONST; - virtual void SetCmdVal(ItemVal val, ItemSetType st); - - virtual int MEASUREITEM(int id, MEASUREITEMSTRUCT* mis); - virtual int DRAWITEM(int id, DRAWITEMSTRUCT* dis); - - - protected: //--------------------------------------- protected - - - private: //--------------------------------------- private - - HWND _wLabel; // For a label - - int _minVal; - int _maxVal; - - int _curVal; // current value - int _isVert; - - }; -#endif diff --git a/v/includew/v/vradioc.h b/v/includew/v/vradioc.h deleted file mode 100644 index a5cc299..0000000 --- a/v/includew/v/vradioc.h +++ /dev/null @@ -1,51 +0,0 @@ -//=============================================================== -// vradioc.h - Radio Button Command class - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VRADIOC_H -#define VRADIOC_H - -#include // We are derived from vcmd - - class V_EXPORT vCmdParent; - - class V_EXPORT vRadioButtonCmd : public vCmd - { - - public: //---------------------------------------- public - - vRadioButtonCmd(vCmdParent* dp, CommandObject* co); - vRadioButtonCmd(const vRadioButtonCmd&); // Copy constructor - - virtual ~vRadioButtonCmd(); - - virtual void initialize(void); - - virtual void ResetItemValue(void); - - virtual int GetCmdValue(ItemVal id) VCONST; - - virtual void SetCmdVal(ItemVal val, ItemSetType st); - - virtual void SetCmdStr(VCONST char* str); - - protected: //--------------------------------------- protected - - virtual void CmdCallback(int id, WORD codeNotify); - - private: //--------------------------------------- private - - static vRadioButtonCmd* _RBList; // list of all radio buttons - vRadioButtonCmd* _nextRB; // ptr to next rb - int _copied; // For copy constructor - - HWND _wLabel; // Widget for button label - }; -#endif diff --git a/v/includew/v/vrepldlg.h b/v/includew/v/vrepldlg.h deleted file mode 100644 index 2c96f8d..0000000 --- a/v/includew/v/vrepldlg.h +++ /dev/null @@ -1,44 +0,0 @@ -//=============================================================== -// vrepldlg.h - find/replace modal dialog -// -// Copyright (C) 1995-1999 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef vReplDlg_H -#define vReplDlg_H -#include - -#ifndef V_EXPORT -#define V_EXPORT -#endif - class V_EXPORT vApp; - class V_EXPORT vReplaceDialog : protected vModalDialog - { - public: //---------------------------------------- public - vReplaceDialog(vBaseWindow* bw, VCONST char* title = "Find/Replace") : - vModalDialog(bw, title) - { added = 0;} - vReplaceDialog(vApp *aw, VCONST char* title = "Find/Replace") : - vModalDialog(aw, title) - { added = 0;} - ~vReplaceDialog() {} - - int AskReplacePat(char* findpat, const int maxlen, - char* replpat, const int maxrlen, - int& caseSens, int& Down, - int& Wrap, int& Prompt, int& All); - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - - int added; - virtual void DialogCommand(ItemVal id, ItemVal val, CmdType ctype); - - }; -#endif diff --git a/v/includew/v/vreply.h b/v/includew/v/vreply.h deleted file mode 100644 index cd7dad1..0000000 --- a/v/includew/v/vreply.h +++ /dev/null @@ -1,39 +0,0 @@ -//=============================================================== -// vreply.h - reply modal dialog - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VREPLY_H -#define VREPLY_H -#include - - class V_EXPORT vApp; - - class V_EXPORT vReplyDialog : protected vModalDialog - { - public: //---------------------------------------- public - vReplyDialog(vBaseWindow* bw, VCONST char* title = "Reply") : - vModalDialog(bw, title) { added = 0;} - vReplyDialog(vApp* aw, VCONST char* title = "Reply") : - vModalDialog(aw, title) {added = 0;} - ~vReplyDialog() {} - - int Reply(VCONST char* msg, char* reply, int maxlen, - VCONST char* dflt = ""); - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - - virtual void DialogCommand(ItemVal id, ItemVal val, CmdType ctype); - int added; - virtual void DialogDisplayed(); // TEH Dec97 - - }; -#endif diff --git a/v/includew/v/vsliderc.h b/v/includew/v/vsliderc.h deleted file mode 100644 index 3ba38ae..0000000 --- a/v/includew/v/vsliderc.h +++ /dev/null @@ -1,46 +0,0 @@ -//=============================================================== -// vslider.h - List Command class - Windows -// -// Copyright (C) 1995-1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VSLIDERC_H -#define VSLIDERC_H - -#include // We are derived from vcmd - - class V_EXPORT vCmdParent; - - class V_EXPORT vSliderCmd : public vCmd - { - - public: //---------------------------------------- public - - vSliderCmd(vCmdParent* dp, CommandObject* co); - - virtual ~vSliderCmd(); - - virtual void initialize(); - - virtual int GetCmdValue(ItemVal id) VCONST; - virtual void SetCmdVal(ItemVal val, ItemSetType st); - - protected: //--------------------------------------- protected - - - - private: //--------------------------------------- private - - int _curVal; // current value - - int _minVal; // Can scale to min and val - int _maxVal; - - virtual void CmdCallback(int id, WORD codeNotify); - }; -#endif diff --git a/v/includew/v/vslist.h b/v/includew/v/vslist.h deleted file mode 100644 index fda027b..0000000 --- a/v/includew/v/vslist.h +++ /dev/null @@ -1,44 +0,0 @@ -//=============================================================== -// vslist.h - The vSList class - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VSLIST_H -#define VSLIST_H - -// define V_EXPORT for X version -#ifndef V_EXPORT -#define V_EXPORT -#endif - - class V_EXPORT vSList - { - - public: //---------------------------------------- public - vSList(int maxsize = 128); - ~vSList(); - -// vSList& operator =(const vSList& slist); - void init(); - void erase(); - int size() const; - int insert(int insAt, const char* strn) const; - int replace(int repAt, const char* strn) const; - int deleteItem(int delAt) const; - - int max; - char** list; - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - - }; - -#endif diff --git a/v/includew/v/vspinc.h b/v/includew/v/vspinc.h deleted file mode 100644 index ad46a6d..0000000 --- a/v/includew/v/vspinc.h +++ /dev/null @@ -1,54 +0,0 @@ -//=============================================================== -// vspinc.h - spinner- Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VSPINC_H -#define VSPINC_H - -#include // We are derived from vcmd - - class V_EXPORT vCmdParent; - - class V_EXPORT vSpinnerCmd : public vCmd - { - - public: //---------------------------------------- public - - vSpinnerCmd(vCmdParent* dp, CommandObject* co); - - virtual ~vSpinnerCmd(); - - virtual void initialize(void); - - virtual int GetCmdValue(ItemVal id) VCONST; - virtual void SetCmdVal(ItemVal val, ItemSetType st); - - protected: //--------------------------------------- protected - - - private: //--------------------------------------- private - - char** _fullList; // alias pointer to full list - int _maxWidth; // max width of any item - int _numItems; // number of items on list - int _maxVal; - int _minVal; - int _step; - int _curSelection; // index of current selected item - int _TextList; - int _textId; // my text id - - static int _textIdPool; // For text portion of spinner - - void SetupList(void); - virtual void CmdCallback(int id, WORD codeNotify); - - }; -#endif diff --git a/v/includew/v/vstatusp.h b/v/includew/v/vstatusp.h deleted file mode 100644 index eec1bd6..0000000 --- a/v/includew/v/vstatusp.h +++ /dev/null @@ -1,17 +0,0 @@ -//=============================================================== -// vstatusp.h - Status Bar class .h file - Windows -// -// Copyright (C) 1995 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VSTATUSP_H -#define VSTATUSP_H - -#include - -#endif diff --git a/v/includew/v/vtextc.h b/v/includew/v/vtextc.h deleted file mode 100644 index ca7097d..0000000 --- a/v/includew/v/vtextc.h +++ /dev/null @@ -1,39 +0,0 @@ -//=============================================================== -// vtextc.h - Text Output Command Class - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VTEXTC_H -#define VTEXTC_H - -#include // We are derived from vcmd - - class V_EXPORT vCmdParent; - - class V_EXPORT vTextCmd : public vCmd - { - - public: //---------------------------------------- public - - vTextCmd(vCmdParent* dp, CommandObject* co); - - virtual ~vTextCmd(); - - virtual void initialize(void); - - virtual void SetCmdVal(ItemVal val, ItemSetType st); - - virtual void SetCmdStr(VCONST char* str); - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - - }; -#endif diff --git a/v/includew/v/vtextcnv.h b/v/includew/v/vtextcnv.h deleted file mode 100644 index 8d578fe..0000000 --- a/v/includew/v/vtextcnv.h +++ /dev/null @@ -1,150 +0,0 @@ -//=============================================================== -// vtextcnv.h - vTextCanvasPane class - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VTEXTCNV_H -#define VTEXTCNV_H - -const int MAX_ROWS = 100; -const int MAX_COLS = 400; - - -const int MARGIN = 2; - - -#define ScrChar(r,c) ((screen+(r*colsAllocated)+c)->chr) -#define ScrAttr(r,c) ((screen+(r*colsAllocated)+c)->attr) -#define ScrAddr(r,c) (screen+(r*colsAllocated)+c) - -#include - - class V_EXPORT vTextCanvasPane : public vCanvasPane - { - friend class V_EXPORT vWindow; - public: //---------------------------------------- public - vTextCanvasPane(); - vTextCanvasPane(const vTextCanvasPane& t); - - virtual ~vTextCanvasPane(); - - // Window management/drawing - - virtual void Clear(void); // Clear text canvas window - - virtual void ClearRow(const int r, const int c); // Clear row of text - virtual void ClearToEnd(const int r, const int c); // Clr to end of screen - - int GetCols() VCONST { return maxCols; } - int GetRows() VCONST { return maxRows; } - - void GetRC(int& r, int& c) VCONST { r = curRow; c = curCol; } - void GotoRC(const int r, const int c); - - virtual void DrawAttrText(const char* text, const ChrAttr attr); - virtual void DrawAttrsText(const char* text, const ChrAttr* attr); - - virtual void DrawChar(const char chr, const ChrAttr attr); - - void DrawText(const char* text); - - virtual void DrawAttrText(int x, int y, char* text, const ChrAttr attr) - { vCanvasPane::DrawAttrText(x, y, text, attr); } - - virtual void DrawText(int x, int y, char* text) - { vCanvasPane::DrawText(x, y, text); } - - void HideTextCursor(void) {DrawTextCursor(-1,-1);} - void ShowTextCursor(void) {DrawTextCursor(curRow,curCol);} - void SetTextRowsCols(int rows, int cols); - - // Scrolling - void ScrollText(const int lineCount); - - // Events - virtual void FontChanged(VCONST vFont& newfont); - - virtual void ResizeText(const int rows, const int cols); - virtual void Redraw(int x, int y, int width , int height); - virtual void Resize(int w, int h); // Resize event - - virtual void TextMouseDown(int row, int col, int button) - { - SysDebug3(MouseEvents,"TextMouseDown(r:%d,c:%d,btn:%d)\n",row,col,button); - }; - virtual void TextMouseUp(int row, int col, int button) - { - SysDebug3(MouseEvents,"TextMouseUp(r:%d,c:%d,btn:%d)\n",row,col,button); - }; - virtual void TextMouseMove(int row, int col, int button) - { - SysDebug3(MouseEvents,"TextMouseMove(r:%d,c:%d,btn:%d)\n",row,col,button); - }; - virtual void initialize(vWindow* pWindow, HWND pWidget); - - int ColToX(int c) // convert col to X coord - { - return (c*cWidth) + textMargin; - } - int RowToY(int r) // convert row to Y coord - { - return (r*cHeight) +cHeight + textMargin; - } - - int getMargin() { return textMargin;} - void setMargin(int marg) { textMargin = marg;} - - protected: //--------------------------------------- protected - - - virtual void EnterEV(void); - virtual void LeaveEV(void); - - int cHeight; // height of a character - int cAscent; // Ascent of a character - int cDescent; // Descent of a character - int cWidth; // width of a chacter - int maxRows; // # rows that can be displayed - int maxCols; // # columns that can be displayed - - int curRow; // Current row - int curCol; // Current col - - int caretOn; - - int rowsAllocated; // how many rows and columns - int colsAllocated; // actually allocated to - - dChar* screen; // array of pointers to dChar rows - - // make these protected now - - virtual void MouseDown(int x, int y, int button); - virtual void MouseUp(int x, int y, int button); - virtual void MouseMove(int x, int y, int button); - - virtual void ResizeText(void); - - private: //--------------------------------------- private - - int textMargin; // left margin for text - int _cursorSet; - - void ClearRowDisplay(const int r, const int c); // Clear screen only - - void DoDrawText(const char* text, const ChrAttr attr); - - void DrawTextScr(int r, int c, dChar* txt); - - void DrawTextCursor(int r, int c); - - int YToRow(int y); - int XToCol(int x); - }; -#endif diff --git a/v/includew/v/vtexted.h b/v/includew/v/vtexted.h deleted file mode 100644 index 13da61a..0000000 --- a/v/includew/v/vtexted.h +++ /dev/null @@ -1,471 +0,0 @@ -//=============================================================== -// vtexted.h - vTextEditor class definitions - based on vTextCanvas -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VTEXTED_H -#define VTEXTED_H - -#include - -// for X version -#ifndef V_EXPORT -#define V_EXPORT -#endif - - class V_EXPORT vCmdWindow; - class V_EXPORT vTextEdCmdInterp; - - // These values may be used a the id paramater of the - // EditCommand method, which will then carry out the - // specfied command. The val parameter is used to - // pass a count when necessary, and can usually be - // a positive or negative value. Thus edCharRight with - // a positive val moves right; with a negative val, left. - enum // editor commands - { - edBalMatch = 10000, // find matching paren (if > 1, up to val lines away) - edBufferBottom, // move to bottom of file (no val) - edCenterScreen, // center cursor in display window - edCharDelete, // delete +/- val chars - edCharFoldCase, // swap case of +/- val letters - edCharInsert, // insert char val - edCharRight, // move +/- val chars right - edCut, // Cut - edCopy, // Copy - edPaste, // Paste - edFill, // fill current line - edFind, // invoke TextEd's find dialog (no val) - edFindNext, // find next occurrence of prev (no val) - edHelp, // show help screen - edIndent, // autoindent if on - edLineBeginning, // move to line beginning (no val) - edLineDown, // move down +/- val lines in column - edLineDownBeg, // move down +/- val lines - edLineDelete, // delete +/- val lines - edLineDeleteFront, // delete to beginning of line (no val) - edLineDeleteToEnd, // delete to end of line (no val) - edLineEnd, // move to end of line (no val) - edLineGoto, // move cursor to line val - edLineOpen, // open val new blank lines - edFormatC, // format a C Line - edNoteLocation, // note which line we are on - edNoteGoto, // goto noted locateion - edScrollDown, // scroll val lines without changing cursor - edReplace, // Find/Replace - edUndo, // UnDo the last edit - edUnDoMove, // UnDo the last move - edVerify, // force repaint of screen (no val) - edWordRight, // move cursor +/- val words right - edNoOp - }; - - enum FileType - { - Text, - CPP, - HTML, - Java, - TeX, - gccError, - bccError, - javaError, - Perl, - Fortran, - Lisp, - XML, - Python, - Tcl, - Makefile, - Shellscript - }; - - enum ReplaceConfirm - { - YesRepl = 800, // Replace this instance - YesReplNext, // Replace, go to next - NoRepl, // Don't replace - NoReplNext, // Don't replace, goto next - QuitR, // Quit replacing - RepAll // Quit confirming, replace all - }; - - const int MAX_LINE = 500; // Max line length we will handle - const int MAX_UNDO = 4094; - - typedef char* BUFFPTR; - - typedef struct MARK_RANGE - { - long beg_lin; /* first line of marked range */ - long end_lin; /* last line of marked range */ - int beg_col; /* col where first line begins */ - int end_col; /* col where last line ends */ - BUFFPTR beg_chr; /* first chr */ - BUFFPTR end_chr; - } MARK_RANGE; - - typedef struct edState - { - long changes; // count of changes - - FileType ftype; // what kind of file type - int - autoIndent, // autoindent flag - counter, // counter for + insert - echof, // whether or not to echo action - ins_mode, // true if insert mode - delOnInsert, // true if delete selection on insert - readOnly; // true if read only - } edState; - - typedef struct globalState - { - int - findAtBeginning, // leave find at beginning of pattern - fixed_scroll, // flag if using fixed scroll - delOnInsert, // true if delete selection on insert - tabspc, // tab spacing - wraplm, // right limit - braceIndent; // indenting for {}'s - } globalState; - - -#include - - class V_EXPORT vTEConfirm : protected vModalDialog - { - public: - vTEConfirm(VCONST vCmdWindow *bw, VCONST char* title = "Replace?"): - vModalDialog((vBaseWindow*)bw,title) {added = 0;} - ~vTEConfirm() {} - int ConfirmRep(); - - protected: - - static DialogCmd ConfirmCmds[]; - - private: - virtual void DialogCommand(ItemVal id, ItemVal val, - CmdType ctype); - int added; - }; - - class V_EXPORT vTextEditor : public vTextCanvasPane // The main way to deal with a file - { - - public: //---------------------------------------- public - vTextEditor(VCONST vCmdWindow* parent); - ~vTextEditor(); // Destructor - - virtual void resetBuff(); // open the buffer - virtual int addLine(char* line); // add a line to end of buffer - virtual int getFirstLine(char* line, int maxChars); // first line in buffer - virtual int getNextLine(char* line, int maxChars); // next line in buffer, -1 = END - virtual int getLine(char* line, int maxChars, long lineNum); // retrieve given line - virtual void displayBuff(long lineNum = 1, int paintIt = 1); - // finished with buffer - virtual int insertLine(char* line, long before, bool doUndo = true); - virtual void adjustLines(long line_1, int by); - - // Editor command interpreter - - virtual int EditCommand(int id, long val); - virtual int EditKeyIn(vKey key, unsigned int shift); - void ChangeCmdInterp(vTextEdCmdInterp* newCI); - vTextEdCmdInterp* GetCmdInterp() VCONST { return _teCInt; } - - // State Notification - - virtual void ChangeLoc(long line, int col) {} // just state change - virtual void ChangeInsMode(int IsInsMode, char* msg = 0) {} - virtual void StatusMessage(char *msg) {} - virtual void ErrorMsg(char *str) {}; - globalState GetGlobalState() VCONST { return gState; } - void SetGlobalState(globalState setGState) { gState = setGState; } - edState GetEdState() VCONST { return state; } - void SetEdState(edState setState) { state = setState; } - void SetRdOnly(int ro) {state.readOnly = ro;} - void SetInsMode(int ins) {state.ins_mode = ins;} - void SetEchoF(int e) {state.echof = e;} - void SetAutoIndent(int ai) {state.autoIndent = ai;} - FileType GetFileType() VCONST { return state.ftype; } - void SetFileType(FileType ft) {state.ftype = ft; } - long JLine() VCONST {return b_lastln; } - void SetJLine(long j) {b_lastln = j;} - void SetFindPat(char* newpat) - {if (strlen(newpat) < MAX_LINE) strcpy(theFindPat,newpat); } - char* GetFindPat() VCONST { return theFindPat; } - - long GetLines() VCONST { return lastLine; } - long GetCurLine() VCONST { return curlin; } - int getColPos() {return col_pos(curchr);} - int OldLen() VCONST { return oldlen; } - void SetOldLen(int val) {oldlen = val; } - int Changed() VCONST { return state.changes > 0; } - void IncChanges() { ++state.changes; }; - void Verify(void); // repaint screen - - // ******* Methods used by command interpreters ************ - - // Character oriented methods - - int charDelete(long cnt, bool doUndo = true, - bool removeRange = true); // delete next cnt chars - int charFoldCase(long cnt); // swap case of letter - int charInsert(int ival, bool doUndo = true); // forced insert - int charRight(long cnt, int clear_mark = 1); // move char right - - // line oriented methods - - void lineAutoFill(void); // automatic filling - void lineBeginning(); // move to line beginning - int lineDown(long cnt, int clrRange = 1);// move down cnt lines - int lineDownBeg(long cnt, int notify = 1, - int clrRange = 1); // move down cnt lines - void lineDelete(long cnt, bool doUndo = true); // delete cnt lines - int lineDeleteFront(bool doUndo = true); // delete to beginning of line - int lineDeleteToEnd(bool doUndo = true); // delete to end of line - void lineEnd(int clrRange = 1); // move to end of line - int lineFill(long count); // fill count lines - int lineGoto(long cnt); // move cursor to line cnt - int lineOpen(long cnt); // open new blank line - - int formatC(long count); - - // misc - int autoIndent(); - int BalMatch(long val); // find matching paren - void CenterScreen(); - int wordRight(long cnt); - void scrollDown(long delta); - int getSelection(char* sel, int max); - void setSelection(int howmuch); - int EditCut(); - int EditCopy(); - int EditPaste(); - int Find(char* pat, int caseSensitive = 0, int Down = 1, int Wrap = 0); - int FindNext(int caseSensitive = 0, int Down = 1, int Wrap = 0); - int Replace(const char* pat, const char* repl, int caseSensitive = 0, - int Down = 1, int Wrap = 0, int Confirm = 0, int replaceAll = 0); - int undoEdit(void); - void bufferBottom(void); // move to bottom of file - void newscr(void); - - void ClearMarkRange(void); - int RemoveMarkRange(bool doUndo = true); - - int insertToRange(char* atFront, char* atEnd); - void addToRange(long rows, long cols); // add to mark range - - void highLightCurLine(); - - virtual int defaultKeyIn(vKey key, unsigned int shift); - - virtual void TextMouseDown(int row, int col, int button); - virtual void TextMouseUp(int row, int col, int button); - virtual void TextMouseMove(int row, int col, int button); - - int mint(int v1, int v2); - int maxt(int v1, int v2); - long minl(long v1,long v2); - long maxl(long v1, long v2); - int clower(int ch); - int cupper(int ch); - - protected: //--------------------------------------- protected - - virtual void initBuff(); // create buffers - virtual BUFFPTR GLine(long lineNum); - virtual int GCh(BUFFPTR charNum) VCONST { return *(charNum); } - virtual BUFFPTR deleteCharBF(BUFFPTR charNum, long lineNum); - virtual long deleteLinesBF(long start, long end); - virtual int insertCharBF(int chr, BUFFPTR& curchr, long& curlin); - virtual int lineLenBF(long lineNum); - virtual long lastLineBF() VCONST { return _nextLine - 1; } // last line in buff - - // Scrolling - - virtual void HPage(int, int); - virtual void VPage(int, int); - - virtual void HScroll(int); - virtual void VScroll(int); - - // Events - - virtual void FontChanged(VCONST vFont& newFont); - virtual void ResizeText(const int rows, const int cols); - virtual void Redraw(int x, int y, int width , int height); - - // utilities for formatC - int has_key(char *buff_ptr, char *key); - int is_key_word(char *bf, int case_def); - long get_prev(char *prev_buff, long start); - - // misc methods - - int SelectionLen(); // get len of marked range - void AddToRangeRow(long cnt); // add to mark range - void AddToRangeCol(int col); // add to mark range - int CopySelection(char* buff, int max, int unmark); - - void setHighlight(ChrAttr hl) {_highlighter = hl;} - ChrAttr getHighlight() {return _highlighter;} - - virtual void paintLine(char* linout, int lineStart, - int hiStart, int hiLast, long lineNum); - - vCmdWindow* _parent; - - edState state; // state stuff for outside - static globalState gState; - static int findCaseSensitive; - static char theFindPat[MAX_LINE + 2]; // one static find pattern - static char theReplPat[MAX_LINE + 2]; // one static repl pattern - static int findDown; - static int findWrap; - static int replaceConfirm; - static int replaceAll; - - private: //--------------------------------------- private - - int IsEndLine(int chr) VCONST { return (chr == '\n' || chr == '\r'); } - void tvhdln(void); - void setScrollBar(); - void checkIfScrolled(); - void FindDispLine(long& ibeg, int& cnt); - int CombineLines(void); - int findX(void); - int line_can_fit(long l); - int Fill1(int dir, int val); - void range(long cnt,long *lbeg, long *lend); - void updateScroll(long change); - void updateNoScroll(long change); - void getCurLineFront(char* buff, long start); - bool isSpecial(char* curline); - BUFFPTR lastBX(long line); - void newScrollScreen(long ibeg); - bool SaveKillLine(long cnt, bool partialLine = false); - void tvtyln(long lineNum,BUFFPTR chrptr, int whole_line); - int IsWordChar(int chr); - void update(long change); - void MouseMoveTo(int row, int col); - int reallocLines(); - void retypeCurlin(int eraseLine=0); - - void undoOn(const char* msg); - void undoOff(const char* msg); - - // Screen manip - - void tvxy(int ix, int iy); - void tvplin(long lineNum, BUFFPTR chrptr, int whole_line, int hibeg, int hiend); - void type_lines(long ibeg, int icnt, int wholeLine = 0); - void tvbotb(int n); - void tvclr(void); - void tvelin(void); - void tvescr(void); - void tvtopb(int n); - - // Utils - int col_pos(BUFFPTR chr_pos, int do_shift = 0 ); - - BUFFPTR appendToBuff(char* line); - - // Operating state - type of scrolling, etc. - - // variables ------------------------------------------- - int - ddline, // default display line - dsplin, // the default display line - last_col_out, // last column output - leftmg, // left margin of display - linptr, // used to build output lines - mouseCol, // where mouse is (on down) - mouseRow, - mouseMoveCol, - mouseMoveRow, - oldcol, // beginning column for dwncol - oldlen, // length for '=' command - setCursor, // if need to reset cursor after resize - tvdlin, // the "active" display line - tvx, // current x cursor position - tvy, // current y cursor position - use_wild, // use wild cards in match - wasColCmd, // if last command was a column - xoutcm; // used for 240 col virtual screen - - long - b_lastln, // last line for JUMP - curlin, // pointer to current line - noteloc[26], // note locations 0-25 (or a-z) - lastLine, // last line in file - scroll_lin; // for scrolling commands - - BUFFPTR - curchr, // pointer to current character - scroll_chr; // for scroll commands - - MARK_RANGE mark; // marked portion of this - - BUFFPTR* _lines; - - long _nextLine; // index into line array - long _curLineBF; // current line for getXLine - long _maxLines; // size of line array - - ChrAttr _highlighter; - - // UnDo stuff - char* undoBuff; // one line of unkill - int undoCurcol; // column of current character - long undoCurlin; - bool undoPartialLine; // if a partial line saved - bool undoKillLast; - - - // objects used by editor - - vTextEdCmdInterp* _teCInt; - vTEConfirm* myConfirm; - - }; - - class V_EXPORT vTextEdCmdInterp // easy class to override - { - - public: - vTextEdCmdInterp(VCONST vTextEditor* textEd, VCONST vCmdWindow* cw); - virtual ~vTextEdCmdInterp(); - - - virtual int ProcessKey(vKey key, unsigned int shift); - virtual vTextEditor* te() VCONST { return _textEd; } - virtual vCmdWindow* cmdWin() VCONST { return _myCmdWindow; } - virtual void InitCmdInterp(); - virtual void CmdInterpHelp(); - virtual void MouseJump(int row, int col) { /* no-op by default */ } - - protected: - - long cmdCount; // how many times to repeat command - - int - countWait, // if building a count - metaChar, // the meta char for commands - metaWait; // if waiting on a meta command - - private: - vTextEditor* _textEd; - vCmdWindow* _myCmdWindow; - }; - -#endif -/* ************************************************************************ */ diff --git a/v/includew/v/vtextinc.h b/v/includew/v/vtextinc.h deleted file mode 100644 index 0c8297f..0000000 --- a/v/includew/v/vtextinc.h +++ /dev/null @@ -1,46 +0,0 @@ -//=============================================================== -// vtextinc.h - Button Command class - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VTEXTIN_H -#define VTEXTIN_H - -#include // We are derived from vcmd - - class V_EXPORT vCmdParent; - - class V_EXPORT vTextInCmd : public vCmd - { - - public: //---------------------------------------- public - - vTextInCmd(vCmdParent* dp, CommandObject* co); - - virtual ~vTextInCmd(); - - virtual void initialize(void); - - int GetTextIn(ItemVal id, char* str, int maxlen) VCONST; // to get the text back - - virtual void SetCmdVal(ItemVal val, ItemSetType st); - - virtual void SetCmdStr(VCONST char* str); - - virtual void CmdCallback(int id, WORD codeNotify); - - - protected: //--------------------------------------- protected - - - private: //--------------------------------------- private - char _msg[132]; - - }; -#endif diff --git a/v/includew/v/vthislst.h b/v/includew/v/vthislst.h deleted file mode 100644 index f737ef1..0000000 --- a/v/includew/v/vthislst.h +++ /dev/null @@ -1,40 +0,0 @@ -//=============================================================== -// vThislst.h - vTimer class functions - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== -#ifndef VTHISLST_H -#define VTHISLST_H -#include - - typedef unsigned long ThisId; - typedef struct thisList - { - ThisId id; - void* thisPtr; - thisList* next; - } thisList; - - class V_EXPORT vThisList - { - public: //---------------------------------------- public - vThisList(); - ~vThisList(); - - void Add(ThisId id, void* This); - void* GetThis(ThisId id) VCONST; - void Delete(ThisId id); - void* GetFirstThis() VCONST; - void* GetNextThis() VCONST; - - protected: //--------------------------------------- protected - private: //--------------------------------------- private - thisList* _list; - VMUTABLE thisList* _cur; - }; -#endif diff --git a/v/includew/v/vtimer.h b/v/includew/v/vtimer.h deleted file mode 100644 index 46febde..0000000 --- a/v/includew/v/vtimer.h +++ /dev/null @@ -1,41 +0,0 @@ -//=============================================================== -// vtimer.h - a timer class - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VTIMER_H -#define VTIMER_H -#include - - class V_EXPORT vTimer - { - friend void CALLBACK vTimerProc(HWND hwnd, UINT msg, UINT idTimer, DWORD dwTime); - public: //---------------------------------------- public - - vTimer(); // constructor - virtual ~vTimer(); // destructor - - virtual int TimerSet(long interval); - virtual void TimerStop(void); - virtual void TimerTick(void); - - - protected: //--------------------------------------- protected - - - private: //--------------------------------------- private - - void tick(void); // internal tick routine - - long _interval; // approx. how long in milliseconds between ticks - HWND _id; - - }; - -#endif diff --git a/v/includew/v/vutil.h b/v/includew/v/vutil.h deleted file mode 100644 index 3969cfd..0000000 --- a/v/includew/v/vutil.h +++ /dev/null @@ -1,26 +0,0 @@ -//=============================================================== -// vutil.h - V utility funcitons -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VUTIL_H -#define VUTIL_H -#include - extern V_EXPORT void LongToStr(long intg, char* str); // prototype - extern V_EXPORT void IntToStr(int intg, char* str); - extern V_EXPORT int vLblLen(const char *str); - extern V_EXPORT int vTextLen(const char *str, int& numLines); - extern V_EXPORT void vGetLocalTime(char* tm); - extern V_EXPORT void vGetLocalDate(char* tm); - extern V_EXPORT void ByteToStr(unsigned char byteval, char* str); - extern V_EXPORT long StrToLong(VCONST char* str); - extern V_EXPORT void vBeep(); - extern V_EXPORT int vGetcmdIdIndex(ItemVal cmdId, CommandObject *cmdObj); - extern V_EXPORT int vGetMenuIdIndex(ItemVal cmdId, vMenu *cmdObj); -#endif diff --git a/v/includew/v/vwin32.h b/v/includew/v/vwin32.h deleted file mode 100644 index cd29eb4..0000000 --- a/v/includew/v/vwin32.h +++ /dev/null @@ -1,44 +0,0 @@ -//=============================================================== -// vwin32.h - Special defs for Win32 - Windows version -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VWIN32_H -#define VWIN32_H - -#ifdef __WATCOMC__ -#ifdef __I86__ -#define NEED_VXCRACKERS -#endif -#endif - -#ifndef GET_WM_COMMAND_ID -#define NEED_VXCRACKERS -#endif - -#ifndef VWIN16 -#define MoveTo(a,b,c) MoveToEx(a,b,c,0) -#define SetWindowExt(a,b,c) SetWindowExtEx(a,b,c,0) -#define SetViewportExt(a,b,c) SetViewportExtEx(a,b,c,0) -#else -#ifdef NEED_VXCRACKERS -// For some reason, Watcom doesn't define these in windowsx.h -// on the 16 bit version - they are there for 32 bit. -// Neither does VCC 1.52! -#define GET_WM_COMMAND_ID(wp, lp) (wp) -#define GET_WM_HSCROLL_CODE(wp, lp) (wp) -#define GET_WM_HSCROLL_POS(wp, lp) LOWORD(lp) -#define GET_WM_HSCROLL_HWND(wp, lp) (HWND)HIWORD(lp) -#define GET_WM_VSCROLL_CODE(wp, lp) (wp) -#define GET_WM_VSCROLL_POS(wp, lp) LOWORD(lp) -#define GET_WM_VSCROLL_HWND(wp, lp) (HWND)HIWORD(lp) -#define GET_WM_COMMAND_CMD(wp, lp) HIWORD(lp) -#endif -#endif -#endif diff --git a/v/includew/v/vwindc.h b/v/includew/v/vwindc.h deleted file mode 100644 index 8f57fab..0000000 --- a/v/includew/v/vwindc.h +++ /dev/null @@ -1,110 +0,0 @@ -//=============================================================== -// vwindc.h: vWinDC class .h file - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VWINDC_H -#define VWINDC_H - -#include - - class V_EXPORT vIcon; - class V_EXPORT vColor; - - class V_EXPORT vWinDC : public vDC - { - - public: //---------------------------------------- public - - vWinDC(); - - virtual ~vWinDC(); - - // Drawing - - virtual void Clear(void){} - virtual void ClearRect(int left, int top, int width, int height){} - virtual void CopyFromMemoryDC(vMemoryDC* vmemdc, int destX, int destY, - int srcX = 0, int srcY = 0, int srcW = 0, int srcH = 0); // V:1.13 -#ifdef DRAWARC - virtual void DrawArc(int xx1, int yy1, int xx2, int yy2, int xxc, int yyc); -#endif - virtual void DrawAttrText(int x, int y, VCONST char* text, - const ChrAttr attr); - virtual void DrawText(int x, int y, VCONST char* text); - virtual void DrawEllipse(int x, int y, int width, int height); - virtual void DrawIcon(int x, int y, VCONST vIcon& icon); - virtual void DrawLine(int x, int y, int xend , int yend); - virtual void DrawColorPoints(int x, int y, int nPoints, vColor* pointList); - virtual void DrawLines(vLine* lineList, int count); - virtual void DrawLines(vPoint* points, int n); - virtual void DrawPoints (vPoint* pointList, int count); - virtual void DrawRectangles(vRect* rectList,int count); - - virtual void DrawPoint(int x, int y); - virtual void DrawPolygon(int n, vPoint points[], int fillStyle); - virtual void DrawRectangle(int x, int y, int width, int height); - virtual void DrawRoundedRectangle(int x, int y, - int width, int height, int radius); - virtual void DrawRubberLine(int x, int y, int xend, int yend); - virtual void DrawRubberEllipse(int x, int y, int width, int height); - virtual void DrawRubberPoint(int x, int y); - virtual void DrawRubberRectangle(int x, int y, int width, int height); - - virtual void SetFont(VCONST vFont& vf){} - // Appearance - - virtual void SetBackground(VCONST vColor& color){} - - virtual void SetPen(VCONST vPen& pen); - - virtual void SetBrush(VCONST vBrush& brush); - - virtual int TextHeight(int& asc, int& des) VCONST; - virtual int TextWidth(VCONST char* str) VCONST; - - virtual int BeginPrinting(){return 0;} - virtual void EndPrinting(){} - virtual void BeginPage(){} - virtual void EndPage(){} - virtual void SetPrinter(vPrinter& printer){} - - - protected: //--------------------------------------- protected - - unsigned long _canvasFG; // the foreground color - unsigned long _canvasBG; // the background color - - int _isPrinterDC; - - // These methods are to be used only internally and are assumed to - // be used correctly - there is no error checking. The idea is to have - // the canvas use BeginPaint/EndPaint for Redraw, and the drawing - // rotuines to use GetHDC and ReleaseHDC. - - virtual void GetHDC() VCONST {} - virtual void BeginPaint(){} - virtual void EndPaint(){} - virtual void ReleaseHDC() VCONST {} - - virtual int Scale(int x) { return (_hasScale) ? ((x*_Mult)/_Div) : x; } - - VMUTABLE HDC _hdc; // HDC to USE for draws - HDC _hdcPaint; // HDC set by begin paint - PAINTSTRUCT _ps; // paint struct used by begin paint - - HPEN _hpen; // Handle for pen - HBRUSH _hbrush; // Handle for brush - - private: //--------------------------------------- private - int _isWin32s; - - - }; -#endif diff --git a/v/includew/v/vwindow.h b/v/includew/v/vwindow.h deleted file mode 100644 index 4907be9..0000000 --- a/v/includew/v/vwindow.h +++ /dev/null @@ -1,124 +0,0 @@ -//=============================================================== -// vWindow.h - vWin class definitions - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VWINDOW_H -#define VWINDOW_H - -#include -#include // we are derived from vBaseWindow -#include // we are a friend of the app class -#include // need for SetWinCursor - -//#include // so we can get to GetMenuThis - - // We will allow a Button Bar and a Status Bar in Windows - - class V_EXPORT vPane; - - typedef struct PaneList - { - vPane* pane; // pointer to the pane object - PaneList *nextPL; // next pane - } PaneList; - - class V_EXPORT vWindow : public vBaseWindow - { - - friend class V_EXPORT vPane; - friend class V_EXPORT vMenuPane; - friend class V_EXPORT vCanvasPane; - - public: //---------------------------------------- public - vWindow(VCONST char *name = "+", int width = 0, int height = 0, - WindowType wintype = WINDOW); // Constructor - - vWindow(const vWindow&); // Copy Constructor - - virtual ~vWindow(); // Destructor - - // Methods to Override - - virtual void KeyIn(vKey keysym, unsigned int shift); // KeyIn method - virtual void MenuCommand(ItemVal id); - virtual void WindowCommand(ItemVal id, ItemVal retval, CmdType ctype); - virtual void WorkSlice(void) {}; // Work - default: no op - - // Utility Methods - - virtual void AddPane(vPane* add_pane); // add a pane to the window - int CreatedOK() { return _createdOK;} - virtual int GetValue(ItemVal id) VCONST; - virtual int GetTextIn(ItemVal id, char* val, int maxlen) VCONST; - virtual void RaiseWindow(void); // raise this window - virtual void SetValue(ItemVal id, int val, ItemSetType setType); - virtual void SetString(ItemVal id, VCONST char* str); - virtual void SetValueAll(ItemVal id, int val, ItemSetType setType); - virtual void SetStringAll(ItemVal id, VCONST char* str); - virtual void SetTitle(VCONST char* title); - void ShowPane(vPane* wpane, int OnOrOff) VCONST; - virtual void UpdateView(vWindow* sender, int hint, void* pHint); - - - virtual void GetPosition(int& left, int& top, int& right, - int& bottom) VCONST; - virtual void SetPosition(int left, int top); - - // Other Methods - - virtual void CloseWin(void); // callback for close button - - // Internal Methods - long MdiWindowProc(HWND hWnd, UINT message, - WPARAM wParam, LPARAM lParam); - - int getWinHeight() VCONST { return _WinHeight; } - int getWinWidth() VCONST { return _WinWidth; } - void setWinHeight(const int h) { _WinHeight = h; } - void setWinWidth(const int w) { _WinWidth = w; } - - protected: //--------------------------------------- protected - - int _WinHeight; // height of draw window - int _WinWidth; // width of draw window - - private: //--------------------------------------- private - - virtual void initialize(void); - void SetWinCursor(VCursor vcursor); - - PaneList* _paneList; // panes for this window - vPane* _menuPane; // our menu pane - - vCanvasPane* _canvasPane; // our one canvas pane - - vWindow* _NextWin; // link to next window - - void KeyInEV(unsigned int keycode, int map, int extended); - int _shiftKeyDown; - int _ctrlKeyDown; - - int _createdOK; - - HMENU _menuBar; - int _WindowMenuIndex; // number of the Windows menu - int _justActivated; // for mouse control - int _mouseDown; // to track mouse up/down - HCURSOR _cursor; // mouse cursor - - static int _numWindows; // how many total windows are up - - static vWindow* _WinList; // all windows - static HWND _curWin; - static HWND _prevWin; - - - }; -#endif diff --git a/v/includew/v/vwinprdc.h b/v/includew/v/vwinprdc.h deleted file mode 100644 index eeb228c..0000000 --- a/v/includew/v/vwinprdc.h +++ /dev/null @@ -1,56 +0,0 @@ -//=============================================================== -// vwinprdc.h: WinPrinterDC class .h file - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VWINPRDC_H -#define VWINPRDC_H - -#include -#include - - class V_EXPORT vWinPrinterDC : public vWinDC - { - - public: //---------------------------------------- public - - vWinPrinterDC(const int scalePrinting = 0); - - virtual ~vWinPrinterDC(); - - // Drawing - - virtual void SetBackground(VCONST vColor& color); - virtual void SetFont(VCONST vFont& vf); - - virtual int BeginPrinting(); - virtual void EndPrinting(); - virtual void BeginPage(); - virtual void EndPage(); - virtual void SetPrinter(vPrinter& printer); - - - protected: //--------------------------------------- protected - - // These methods are to be used only internally and are assumed to - // be used correctly - there is no error checking. The idea is to have - // the canvas use BeginPaint/EndPaint for Redraw, and the drawing - // rotuines to use GetHDC and ReleaseHDC. - - virtual void GetHDC() VCONST { _hdc = _printer.GetHDC(); } - virtual void BeginPaint() {} - virtual void EndPaint() {} - virtual void ReleaseHDC() VCONST { } - int _scalePrinting; - - private: //--------------------------------------- private - int _pages; - vPrinter _printer; // the printer - }; -#endif diff --git a/v/includew/v/vwinprtr.h b/v/includew/v/vwinprtr.h deleted file mode 100644 index c8d09b4..0000000 --- a/v/includew/v/vwinprtr.h +++ /dev/null @@ -1,87 +0,0 @@ -//=============================================================== -// vwinprtr.h: Windows Printer class .h file - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VWINPRTR_H -#define VWINPRTR_H - -#include -#include - -#define vPaperLetter 0 -#define vPaperLegal 1 -#define vPaperTabloid 2 -#define vPaperLedger 3 -#define vPaperStatement 4 -#define vPaperExecutive 5 -#define vPaperA3 6 -#define vPaperA4 7 -#define vPaperA5 8 -#define vPaperB4 9 -#define vPaperB5 10 -#define vPaperFolio 11 -#define vPaperQuarto 12 -#define vPaper10x14 13 - -#define vPaperDefault vPaperLetter // Index to default paper - - class V_EXPORT vWinPrinter - { - public: //---------------------------------------- public - vWinPrinter(); - virtual ~vWinPrinter(); - vWinPrinter(const vWinPrinter& pr); - - vWinPrinter& operator =(const vWinPrinter& pr); - - int GetHeight() VCONST {return _height;} - int GetWidth() VCONST {return _width;} - - VCONST char* GetDocName() VCONST {return _name;} - - int GetPortrait() VCONST {return _portrait;} - void SetPortrait(int p) {_portrait = p;} - - int GetUseColors() VCONST {return _useColor;} - void SetUseColors(int c) {_useColor = c;} - - int GetPaper() VCONST {return _paperType;} - char* GetPaperName(); - - int GetCopies() VCONST {return _copies;} - void SetCopies(int s) {_copies = s;} - - int GetToFile() VCONST {return _toFile;} - - int Setup(VCONST char* fn = 0); - - HDC GetHDC() VCONST { return _printhDC; } - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - - static int _instances; - HDC _printhDC; - - // Printer attributes - char* _name; // name of stream - - int _width; // width of printer - int _height; // height of printer - int _portrait; // true if portrait, else landscape - int _useColor; // true if printer supports colors - - int _paperType; - int _copies; - int _toFile; - }; - -#endif diff --git a/v/includew/v/vynreply.h b/v/includew/v/vynreply.h deleted file mode 100644 index 135376e..0000000 --- a/v/includew/v/vynreply.h +++ /dev/null @@ -1,39 +0,0 @@ -//=============================================================== -// vynreply.h - yes no dialog - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VYNREPLY_H -#define VYNREPLY_H -#include - - class V_EXPORT vApp; - class V_EXPORT vYNReplyDialog : protected vModalDialog - { - public: //---------------------------------------- public - vYNReplyDialog(VCONST vBaseWindow* bw, VCONST char* title = "Yes or No") : - vModalDialog(bw,title) {added = 0;} - vYNReplyDialog(VCONST vApp* aw, VCONST char* title = "Yes or No") : - vModalDialog(aw,title) { added = 0; } - ~vYNReplyDialog() {} - - int AskYN(VCONST char* msg); - - protected: //--------------------------------------- protected - - static CommandObject YNDialog[]; // dialog elements - - private: //--------------------------------------- private - - virtual void DialogCommand(ItemVal id, ItemVal val, CmdType ctype); - int added; - virtual void DialogDisplayed(); // TEH Dec97 - - }; -#endif diff --git a/v/includex/v/aw3d.h b/v/includex/v/aw3d.h deleted file mode 100644 index ed79d0a..0000000 --- a/v/includex/v/aw3d.h +++ /dev/null @@ -1,108 +0,0 @@ -/* -* $KK: ThreeD.h,v 0.3 92/11/04 xx:xx:xx keithley Exp $ -*/ - -/*********************************************************** -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, -and the Massachusetts Institute of Technology, Cambridge, Massachusetts. -Copyright 1992 by Kaleb Keithley - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the names of Digital, MIT, or Kaleb -Keithley not be used in advertising or publicity pertaining to distribution -of the software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ -/****************************************************************** -This code was taken directly from the Xaw3d distribution. -Several classes were used to make V look better. -The names of the classes have been changed to allow -standard Athena widgets to be used as well. - -I've not marked any of the changes specifically. - -Bruce Wampler - March 1, 1996 -******************************************************************/ - -#ifndef _XawThreeD_h -#define _XawThreeD_h - -/*********************************************************************** - * - * ThreeD Widget - * - ***********************************************************************/ - -#include - -/* Parameters: - - Name Class RepType Default Value - ---- ----- ------- ------------- - shadowWidth ShadowWidth Dimension 2 - topShadowPixel TopShadowPixel Pixel dynamic - bottomShadowPixel BottomShadowPixel Pixel dynamic - topShadowContrast TopShadowContrast Int 20 - bottomShadowContrast BottomShadowContrast Int 40 - userData UserData XtPointer NULL - beNiceToColormap BeNiceToColormap Boolean False - invertBorder InvertBorder Boolean False - -*/ - -#define XtNshadowWidth "shadowWidth" -#define XtCShadowWidth "ShadowWidth" -#define XtNtopShadowPixel "topShadowPixel" -#define XtCTopShadowPixel "TopShadowPixel" -#define XtNbottomShadowPixel "bottomShadowPixel" -#define XtCBottomShadowPixel "BottomShadowPixel" -#define XtNtopShadowContrast "topShadowContrast" -#define XtCTopShadowContrast "TopShadowContrast" -#define XtNbottomShadowContrast "bottomShadowContrast" -#define XtCBottomShadowContrast "BottomShadowContrast" -#define XtNbeNiceToColormap "beNiceToColormap" -#define XtCBeNiceToColormap "BeNiceToColormap" -#define XtNbeNiceToColourmap "beNiceToColormap" -#define XtCBeNiceToColourmap "BeNiceToColormap" -#define XtNinvertBorder "invertBorder" -#define XtCInvertBorder "InvertBorder" -#define XtNuserData "userData" -#define XtCUserData "UserData" - -typedef struct _ThreeDRec *ThreeDWidget; -typedef struct _ThreeDClassRec *ThreeDWidgetClass; - -extern WidgetClass threeDWidgetClass; - -_XFUNCPROTOBEGIN - -extern void Xaw3dComputeTopShadowRGB ( -#if NeedFunctionPrototypes - Widget /* new */, - XColor* /* xcol_out */ -#endif -); - -extern void Xaw3dComputeBottomShadowRGB ( -#if NeedFunctionPrototypes - Widget /* new */, - XColor* /* xcol_out */ -#endif -); - -_XFUNCPROTOEND - -#endif /* _XawThreeD_h */ diff --git a/v/includex/v/aw3dp.h b/v/includex/v/aw3dp.h deleted file mode 100644 index 14976a8..0000000 --- a/v/includex/v/aw3dp.h +++ /dev/null @@ -1,86 +0,0 @@ -/* -* $KK: ThreeDP.h,v 0.3 92/11/04 xx:xx:xx keithley Exp $ -*/ - -/*********************************************************** -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, -and the Massachusetts Institute of Technology, Cambridge, Massachusetts. -Copyright 1992 by Kaleb Keithley - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the names of Digital, MIT, or Kaleb -Keithley not be used in advertising or publicity pertaining to distribution -of the software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ -/****************************************************************** -This code was taken directly from the Xaw3d distribution. -Several classes were used to make V look better. -The names of the classes have been changed to allow -standard Athena widgets to be used as well. - -I've not marked any of the changes specifically. - -Bruce Wampler - March 1, 1996 -******************************************************************/ - -#ifndef _ThreeDP_h -#define _ThreeDP_h - -#include -#include - -typedef struct { - Dimension shadow_width; - Pixel top_shadow_pixel; - Pixel bot_shadow_pixel; - Pixmap top_shadow_pxmap; - Pixmap bot_shadow_pxmap; - int top_shadow_contrast; - int bot_shadow_contrast; - GC top_shadow_GC; - GC bot_shadow_GC; - XtPointer user_data; - Boolean be_nice_to_cmap; - Boolean invert_border; - } ThreeDPart; - -/* Full instance record declaration */ -typedef struct _ThreeDRec { - CorePart core; - Simple3dPart simple3d; - ThreeDPart threeD; - } ThreeDRec; - -typedef struct { - void (*shadowdraw)(); - } ThreeDClassPart; - -#define XtInheritXaw3dShadowDraw ((void (*)())_XtInherit) -#define XtInheritXaw3dShadowBoxDraw ((void (*)())_XtInherit) - -/* Full class record declaration. */ -typedef struct _ThreeDClassRec { - CoreClassPart core_class; - Simple3dClassPart simple3d_class; - ThreeDClassPart threeD_class; - } ThreeDClassRec; - -/* Class pointer. */ -extern ThreeDClassRec threeDClassRec; - - -#endif /* _ThreeDP_h */ diff --git a/v/includex/v/awcmd3d.h b/v/includex/v/awcmd3d.h deleted file mode 100644 index d2ab0b6..0000000 --- a/v/includex/v/awcmd3d.h +++ /dev/null @@ -1,129 +0,0 @@ -/* $XConsortium: Command.h,v 1.29 94/04/17 20:11:59 kaleb Exp $ */ - -/*********************************************************** - -Copyright (c) 1987, 1988, 1994 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ -/****************************************************************** -This code was taken directly from the Xaw3d distribution. -Several classes were used to make V look better. -The names of the classes have been changed to allow -standard Athena widgets to be used as well. - -I've not marked any of the changes specifically. - -Bruce Wampler - March 1, 1996 -******************************************************************/ - - -#ifndef _XawCommand3d_h -#define _XawCommand3d_h - -#include - -/* Command3d widget resources: - - Name Class RepType Default Value - ---- ----- ------- ------------- - accelerators Accelerators AcceleratorTable NULL - ancestorSensitive AncestorSensitive Boolean True - background Background Pixel XtDefaultBackground - backgroundPixmap Pixmap Pixmap XtUnspecifiedPixmap - bitmap Pixmap Pixmap None - borderColor BorderColor Pixel XtDefaultForeground - borderPixmap Pixmap Pixmap XtUnspecifiedPixmap - borderWidth BorderWidth Dimension 1 - callback Callback XtCallbackList NULL - colormap Colormap Colormap parent's colormap - cornerRoundPercent CornerRoundPercent Dimension 25 - cursor Cursor Cursor None - cursorName Cursor String NULL - depth Depth int parent's depth - destroyCallback Callback XtCallbackList NULL - encoding Encoding UnsignedChar XawTextEncoding8bit - font Font XFontStruct* XtDefaultFont - foreground Foreground Pixel XtDefaultForeground - height Height Dimension text height - highlightThickness Thickness Dimension 0 if shaped, else 2 - insensitiveBorder Insensitive Pixmap Gray - internalHeight Height Dimension 2 - internalWidth Width Dimension 4 - justify Justify XtJustify XtJustifyCenter - label Label String NULL - leftBitmap LeftBitmap Pixmap None - mappedWhenManaged MappedWhenManaged Boolean True - pointerColor Foreground Pixel XtDefaultForeground - pointerColorBackground Background Pixel XtDefaultBackground - resize Resize Boolean True - screen Screen Screen parent's Screen - sensitive Sensitive Boolean True - shapeStyle ShapeStyle ShapeStyle Rectangle - translations Translations TranslationTable see doc or source - width Width Dimension text width - x Position Position 0 - y Position Position 0 - -*/ - -#define XtNhighlightThickness "highlightThickness" - -#define XtNshapeStyle "shapeStyle" -#define XtCShapeStyle "ShapeStyle" -#define XtRShapeStyle "ShapeStyle" -#define XtNcornerRoundPercent "cornerRoundPercent" -#define XtCCornerRoundPercent "CornerRoundPercent" - -#define XawShapeRectangle XmuShapeRectangle -#define XawShapeOval XmuShapeOval -#define XawShapeEllipse XmuShapeEllipse -#define XawShapeRoundedRectangle XmuShapeRoundedRectangle - -extern WidgetClass command3dWidgetClass; - -typedef struct _Command3dClassRec *Command3dWidgetClass; -typedef struct _Command3dRec *Command3dWidget; - -#endif /* _XawCommand3d_h */ diff --git a/v/includex/v/awcmd3dp.h b/v/includex/v/awcmd3dp.h deleted file mode 100644 index 5516e77..0000000 --- a/v/includex/v/awcmd3dp.h +++ /dev/null @@ -1,151 +0,0 @@ -/* -* $XConsortium: CommandP.h,v 1.31 94/04/17 20:12:01 rws Exp $ -*/ - - -/*********************************************************** - -Copyright (c) 1987, 1988 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ -/****************************************************************** -This code was taken directly from the Xaw3d distribution. -Several classes were used to make V look better. -The names of the classes have been changed to allow -standard Athena widgets to be used as well. - -I've not marked any of the changes specifically. - -Bruce Wampler - March 1, 1996 -******************************************************************/ - - -/* - * CommandP.h - Private definitions for Command widget - * - */ - -#ifndef _XawCommandP3d_h -#define _XawCommandP3d_h - -#include -#include - -/*********************************************************************** - * - * Command Widget Private Data - * - ***********************************************************************/ - -typedef enum { - HighlightNone, /* Do not highlight. */ - HighlightWhenUnset, /* Highlight only when unset, this is - to preserve current command3d widget - functionality. */ - HighlightAlways /* Always highlight, lets the toggle widget - and other subclasses do the right thing. */ -} XtCommand3dHighlight; - -/************************************ - * - * Class structure - * - ***********************************/ - - - /* New fields for the Command3d widget class record */ -typedef struct _Command3dClass - { - int makes_compiler_happy; /* not used */ - } Command3dClassPart; - - /* Full class record declaration */ -typedef struct _Command3dClassRec { - CoreClassPart core_class; - Simple3dClassPart simple3d_class; - ThreeDClassPart threeD_class; - Label3dClassPart label3d_class; - Command3dClassPart command3d_class; -} Command3dClassRec; - -extern Command3dClassRec command3dClassRec; - -/*************************************** - * - * Instance (widget) structure - * - **************************************/ - - /* New fields for the Command3d widget record */ -typedef struct { - /* resources */ - Dimension highlight_thickness; - XtCallbackList callbacks; - - /* private state */ - Pixmap gray_pixmap; - GC normal_GC; - GC inverse_GC; - Boolean set; - XtCommand3dHighlight highlighted; - /* more resources */ - int shape_style; - Dimension corner_round; -} Command3dPart; - - -/* XtEventsPtr eventTable;*/ - - - /* Full widget declaration */ -typedef struct _Command3dRec { - CorePart core; - Simple3dPart simple3d; - ThreeDPart threeD; - Label3dPart label3d; - Command3dPart command3d; -} Command3dRec; - -#endif /* _XawCommand3dP_h */ diff --git a/v/includex/v/awlbl3d.h b/v/includex/v/awlbl3d.h deleted file mode 100644 index cd88018..0000000 --- a/v/includex/v/awlbl3d.h +++ /dev/null @@ -1,139 +0,0 @@ -/* $XConsortium: Label.h,v 1.34 94/04/17 20:12:13 rws Exp $ */ - -/*********************************************************** - -Copyright (c) 1987, 1988, 1994 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ -/****************************************************************** -This code was taken directly from the Xaw3d distribution. -Several classes were used to make V look better. -The names of the classes have been changed to allow -standard Athena widgets to be used as well. - -I've not marked any of the changes specifically. - -Bruce Wampler - March 1, 1996 -******************************************************************/ - -#ifndef _XawLabel3d_h -#define _XawLabel3d_h - -/*********************************************************************** - * - * Label Widget - * - ***********************************************************************/ - -#include - -/* Resources: - - Name Class RepType Default Value - ---- ----- ------- ------------- - background Background Pixel XtDefaultBackground - bitmap Pixmap Pixmap None - border BorderColor Pixel XtDefaultForeground - borderWidth BorderWidth Dimension 1 - cursor Cursor Cursor None - cursorName Cursor String NULL - destroyCallback Callback XtCallbackList NULL - encoding Encoding unsigned char XawTextEncoding8bit - font Font XFontStruct* XtDefaultFont - foreground Foreground Pixel XtDefaultForeground - height Height Dimension text height - insensitiveBorder Insensitive Pixmap Gray - internalHeight Height Dimension 2 - internalWidth Width Dimension 4 - justify Justify XtJustify XtJustifyCenter - label3d Label3d String NULL - leftBitmap LeftBitmap Pixmap None - mappedWhenManaged MappedWhenManaged Boolean True - pointerColor Foreground Pixel XtDefaultForeground - pointerColorBackground Background Pixel XtDefaultBackground - resize Resize Boolean True - sensitive Sensitive Boolean True - width Width Dimension text width - x Position Position 0 - y Position Position 0 - -*/ - -#define XawTextEncoding8bit 0 -#define XawTextEncodingChar2b 1 - -#define XtNleftBitmap "leftBitmap" -#define XtCLeftBitmap "LeftBitmap" -#define XtNencoding "encoding" -#define XtCEncoding "Encoding" - -#ifndef XtNfontSet -#define XtNfontSet "fontSet" -#endif - -#ifndef XtCFontSet -#define XtCFontSet "FontSet" -#endif - -#ifndef _XtStringDefs_h_ -#define XtNbitmap "bitmap" -#define XtNforeground "foreground" -#define XtNlabel3d "label3d" -#define XtNfont "font" -#define XtNinternalWidth "internalWidth" -#define XtNinternalHeight "internalHeight" -#define XtNresize "resize" -#define XtCResize "Resize" -#define XtCBitmap "Bitmap" -#endif - -/* Class record constants */ - -extern WidgetClass label3dWidgetClass; - -typedef struct _Label3dClassRec *Label3dWidgetClass; -typedef struct _Label3dRec *Label3dWidget; - -#endif /* _XawLabel3d_h */ diff --git a/v/includex/v/awlbl3dp.h b/v/includex/v/awlbl3dp.h deleted file mode 100644 index c309359..0000000 --- a/v/includex/v/awlbl3dp.h +++ /dev/null @@ -1,141 +0,0 @@ -/* -* $XConsortium: LabelP.h,v 1.29 94/04/17 20:12:14 kaleb Exp $ -*/ - - -/*********************************************************** - -Copyright (c) 1987, 1988, 1994 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -/****************************************************************** -This code was taken directly from the Xaw3d distribution. -Several classes were used to make V look better. -The names of the classes have been changed to allow -standard Athena widgets to be used as well. - -I've not marked any of the changes specifically. - -Bruce Wampler - March 1, 1996 -******************************************************************/ -/* - * LabelP.h - Private definitions for Label widget - * - */ - -#ifndef _XawLabelP3d_h -#define _XawLabelP3d_h - -/*********************************************************************** - * - * Label Widget Private Data - * - ***********************************************************************/ - -#include -#include - -/* New fields for the Label widget class record */ - -typedef struct {int foo;} Label3dClassPart; - -/* Full class record declaration */ -typedef struct _Label3dClassRec { - CoreClassPart core_class; - Simple3dClassPart simple3d_class; - ThreeDClassPart threeD_class; - Label3dClassPart label3d_class; -} Label3dClassRec; - -extern Label3dClassRec label3dClassRec; - -/* New fields for the Label3d widget record */ -typedef struct { - /* resources */ - Pixel foreground; - XFontStruct *font; - XFontSet fontset; - char *label3d; - XtJustify justify; - Dimension internal_width; - Dimension internal_height; - Pixmap pixmap; - Boolean resize; - unsigned char encoding; - Pixmap left_bitmap; - - /* private state */ - GC normal_GC; - GC gray_GC; - Pixmap stipple; - Position label3d_x; - Position label3d_y; - Dimension label3d_width; - Dimension label3d_height; - Dimension label3d_len; - int lbm_y; /* where in label3d */ - unsigned int lbm_width, lbm_height; /* size of pixmap */ -} Label3dPart; - - -/**************************************************************** - * - * Full instance record declaration - * - ****************************************************************/ - -typedef struct _Label3dRec { - CorePart core; - Simple3dPart simple3d; - ThreeDPart threeD; - Label3dPart label3d; -} Label3dRec; - -#define LEFT_OFFSET(lw) ((lw)->label3d.left_bitmap \ - ? (lw)->label3d.lbm_width + (lw)->label3d.internal_width \ - : 0) - -#endif /* _XawLabel3dP_h */ diff --git a/v/includex/v/awscl3d.h b/v/includex/v/awscl3d.h deleted file mode 100644 index fb5f8df..0000000 --- a/v/includex/v/awscl3d.h +++ /dev/null @@ -1,163 +0,0 @@ -/* $XConsortium: Scrollbar.h,v 1.8 94/04/17 20:12:41 converse Exp $ */ - - -/*********************************************************** - -Copyright (c) 1987, 1988 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ -/****************************************************************** -This code was taken directly from the Xaw3d distribution. -Several classes were used to make V look better. -The names of the classes have been changed to allow -standard Athena widgets to be used as well. - -I've not marked any of the changes specifically. - -Bruce Wampler - March 1, 1996 -******************************************************************/ - -#ifndef _Scrollbar3d_h -#define _Scrollbar3d_h - -/**************************************************************** - * - * Scrollbar3d Widget - * - ****************************************************************/ - -#include -#include - -/* Scrollbar3d resources: - - Name Class RepType Default Value - ---- ----- ------- ------------- - accelerators Accelerators AcceleratorTable NULL - ancestorSensitive AncestorSensitive Boolean True - background Background Pixel XtDefaultBackground - backgroundPixmap Pixmap Pixmap XtUnspecifiedPixmap - borderColor BorderColor Pixel XtDefaultForeground - borderPixmap Pixmap Pixmap XtUnspecifiedPixmap - borderWidth BorderWidth Dimension 1 - colormap Colormap Colormap parent's colormap - cursor Cursor Cursor None - cursorName Cursor String NULL - depth Depth int parent's depth - destroyCallback Callback XtCallbackList NULL - foreground Foreground Pixel XtDefaultForeground - height Height Dimension length or thickness - insensitiveBorder Insensitive Pixmap GreyPixmap - jumpProc Callback XtCallbackList NULL - length Length Dimension 1 - mappedWhenManaged MappedWhenManaged Boolean True - minimumThumb MinimumThumb Dimension 7 - orientation Orientation XtOrientation XtorientVertical - pointerColor Foreground Pixel XtDefaultForeground - pointerColorBackground Background Pixel XtDefaultBackground - screen Screen Screen parent's screen - scrollDCursor Cursor Cursor XC_sb_down_arrow - scrollHCursor Cursor Cursor XC_sb_h_double_arrow - scrollLCursor Cursor Cursor XC_sb_left_arrow - scrollProc Callback XtCallbackList NULL - scrollRCursor Cursor Cursor XC_sb_right_arrow - scrollUCursor Cursor Cursor XC_sb_up_arrow - scrollVCursor Cursor Cursor XC_sb_v_double_arrow - scrollbar3dBackground Scrollbar3dBackground Pixel XtDefaultForeground - sensitive Sensitive Boolean True - shown Shown Float 0.0 - thickness Thickness Dimension 14 - thumb Thumb Bitmap GreyPixmap - thumbProc Callback XtCallbackList NULL - topOfThumb TopOfThumb Float 0.0 - pickTop PickTop Boolean False - pushThumb PushThumb Boolean True - translations Translations TranslationTable see source or doc - width Width Dimension thickness or length - x Position Position 0 - y Position Position 0 - -*/ - -/* - * Most things we need are in StringDefs.h - */ - -#define XtCMinimumThumb "MinimumThumb" -#define XtCShown "Shown" -#define XtCTopOfThumb "TopOfThumb" -#define XtCScrollbar3dBackground "Scrollbar3dBackground" -#define XtCPickTop "PickTop" -#define XtCPushThumb "PushThumb" - -#define XtNminimumThumb "minimumThumb" -#define XtNtopOfThumb "topOfThumb" -#define XtNscrollbar3dBackground "scrollbar3dBackground" -#define XtNpickTop "pickTop" -#define XtNpushThumb "pushThumb" - -typedef struct _Scrollbar3dRec *Scrollbar3dWidget; -typedef struct _Scrollbar3dClassRec *Scrollbar3dWidgetClass; - -extern WidgetClass scrollbar3dWidgetClass; - -_XFUNCPROTOBEGIN - -extern void XawScrollbar3dSetThumb( -#if NeedFunctionPrototypes - Widget /* scrollbar3d */, -#if NeedWidePrototypes - /* float */ double /* top */, - /* float */ double /* shown */ -#else - float /* top */, - float /* shown */ -#endif -#endif -); - -_XFUNCPROTOEND - -#endif /* _Scrollbar3d_h */ diff --git a/v/includex/v/awscl3dp.h b/v/includex/v/awscl3dp.h deleted file mode 100644 index 3f2233b..0000000 --- a/v/includex/v/awscl3dp.h +++ /dev/null @@ -1,125 +0,0 @@ -/* MODIFIED ATHENA SCROLLBAR (USING ARROWHEADS AT ENDS OF TRAVEL) */ -/* Modifications Copyright 1992 by Mitch Trachtenberg */ -/* Rights, permissions, and disclaimer of warranty are as in the */ -/* DEC and MIT notice below. See usage warning in .c file. */ -/* - * $XConsortium: ScrollbarP.h,v 1.3 94/04/17 20:12:42 jim Exp $ - */ - - -/*********************************************************** - -Copyright (c) 1987, 1988 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ -/****************************************************************** -This code was taken directly from the Xaw3d distribution. -Several classes were used to make V look better. -The names of the classes have been changed to allow -standard Athena widgets to be used as well. - -I've not marked any of the changes specifically. - -Bruce Wampler - March 1, 1996 -******************************************************************/ - -#ifndef _Scrollbar3dP_h -#define _Scrollbar3dP_h - -#include -#include - -typedef struct { - /* public */ - Pixel foreground; /* thumb foreground color */ - XtOrientation orientation; /* horizontal or vertical */ - XtCallbackList scrollProc; /* proportional scroll */ - XtCallbackList thumbProc; /* jump (to position) scroll */ - XtCallbackList jumpProc; /* same as thumbProc but pass data by ref */ - Pixmap thumb; /* thumb color */ - Pixel background; /* background color */ - Cursor verCursor; /* scroll vertical cursor */ - Cursor horCursor; /* scroll horizontal cursor */ - float top; /* What percent is above the win's top */ - float shown; /* What percent is shown in the win */ - Dimension length; /* either height or width */ - Dimension thickness; /* either width or height */ - Dimension min_thumb; /* minium size for the thumb. */ - float picked; /* How much of the thumb is picked * - * when scrolling starts */ - - /* private */ - XtIntervalId timer_id; /* autorepeat timer; remove on destruction */ - char scroll_mode; /* 0:none 1:up/back 2:track 3:down/forward */ - Cursor inactiveCursor; /* the normal cursor for scrollbar3d */ - char direction; /* a scroll has started; which direction */ - GC gc; /* a (shared) gc for foreground */ - GC bgc; /* a (shared) gc for background */ - Position topLoc; /* Pixel that corresponds to top */ - Dimension shownLength; /* Num pixels corresponding to shown */ - Boolean pick_top; /* pick thumb at top or anywhere */ - Boolean push_thumb; /* push thumb in or not */ - -} Scrollbar3dPart; - -typedef struct _Scrollbar3dRec { - CorePart core; - Simple3dPart simple3d; - ThreeDPart threeD; - Scrollbar3dPart scrollbar3d; -} Scrollbar3dRec; - -typedef struct {int empty;} Scrollbar3dClassPart; - -typedef struct _Scrollbar3dClassRec { - CoreClassPart core_class; - Simple3dClassPart simple3d_class; - ThreeDClassPart threeD_class; - Scrollbar3dClassPart scrollbar3d_class; -} Scrollbar3dClassRec; - -extern Scrollbar3dClassRec scrollbar3dClassRec; - -#endif /* _Scrollbar3dP_h */ diff --git a/v/includex/v/awsim3d.h b/v/includex/v/awsim3d.h deleted file mode 100644 index e3ae625..0000000 --- a/v/includex/v/awsim3d.h +++ /dev/null @@ -1,113 +0,0 @@ -/* $XConsortium: Simple.h,v 1.14 94/04/17 20:12:44 rws Exp $ */ - -/*********************************************************** - -Copyright (c) 1987, 1988, 1994 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ -/****************************************************************** -This code was taken directly from the Xaw3d distribution. -Several classes were used to make V look better. -The names of the classes have been changed to allow -standard Athena widgets to be used as well. - -I've not marked any of the changes specifically. - -Bruce Wampler - March 1, 1996 -******************************************************************/ - -#ifndef _Simple3d_h -#define _Simple3d_h - -#include - -/**************************************************************** - * - * Simple3d widgets - * - ****************************************************************/ - -/* Resources: - - Name Class RepType Default Value - ---- ----- ------- ------------- - background Background Pixel XtDefaultBackground - border BorderColor Pixel XtDefaultForeground - borderWidth BorderWidth Dimension 1 - cursor Cursor Cursor None - cursorName Cursor String NULL - destroyCallback Callback Pointer NULL - height Height Dimension 0 - insensitiveBorder Insensitive Pixmap Gray - mappedWhenManaged MappedWhenManaged Boolean True - pointerColor Foreground Pixel XtDefaultForeground - pointerColorBackground Background Pixel XtDefaultBackground - sensitive Sensitive Boolean True - width Width Dimension 0 - x Position Position 0 - y Position Position 0 - -*/ - -#define XtNcursor "cursor" -#define XtNcursorName "cursorName" -#define XtNinsensitiveBorder "insensitiveBorder" - -#define XtCInsensitive "Insensitive" - -#ifndef XtCInternational -#define XtCInternational "International" -#endif - -#ifndef XtNinternational -#define XtNinternational "international" -#endif - -typedef struct _Simple3dClassRec *Simple3dWidgetClass; -typedef struct _Simple3dRec *Simple3dWidget; - -extern WidgetClass simple3dWidgetClass; - -#endif /* _Simple3d_h */ diff --git a/v/includex/v/awsim3dp.h b/v/includex/v/awsim3dp.h deleted file mode 100644 index 3cf5aad..0000000 --- a/v/includex/v/awsim3dp.h +++ /dev/null @@ -1,97 +0,0 @@ -/*********************************************************** - - $XConsortium: SimpleP.h,v 1.12 94/04/17 20:12:47 kaleb Exp $ - - -Copyright (c) 1987, 1988, 1994 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ -/****************************************************************** -This code was taken directly from the Xaw3d distribution. -Several classes were used to make V look better. -The names of the classes have been changed to allow -standard Athena widgets to be used as well. - -I've not marked any of the changes specifically. - -Bruce Wampler - March 1, 1996 -******************************************************************/ - -#ifndef _Simple3dP_h -#define _Simple3dP_h - - -#include - -typedef struct { - Boolean (*change_sensitive)(/* widget */); -} Simple3dClassPart; - -#define XtInheritChangeSensitive ((Boolean (*)())_XtInherit) - -typedef struct _Simple3dClassRec { - CoreClassPart core_class; - Simple3dClassPart simple3d_class; -} Simple3dClassRec; - -extern Simple3dClassRec simple3dClassRec; - -typedef struct { - /* resources */ - Cursor cursor; - Pixmap insensitive_border; - String cursor_name; /* cursor specified by name. */ - - Pixel pointer_fg, pointer_bg; /* Pointer colors. */ - Boolean international; - /* private state */ -} Simple3dPart; - -typedef struct _Simple3dRec { - CorePart core; - Simple3dPart simple3d; -} Simple3dRec; - -#endif /* _Simple3dP_h */ diff --git a/v/includex/v/awsld3d.h b/v/includex/v/awsld3d.h deleted file mode 100644 index e0c8cd9..0000000 --- a/v/includex/v/awsld3d.h +++ /dev/null @@ -1,167 +0,0 @@ -/* $XConsortium: Slider.h,v 1.8 94/04/17 20:12:41 converse Exp $ */ - - -/*********************************************************** - -Copyright (c) 1987, 1988 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ -/****************************************************************** -This code was taken directly from the Xaw3d distribution. -Several classes were used to make V look better. -The names of the classes have been changed to allow -standard Athena widgets to be used as well. - -I've not marked any of the changes specifically. - -Bruce Wampler - March 1, 1996 -******************************************************************/ - -#ifndef _Slider3d_h -#define _Slider3d_h - -/**************************************************************** - * - * Slider3d Widget - * - ****************************************************************/ - -#include -#include - -/* Slider3d resources: - - Name Class RepType Default Value - ---- ----- ------- ------------- - accelerators Accelerators AcceleratorTable NULL - ancestorSensitive AncestorSensitive Boolean True - background Background Pixel XtDefaultBackground - backgroundPixmap Pixmap Pixmap XtUnspecifiedPixmap - borderColor BorderColor Pixel XtDefaultForeground - borderPixmap Pixmap Pixmap XtUnspecifiedPixmap - borderWidth BorderWidth Dimension 1 - colormap Colormap Colormap parent's colormap - cursor Cursor Cursor None - cursorName Cursor String NULL - depth Depth int parent's depth - destroyCallback Callback XtCallbackList NULL - foreground Foreground Pixel XtDefaultForeground - height Height Dimension length or thickness - insensitiveBorder Insensitive Pixmap GreyPixmap - jumpProc Callback XtCallbackList NULL - length Length Dimension 1 - mappedWhenManaged MappedWhenManaged Boolean True - minimumThumb MinimumThumb Dimension 7 - orientation Orientation XtOrientation XtorientVertical - pointerColor Foreground Pixel XtDefaultForeground - pointerColorBackground Background Pixel XtDefaultBackground - screen Screen Screen parent's screen - scrollDCursor Cursor Cursor XC_sb_down_arrow - scrollHCursor Cursor Cursor XC_sb_h_double_arrow - scrollLCursor Cursor Cursor XC_sb_left_arrow - scrollProc Callback XtCallbackList NULL - scrollRCursor Cursor Cursor XC_sb_right_arrow - scrollUCursor Cursor Cursor XC_sb_up_arrow - scrollVCursor Cursor Cursor XC_sb_v_double_arrow - slider3dBackground Slider3dBackground Pixel XtDefaultForeground - sensitive Sensitive Boolean True - shown Shown Float 0.0 - thickness Thickness Dimension 14 - thumb Thumb Bitmap GreyPixmap - thumbProc Callback XtCallbackList NULL - topOfThumb TopOfThumb Float 0.0 - pickTop PickTop Boolean False - pushThumb PushThumb Boolean True - translations Translations TranslationTable see source or doc - width Width Dimension thickness or length - x Position Position 0 - y Position Position 0 - -*/ - -/* - * Most things we need are in StringDefs.h - */ - -#define XtCMinimumThumb "MinimumThumb" -#define XtCShown "Shown" -#define XtCTopOfThumb "TopOfThumb" -#define XtCSlider3dBackground "Slider3dBackground" -#define XtCIsProgress "IsProgress" -#define XtCProgressVal "ProgressVal" -#define XtCShowProgressVal "ShowProgressVal" -#define XtCUsePercent "UsePercent" - -#define XtNminimumThumb "minimumThumb" -#define XtNtopOfThumb "topOfThumb" -#define XtNslider3dBackground "slider3dBackground" -#define XtNisProgress "isProgress" -#define XtNprogressVal "progressVal" -#define XtNshowProgressVal "showProgressVal" -#define XtNusePercent "usePercent" - -typedef struct _Slider3dRec *Slider3dWidget; -typedef struct _Slider3dClassRec *Slider3dWidgetClass; - -extern WidgetClass slider3dWidgetClass; - -_XFUNCPROTOBEGIN - -extern void XawSlider3dSetThumb( -#if NeedFunctionPrototypes - Widget /* slider3d */, -#if NeedWidePrototypes - /* float */ double /* top */, - /* float */ double /* shown */ -#else - float /* top */, - float /* shown */ -#endif -#endif -); - -_XFUNCPROTOEND - -#endif /* _Slider3d_h */ diff --git a/v/includex/v/awsld3dp.h b/v/includex/v/awsld3dp.h deleted file mode 100644 index dccbd7f..0000000 --- a/v/includex/v/awsld3dp.h +++ /dev/null @@ -1,125 +0,0 @@ -/* MODIFIED ATHENA SCROLLBAR (USING ARROWHEADS AT ENDS OF TRAVEL) */ -/* Modifications Copyright 1992 by Mitch Trachtenberg */ -/* Rights, permissions, and disclaimer of warranty are as in the */ -/* DEC and MIT notice below. See usage warning in .c file. */ -/* - * $XConsortium: SliderP.h,v 1.3 94/04/17 20:12:42 jim Exp $ - */ - - -/*********************************************************** - -Copyright (c) 1987, 1988 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ -/****************************************************************** -This code was taken directly from the Xaw3d distribution. -Several classes were used to make V look better. -The names of the classes have been changed to allow -standard Athena widgets to be used as well. - -I've not marked any of the changes specifically. - -Bruce Wampler - March 1, 1996 -******************************************************************/ - -#ifndef _Slider3dP_h -#define _Slider3dP_h - -#include -#include - -typedef struct { - /* public */ - Pixel foreground; /* thumb foreground color */ - XtOrientation orientation; /* horizontal or vertical */ - XtCallbackList scrollProc; /* proportional scroll */ - XtCallbackList thumbProc; /* jump (to position) scroll */ - XtCallbackList jumpProc; /* same as thumbProc but pass data by ref */ - Pixmap thumb; /* thumb color */ - Pixel background; /* background color */ - Cursor verCursor; /* scroll vertical cursor */ - Cursor horCursor; /* scroll horizontal cursor */ - float top; /* What percent is above the win's top */ - float shown; /* What percent is shown in the win */ - Dimension length; /* either height or width */ - Dimension thickness; /* either width or height */ - Dimension min_thumb; /* minium size for the thumb. */ - float picked; /* How much of the thumb is picked * - * when scrolling starts */ - Dimension progressVal; /* value for progress */ - Boolean isProgress; /* if is progress bar */ - Boolean usePercent; /* if have percent in progress label */ - Boolean showProgressVal; /* if want to show the progress value */ - - /* private */ - Cursor inactiveCursor; /* the normal cursor for slider3d */ - char direction; /* a scroll has started; which direction */ - GC gc; /* a (shared) gc for foreground */ - GC bgc; /* a (shared) gc for background */ - Position topLoc; /* Pixel that corresponds to top */ - Dimension shownLength; /* Num pixels corresponding to shown */ - -} Slider3dPart; - -typedef struct _Slider3dRec { - CorePart core; - Simple3dPart simple3d; - ThreeDPart threeD; - Slider3dPart slider3d; -} Slider3dRec; - -typedef struct {int empty;} Slider3dClassPart; - -typedef struct _Slider3dClassRec { - CoreClassPart core_class; - Simple3dClassPart simple3d_class; - ThreeDClassPart threeD_class; - Slider3dClassPart slider3d_class; -} Slider3dClassRec; - -extern Slider3dClassRec slider3dClassRec; - -#endif /* _Slider3dP_h */ diff --git a/v/includex/v/awtog3d.h b/v/includex/v/awtog3d.h deleted file mode 100644 index 7f34b8b..0000000 --- a/v/includex/v/awtog3d.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * $XConsortium: Toggle.h,v 1.16 94/04/17 20:13:19 kaleb Exp $ - * -Copyright (c) 1989, 1994 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - */ - -/* - * ToggleP.h - Private definitions for Toggle widget - * - * Author: Chris D. Peterson - * MIT X Consortium - * kit@expo.lcs.mit.edu - * - * Date: January 12, 1989 - */ - -#ifndef _XawToggle3d_h -#define _XawToggle3d_h - -/*********************************************************************** - * - * Toggle Widget - * - ***********************************************************************/ - -#include - -/* Resources: - - Name Class RepType Default Value - ---- ----- ------- ------------- - state State Boolean Off - - background Background Pixel XtDefaultBackground - bitmap Pixmap Pixmap None - border BorderColor Pixel XtDefaultForeground - borderWidth BorderWidth Dimension 1 - callback Callback Pointer NULL - cursor Cursor Cursor None - destroyCallback Callback Pointer NULL - font Font XFontStructx* XtDefaultFont - foreground Foreground Pixel XtDefaultForeground - height Height Dimension text height - highlightThickness Thickness Dimension 2 - insensitiveBorder Insensitive Pixmap Gray - internalHeight Height Dimension 2 - internalWidth Width Dimension 4 - justify Justify XtJustify XtJustifyCenter - label Label String NULL - mappedWhenManaged MappedWhenManaged Boolean True - resize Resize Boolean True - sensitive Sensitive Boolean True - width Width Dimension text width - x Position Position 0 - y Position Position 0 - - -*/ - -/* - * These should be in StringDefs.h but aren't so we will define - * them here if they are needed. - */ - - -#define XtCWidget "Widget" -#define XtCState "State" - -#ifndef _XtStringDefs_h_ -#define XtRWidget "Widget" -#endif - -#define XtNstate "state" - -extern WidgetClass toggle3dWidgetClass; - -typedef struct _Toggle3dClassRec *Toggle3dWidgetClass; -typedef struct _Toggle3dRec *Toggle3dWidget; - -#endif /* _XawToggle3d_h */ diff --git a/v/includex/v/awtog3dp.h b/v/includex/v/awtog3dp.h deleted file mode 100644 index 2a0bc74..0000000 --- a/v/includex/v/awtog3dp.h +++ /dev/null @@ -1,102 +0,0 @@ -/* $XConsortium: ToggleP.h,v 1.9 94/04/17 20:13:19 converse Exp $ */ - -/* - -Copyright (c) 1989 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - -*/ - -/* - * ToggleP.h - Private definitions for Toggle widget - * - * Author: Chris D. Peterson - * MIT X Consortium - * kit@expo.lcs.mit.edu - * - * Date: January 12, 1989 - * - */ - -#ifndef _XawToggleP_h -#define _XawToggleP_h - -#include -#include - -/*********************************************************************** - * - * Toggle Widget Private Data - * - ***********************************************************************/ - -#define streq(a, b) ( strcmp((a), (b)) == 0 ) - -/************************************ - * - * Class structure - * - ***********************************/ - - /* New fields for the Toggle widget class record */ -typedef struct _Toggle3dClass { - XtActionProc Set; - XtActionProc Unset; - XtPointer extension; -} Toggle3dClassPart; - - /* Full class record declaration */ -typedef struct _Toggle3dClassRec { - CoreClassPart core_class; - Simple3dClassPart simple3d_class; - ThreeDClassPart threeD_class; - Label3dClassPart label3d_class; - Command3dClassPart command3d_class; - Toggle3dClassPart toggle3d_class; -} Toggle3dClassRec; - -extern Toggle3dClassRec toggle3dClassRec; - -/*************************************** - * - * Instance (widget) structure - * - **************************************/ - - /* New fields for the Toggle widget record */ -typedef struct { - /* resources */ - Widget widget; -} Toggle3dPart; - - /* Full widget declaration */ -typedef struct _Toggle3dRec { - CorePart core; - Simple3dPart simple3d; - ThreeDPart threeD; - Label3dPart label3d; - Command3dPart command3d; - Toggle3dPart toggle3d; -} Toggle3dRec; - -#endif /* _XawToggleP_h */ diff --git a/v/includex/v/canvas.h b/v/includex/v/canvas.h deleted file mode 100644 index ee911b4..0000000 --- a/v/includex/v/canvas.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef CANVAS_H -#define CANVAS_H - -/*********************************************************************** - - canvas Widget (subclass of CompositeClass) - - Copyright (C) 1995 Bruce E. Wampler - - This file is part of the V C++ GUI Framework, and is covered - under the terms of the GNU Library General Public License, - Version 2. This library has NO WARRANTY. See the source file - vapp.cxx for more complete information about license terms. - - ***********************************************************************/ - -/* Parameters: - - Name Class RepType Default Value - ---- ----- ------- ------------- - background Background Pixel XtDefaultBackground - border BorderColor Pixel XtDefaultForeground - borderWidth BorderWidth Dimension 1 - destroyCallback Callback Pointer NULL - hSpace HSpace Dimension 4 - height Height Dimension 0 - mappedWhenManaged MappedWhenManaged Boolean True - vSpace VSpace Dimension 4 - width Width Dimension 0 - x Position Position 0 - y Position Position 0 - -*/ - - -/* Class record constants */ - - typedef struct _CanvasClassRec *CanvasWidgetClass; - typedef struct _CanvasRec *CanvasWidget; - - extern WidgetClass canvasWidgetClass; - -#endif diff --git a/v/includex/v/canvasp.h b/v/includex/v/canvasp.h deleted file mode 100644 index 6a690fa..0000000 --- a/v/includex/v/canvasp.h +++ /dev/null @@ -1,59 +0,0 @@ -/* =============================================================== - canvasp.h - Private definitions for canvas widget - - Copyright (C) 1995,1996 Bruce E. Wampler - - This file is part of the V C++ GUI Framework, and is covered - under the terms of the GNU Library General Public License, - Version 2. This library has NO WARRANTY. See the source file - vapp.cxx for more complete information about license terms. -=============================================================== */ - -#ifndef CANVASP_H -#define CANVASP_H - -#include - -#include - -/* New fields for the canvas widget class record */ - typedef struct _CanvasClass - { - int empty; /* need something */ - } CanvasClassPart; - -/* Full class record declaration */ - typedef struct _CanvasClassRec - { - CoreClassPart core_class; - CompositeClassPart composite_class; - CanvasClassPart canvas_class; - } CanvasClassRec; - - extern CanvasClassRec canvasClassRec; - -/* New fields for the canvas widget record */ - typedef struct - { - XtCallbackList callback; /* app installed callbacks */ - Dimension h_space, v_space; - Dimension preferred_width, preferred_height; - Dimension last_query_width, last_query_height; - XtGeometryMask last_query_mode; - } CanvasPart; - - -/**************************************************************** - - Full instance record declaration - - ****************************************************************/ - - typedef struct _CanvasRec - { - CorePart core; - CompositePart composite; - CanvasPart canvas; - } CanvasRec; - -#endif diff --git a/v/includex/v/v_defs.h b/v/includex/v/v_defs.h deleted file mode 100644 index 921fdf9..0000000 --- a/v/includex/v/v_defs.h +++ /dev/null @@ -1,418 +0,0 @@ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// - -#ifndef V_DEFS_H -#define V_DEFS_H - -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// -// // -// VV VV VV VV // -// VV VV V - A Portable C++ GUI Framework VV VV // -// VV VV designed and written by VV VV // -// VV VV VV VV // -// VV VV Bruce E. Wampler, Ph.D. VV VV // -// VVV e-mail: bruce@objectcentral.com VVV // -// V V // -// // -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// -// // -// v_defs.h - Standard V definitions -- X Version // -// // -// Copyright (C) 1995-2000 Bruce E. Wampler // -// // -// This file is part of the V C++ GUI Framework. // -// // -// This library is free software; you can redistribute it and/or // -// modify it under the terms of the GNU Lesser General Public // -// License as published by the Free Software Foundation; either // -// version 2.1 of the License, or (at your option) any later version. // -// // -// This library is distributed in the hope that it will be useful, // -// but WITHOUT ANY WARRANTY; without even the implied warranty of // -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // -// Library General Public License for more details. // -// // -// You should have received a copy of the GNU Lesser General Public // -// License along with this library (see COPYING.LIB); if not, write to the // -// Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -// // -// The author, Bruce E. Wampler, hereby grants you permission // -// to treat the executable of any application you develop that uses // -// the V library as a "work that uses the library" as long as you include // -// an acknowledgement of V, and a link to V at www.objectcentral.com // -// somewhere in the program or its documentation. You may use the V // -// library with any application, free or commercial, as long as you // -// follow the other terms of the LGPL, excluding Section 6. // -// // -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// -// VCONST can be defined as const, but that will require changes -// to apps. We will wait until V 2.0 for that to happen officially, -// but for now, this is available, at least on some classes. -// VMUTABLE is used in conjunction with VCONST. -#define VCONST -#define VMUTABLE -//#define VCONST const -//#define VMUTABLE mutable - -//#ifndef vDEBUG // force DEBUG for now -//#define vDEBUG -//#endif - -#define Motif // Motif by default! - -#ifdef Athena - -#undef Motif // undef Motif for Athena - -#ifdef NO_V_3D -#undef USE3D -#else -#define USE3D // by default for Athena -#endif - -#endif - -#ifdef vDEBUG // We are using old C stdio lib for debug info -#include -#endif - -#define V_VersMajor 1 -#define V_VersMinor 25 -#define V_Version "V 1.25 - 15 Sep 2000" -#define V_VersionX 1 - -// These should be defined as blanks for some C++ compilers - -#define BEGIN_EXTERN_C extern "C" { -#define END_EXTERN_C } -#ifdef __GNUC__ - #if (__GNUC_MINOR__==7) - #undef BEGIN_EXTERN_C - #undef END_EXTERN_C - #define BEGIN_EXTERN_C - #define END_EXTERN_C - #endif -#endif - - -BEGIN_EXTERN_C -#include -#include -END_EXTERN_C - - // system error functions - extern void vSysWarning(VCONST char* msg); - extern void vSysError(VCONST char* msg); - - // Define basic types - - typedef unsigned int vKey; // Value for a Key - typedef int ItemVal; // Value for an Item (menu,button, etc) -// typedef unsigned int CmdAttribute; // Attributes of commands - typedef unsigned long CmdAttribute; // Attributes of commands (1.24) - typedef int FontId; // Id for a font - -#define vRGB (v,x,y,z) v.r = x ; v.g = y ; v.z = b; -#define vpRGB (v,x,y,z) v->r = x ; v->g = y ; v->z = b; -const int maxFileNameSize = 256; - - typedef struct DebugMask - { - unsigned - System : 1, // System debug messages - CmdEvents : 1, // Show command events (buttons, etc.) - MouseEvents : 1, // Show mouse events - WindowEvents : 1, // Window events (resize, etc.) - Build : 1, // Define/Build window - BadVals: 1, // Error values - Misc : 1, // Misc stuff - Text : 1, // Text events - Constructor : 1, // Show constructors - Destructor : 1, // Show destructors - User: 1, // Debug user events - UserApp1 : 1, // Level 1 User App - UserApp2 : 1, // Level 2 User App - UserApp3 : 1; - } DebugMask; - - extern DebugMask DebugState; // allow everyone to see DebugState - -// Define some macros to make adding debugging stuff easy - -#ifdef vDEBUG -#define UserDebug(u,v) if (DebugState.u && DebugState.User) fprintf(stderr,v); -#define UserDebug1(u,v,w) if (DebugState.u && DebugState.User) fprintf(stderr,v,w); -#define UserDebug2(u,v,w,x) if (DebugState.u && DebugState.User) fprintf(stderr,v,w,x); -#define UserDebug3(u,v,w,x,z) if (DebugState.u && DebugState.User) fprintf(stderr,v,w,x,z); - -#define SysDebug(u,v) if (DebugState.u && DebugState.System) fprintf(stderr,v); -#define SysDebug1(u,v,w) if (DebugState.u && DebugState.System) fprintf(stderr,v,w); -#define SysDebug2(u,v,w,x) if (DebugState.u && DebugState.System) fprintf(stderr,v,w,x); -#define SysDebug3(u,v,w,x,z) if (DebugState.u && DebugState.System) fprintf(stderr,v,w,x,z); - -#else - -#define UserDebug(u,v) // Nothing -#define UserDebug1(u,v,w) // Nothing -#define UserDebug2(u,v,y,x) // Nothing -#define UserDebug3(u,v,y,x,z) // Nothing - -#define SysDebug(u,v) // Nothing -#define SysDebug1(u,v,w) // Nothing -#define SysDebug2(u,v,w,x) // Nothing -#define SysDebug3(u,v,w,x,z) // Nothing -#endif - - - enum WindowType { WINDOW, CMDWINDOW, DIALOG }; // Types of windows - - // How Items can be set - enum ItemSetType {Checked, Sensitive, Value, Hidden, ChangeList, - ChangeListPtr, Red, Green, Blue, ChangeColor, SetToFirst}; - - enum CmdType // types of dialog commands - { - C_EndOfList, // Used to denote end of command list - C_ArrowButton, // An arrow button - C_Blank, // filler to help RightOfs, Belows work - C_BoxedLabel, // Boxed label - C_Button, // Button - C_CheckBox, // Checked Item - C_ColorButton, // A colored button - C_ColorLabel, // A colored label - C_Custom, // A custom control - C_ComboBox, // Popup combo list - C_Frame, // General purpose frame - C_Icon, // a display only Icon - C_IconButton, // a command button Icon - C_Label, // Regular text label - C_List, // List of items (scrollable) - C_Menu, // Menu item - C_ProgressBar, // Bar to show progress - C_RadioButton, // Radio button - C_Slider, // Slider to enter value - C_Spinner, // a spinner box - C_TextEdit, // Text edit box - C_TextIn, // Text input field - C_Text, // wrapping text out - C_ToggleButton, // A toggle button - C_ToggleFrame, // A toggle frame - C_ToggleIconButton, // a toggle command button Icon - C_ZZZ // make my life easy - }; - - enum PaneType // Kinds of Panes - { - P_Canvas, // Drawing Canvas - P_TextCanvas, // TextCanvas - P_Menu, // Menu - P_Commands, // Commands - P_Icons, // Icon Bar - P_Buttons, // Button Bar - P_Status // Status Bar - }; - - - const CmdAttribute CA_None = 0; // No special attributes - const CmdAttribute CA_MainMsg = 0x01; // Gets replacement message - const CmdAttribute CA_DefaultButton = 0x02; // Special Default Button - - const CmdAttribute CA_Large = 0x04; // Command larger than normal - const CmdAttribute CA_Small = 0x08; // Command smaller than normal - const CmdAttribute CA_Hidden = 0x10; // Starts out hidden - const CmdAttribute CA_Horizontal = 0x20; // Horizontal orentation - const CmdAttribute CA_Vertical = 0x40; // Vertical orentation - const CmdAttribute CA_NoNotify = 0x100; // Don't notify on all events - const CmdAttribute CA_NoLabel = 0x100; // No label (ProgressCmd only) - const CmdAttribute CA_Simple = 0x100; // backward compatible - const CmdAttribute CA_Password = 0x100; // for text in control only - const CmdAttribute CA_Text = 0x200; // A Spin/Text command - const CmdAttribute CA_TextInNotify = 0x200; // Notify when TextIn changes - const CmdAttribute CA_NoBorder = 0x400; // No border (frames, status bar) - const CmdAttribute CA_NoSpace = 0x800; // No space between widgets - const CmdAttribute CA_ListWidth = 0x800; // Special for lists - - - const CmdAttribute CA_PerControl = 0x1000; // Specific to different controls - const CmdAttribute CA_Percent = 0x1000; // Show % for ProgressCmd - const CmdAttribute CA_Size = 0x1000; // size specified in size element - - // New attributes - require 32 bit, so CmdAttribute is now a long! - const CmdAttribute CA_Flat = 0x10000; // flat icon buttons - - // These definitions go here because the user app should not need - // to know about menus and buttons - only the static data structures - // needed to define those things - and so shouldn't have to include - // the header file for each menu or command object - - // definitions for dialog box command objects - -const ItemVal NoList = 0; // no attributes, items is null list; -const ItemVal NoFrame = 0; // no frame used - - typedef struct CommandObject - { - CmdType cmdType; // what kind of item is this - ItemVal cmdId; // unique id for the item - ItemVal retVal; // value returned when picked (might be < 0) - VCONST char* title; // string - void* itemList; // a list of stuff to use for the cmd - CmdAttribute attrs; // bit map of attributes - unsigned - Sensitive : 1; // if item is sensitive or not - ItemVal cFrame; // Frame used for an item - ItemVal cRightOf; // Item placed left of this id - ItemVal cBelow; // Item placed below this one - int size; // Used for sizes - VCONST char* tip; // tip string - } CommandObject; - -#define DialogCmd CommandObject // for backward compatibility - - typedef struct vMenu - { - VCONST char* label; // The label on the menu - ItemVal menuId; // A User assigned unique value - unsigned - sensitive : 1, // If item is sensitive or not - checked : 1; // If item is checked or not - VCONST char* keyLabel; // Label for an accelerator key - vKey accel; // Value of accelerator key - vMenu* SubMenu; // Ptr to a submenu - unsigned int kShift; // Shift state of accel key - } vMenu; - - typedef struct vStatus // for status bars - { - VCONST char* label; // label of button - ItemVal statId; // value - CmdAttribute attrs; // bit map of attributes - unsigned - sensitive : 1; // if button is sensitive or not - int width; // if need to specify width (0 => default) - } vStatus; - - // symbols for defining menus - -const int noKey = 0; -const int noKeyLbl = 0; -const int isSens = 1; -const int notSens = 0; -const int isChk = 1; -const int notChk = 0; -const int noSub = 0; -const int notUsed = 0; -const int noIcon = 0; - - // standard menu definitions -const ItemVal M_File = 32000; -const ItemVal M_Edit = 32001; -const ItemVal M_Search = 32002; -const ItemVal M_Help = 32003; -const ItemVal M_Window = 32004; -const ItemVal M_Options = 32005; -const ItemVal M_Tools = 32006; -const ItemVal M_Font = 32007; -const ItemVal M_View = 32008; -const ItemVal M_Format = 32009; -const ItemVal M_Insert = 32010; -const ItemVal M_Test = 32011; - -const ItemVal M_Line = 32090; - -const ItemVal M_New = 32100; -const ItemVal M_Open = 32101; -const ItemVal M_Close = 32102; -const ItemVal M_Save = 32103; -const ItemVal M_SaveAs = 32104; -const ItemVal M_Print = 32105; -const ItemVal M_PrintPreview = 32106; -const ItemVal M_About = 32107; -const ItemVal M_Exit = 32108; -const ItemVal M_CloseFile = 32109; // V:1.13 - -const ItemVal M_Cut = 32110; -const ItemVal M_Copy = 32111; -const ItemVal M_Paste = 32112; -const ItemVal M_Delete = 32113; -const ItemVal M_Clear = 32114; - -const ItemVal M_UnDo = 32120; -const ItemVal M_SetDebug = 32121; -const ItemVal M_SaveClose = 32122; -const ItemVal M_Abandon = 32123; - -const ItemVal M_Find = 32130; -const ItemVal M_FindAgain = 32131; -const ItemVal M_Replace = 32132; -const ItemVal M_Preferences = 32135; -const ItemVal M_FontSelect = 32136; - -const ItemVal M_User0 = 32140; -const ItemVal M_User1 = 32141; -const ItemVal M_User2 = 32142; -const ItemVal M_User3 = 32143; -const ItemVal M_User4 = 32144; -const ItemVal M_User5 = 32145; -const ItemVal M_User6 = 32146; -const ItemVal M_User7 = 32147; -const ItemVal M_User8 = 32148; -const ItemVal M_User9 = 32149; - -const ItemVal M_Cancel = 32150; -const ItemVal M_Done = 32151; -const ItemVal M_OK = 32152; -const ItemVal M_Yes = 32153; -const ItemVal M_No = 32154; -const ItemVal M_All = 32155; -const ItemVal M_None = 32156; - -const ItemVal M_TextInChange = 32158; -const ItemVal M_TextInLeaveFocus = 32159; - -// Definitions for drawing - - typedef struct vPoint // a point - { - short x, y; // X version - } vPoint; - - typedef struct vRect - { - short x,y,w,h; - } vRect; - - typedef struct vLine - { - short x,y,xend,yend; - } vLine; - -// for brushes and pens - -const int vSolid = 1; -const int vTransparent = 2; - -// for brushes - -const int vHorizontalHatch = 3; -const int vVerticleHatch = 4; -const int vVerticalHatch = 4; -const int vLeftDiagonalHatch = 5; -const int vRightDiagonalHatch = 6; -const int vCrossHatch = 7; -const int vDiagonalCrossHatch = 8; - -// for pens -const int vDash = 9; -const int vDot = 10; -const int vDashDot = 11; - -// for filling -const int vAlternate = 12; -const int vWinding = 13; -#endif diff --git a/v/includex/v/vapp.h b/v/includex/v/vapp.h deleted file mode 100644 index 6baa293..0000000 --- a/v/includex/v/vapp.h +++ /dev/null @@ -1,200 +0,0 @@ -//================================================================ -// vapp.h - the vapp base object - X11R5 version -// -// Copyright (C) 1995-1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VAPP_H -#define VAPP_H - -#include // our parent class -#include // our parent class -#include -#include -#include - -extern "C" // wrap in "C" -{ -#include -#include -#include -} - - - extern int AppMain(int, char**); - - class vWindow; - - typedef struct WindList - { - vWindow* window; - vAppWinInfo* info; - WindList* nextWinList; - } WindList; - -#ifndef Athena - typedef struct TaskList - { - vWindow* window; - ItemVal cmd; - TaskList* nextTask; - } TaskList; -#endif - - class _appWorkTimer : public vTimer - { - public: //---------------------------------------- public - _appWorkTimer() {} - ~_appWorkTimer() {} - virtual void TimerTick(); - private: //--------------------------------------- private - }; - - class vApp : public vBaseItem - { - // give friend access to some special things - friend class vWindow; // Provide access for vWindow class - friend int main(int, char**); // give main access - friend class _appWorkTimer; - - public: //---------------------------------------- public - - vApp(VCONST char* appName, int simSDI = 0, int fh = 0, int fw = 0); // constructor - virtual ~vApp() // destructor - { - SysDebug(Destructor,"vApp::~vApp destructor\n") - if (theClipboard != 0) - delete [] theClipboard; // free last chunk - } - - // Methods to override - - virtual void AppCommand(vWindow* win, ItemVal id, ItemVal retval, CmdType ctype); - virtual void CloseLastCmdWindow(vWindow* win, int exitcode); - virtual int CloseAppWin(vWindow* win); - virtual int CloseHelpWin(vWindow* win); - int IsHelpWin(vWindow *Win); - virtual void Exit(void); - virtual void KeyIn(vWindow* win, vKey key, unsigned int shift); - virtual vWindow* NewAppWin(vWindow* win, VCONST char* name, int w, int h, - vAppWinInfo* winInfo = 0); - virtual vWindow* NewHelpWin(vWindow* win, VCONST char* name, int w, int h); - virtual void DropFile(const char* fn) {} - - - int ClipboardSetText(VCONST char* text, int DoXOwn = 1) VCONST; - char* ClipboardGetText() VCONST; - int ClipboardCheckText() VCONST; - void ClipboardClear() VCONST; - - // Tasking - void CheckEvents(); - - int EnableWorkSlice(long slice); - virtual void WorkSlice() {} // No op by default - - // Utlity methods - - void showAppWin(bool show) {} // No op in X - void GetVVersion(int& major, int& minor) - { major = V_VersMajor; minor = V_VersMinor; } - int DefaultHeight() { return _DefaultHeight; } - int DefaultWidth() {return _DefaultWidth; } - int ScreenHeight() { return _DisplayHeight; } - int ScreenWidth() {return _DisplayWidth; } - int IsRunning() {return _running;} // see if app is running - vFont GetDefaultFont(); - void SendWindowCommandAll(ItemVal id, int val, CmdType ctype); - void UpdateAllViews(vWindow* sender = NULL, int hint = 0, - void* pHint = NULL); - void SetValueAll(ItemVal id, int val, ItemSetType setType) VCONST; - void SetAppTitle(VCONST char* title); - void SetStringAll(ItemVal id, VCONST char* str); - int ShowList(); - vAppWinInfo *getAppWinInfo(vWindow* Win); - - // Required internally - // These need to be global, sorry... - -#ifndef Athena - Boolean MotifIdleWork(XtPointer client_data); - int MotifSetTask(vWindow* vw, ItemVal id); -#endif - int XCheckSelection(); - void XWaitUntilMapped(Widget w); - - Atom vx_wm_protocols; // Stuff for X protocols - Atom vx_wm_delete_window; - - vMenuPane* GetMenuThis(Widget w); // needed for submenus - - int simSDI() { return _simSDI;} - // X stuff - Display* display() // To get the X display - { return _display; } - Window xWindow(); - - XtAppContext appContext() // To get the context - { return _appContext; } - - int Xdepth() {return _depth;} - Pixel Xfg() {return _foregroundPix;} - Pixel Xbg() {return _backgroundPix;} - Colormap Xcolormap() {return _colormap;} - - XFontStruct* _XDefaultFont; // set by default or -fn switch - void doXEventLoop(); - - protected: //--------------------------------------- protected - - WindList* _WindowList; // List of "top level" windows - - int _running; // if we are running - - void registerWindow(vWindow* Win, vAppWinInfo* awinfo); - void unregisterWindow(vWindow* Win); - - // The following is called from main. - void initialize(int& argc, char** argv); - - private: //--------------------------------------- private - - int _frameWidth, _frameHeight; - int _DefaultHeight; - int _DefaultWidth; - int _simSDI; // not used in X, but in windows - - XtWorkProcId work_id; - -#ifndef Athena - TaskList* _taskList; -#endif - _appWorkTimer* _workTimer; // timer for work slice - - void DispatchWork(void); - - // X stuff - Display* _display; // Needed by X sometimes - Window _xwindow; // Window of root window - XtAppContext _appContext; // Main app context - Colormap _colormap; - Pixel _foregroundPix; // foreground pixel value - Pixel _backgroundPix; // background pixel value - int _depth; // depth - int _DisplayHeight; // height of display - int _DisplayWidth; // width of display - - static const int ClipAllocUnit = 1024; - VMUTABLE int ClipMax; - VMUTABLE char* theClipboard; - - - }; - - extern vApp *theApp; // Pointer to single global instance -#endif diff --git a/v/includex/v/vappold.h b/v/includex/v/vappold.h deleted file mode 100644 index ec7ccd2..0000000 --- a/v/includex/v/vappold.h +++ /dev/null @@ -1,179 +0,0 @@ -//================================================================ -// vapp.h - the vapp base object - X11R5 version -// -// Copyright (C) 1995-1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VAPP_H -#define VAPP_H - -#include // our parent class -#include // our parent class -#include -#include -#include - -extern "C" // wrap in "C" -{ -#include -#include -#include -} - - - extern int AppMain(int, char**); - - class vWindow; - - typedef struct WindList - { - vWindow* window; - vAppWinInfo* info; - WindList* nextWinList; - } WindList; - - class _appWorkTimer : public vTimer - { - public: //---------------------------------------- public - _appWorkTimer() {} - ~_appWorkTimer() {} - virtual void TimerTick(); - private: //--------------------------------------- private - }; - - class vApp : public vBaseItem - { - // give friend access to some special things - friend class vWindow; // Provide access for vWindow class - friend int main(int, char**); // give main access - friend class _appWorkTimer; - - public: //---------------------------------------- public - - vApp(VCONST char* appName, int simSDI = 0, int fh = 0, int fw = 0); // constructor - virtual ~vApp() // destructor - { - SysDebug(Destructor,"vApp::~vApp destructor\n") - if (theClipboard != 0) - delete [] theClipboard; // free last chunk - } - - // Methods to override - - virtual void AppCommand(vWindow* win, ItemVal id, ItemVal retval, CmdType ctype); - virtual void CloseLastCmdWindow(vWindow* win, int exitcode); - virtual int CloseAppWin(vWindow* win); - virtual int CloseHelpWin(vWindow* win); - int IsHelpWin(vWindow *Win); - virtual void Exit(void); - virtual void KeyIn(vWindow* win, vKey key, unsigned int shift); - virtual vWindow* NewAppWin(vWindow* win, VCONST char* name, int w, int h, - vAppWinInfo* winInfo = 0); - virtual vWindow* NewHelpWin(vWindow* win, VCONST char* name, int w, int h); - - - int ClipboardSetText(VCONST char* text, int DoXOwn = 1) VCONST; - char* ClipboardGetText() VCONST; - int ClipboardCheckText() VCONST; - void ClipboardClear() VCONST; - - // Tasking - void CheckEvents(); - - int EnableWorkSlice(long slice); - virtual void WorkSlice() {} // No op by default - - // Utlity methods - - void showAppWin(bool show) {} // No op in X - void GetVVersion(int& major, int& minor) - { major = V_VersMajor; minor = V_VersMinor; } - int DefaultHeight() { return _DefaultHeight; } - int DefaultWidth() {return _DefaultWidth; } - int ScreenHeight() { return _DisplayHeight; } - int ScreenWidth() {return _DisplayWidth; } - int IsRunning() {return _running;} // see if app is running - vFont GetDefaultFont(); - void SendWindowCommandAll(ItemVal id, int val, CmdType ctype); - void UpdateAllViews(vWindow* sender = NULL, int hint = 0, - void* pHint = NULL); - void SetValueAll(ItemVal id, int val, ItemSetType setType) VCONST; - void SetAppTitle(VCONST char* title); - void SetStringAll(ItemVal id, VCONST char* str); - int ShowList(); - vAppWinInfo *getAppWinInfo(vWindow* Win); - - // Required internally - // These need to be global, sorry... - - int XCheckSelection(); - void XWaitUntilMapped(Widget w); - - Atom vx_wm_protocols; // Stuff for X protocols - Atom vx_wm_delete_window; - - vMenuPane* GetMenuThis(Widget w); // needed for submenus - - int simSDI() { return _simSDI;} - // X stuff - Display* display() // To get the X display - { return _display; } - Window xWindow(); - - XtAppContext appContext() // To get the context - { return _appContext; } - - int Xdepth() {return _depth;} - Pixel Xfg() {return _foregroundPix;} - Pixel Xbg() {return _backgroundPix;} - Colormap Xcolormap() {return _colormap;} - - XFontStruct* _XDefaultFont; // set by default or -fn switch - void doXEventLoop(); - - protected: //--------------------------------------- protected - - WindList* _WindowList; // List of "top level" windows - - int _running; // if we are running - - void registerWindow(vWindow* Win, vAppWinInfo* awinfo); - void unregisterWindow(vWindow* Win); - - // The following two are called from main. - void initialize(int& argc, char** argv); - - private: //--------------------------------------- private - - int _frameWidth, _frameHeight; - int _DefaultHeight; - int _DefaultWidth; - int _simSDI; // not used in X, but in windows - - _appWorkTimer* _workTimer; // timer for work slice - - void DispatchWork(void); - - // X stuff - Display* _display; // Needed by X sometimes - Window _xwindow; // Window of root window - XtAppContext _appContext; // Main app context - Colormap _colormap; - Pixel _foregroundPix; // foreground pixel value - Pixel _backgroundPix; // background pixel value - int _depth; // depth - int _DisplayHeight; // height of display - int _DisplayWidth; // width of display - - static const int ClipAllocUnit = 1024; - VMUTABLE int ClipMax; - VMUTABLE char* theClipboard; - }; - - extern vApp *theApp; // Pointer to single global instance -#endif diff --git a/v/includex/v/vawinfo.h b/v/includex/v/vawinfo.h deleted file mode 100644 index 21f50fd..0000000 --- a/v/includex/v/vawinfo.h +++ /dev/null @@ -1,35 +0,0 @@ -//=============================================================== -// vawinfo.h - vAppWinInfo utility class for tracking windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VAWINFO_H -#define VAWINFO_H - -#include // include basic defs - - class vAppWinInfo - { - public: //---------------------------------------- public - - vAppWinInfo(VCONST char* name = "", VCONST void* ptr = 0); - virtual ~vAppWinInfo(); - - virtual VCONST char* infoName() {return _infoName;} - virtual VCONST void* getPtr() {return _ptr; } - - protected: //--------------------------------------- protected - - char* _infoName; // name of item - VCONST void* _ptr; // general purpose utility ptr - - private: //--------------------------------------- private - - }; -#endif diff --git a/v/includex/v/vbaseitm.h b/v/includex/v/vbaseitm.h deleted file mode 100644 index c8f4404..0000000 --- a/v/includex/v/vbaseitm.h +++ /dev/null @@ -1,38 +0,0 @@ -//=============================================================== -// vbaseitm.h - the base class that holds handle information -// -// Copyright (C) 1995-1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VBASEITEM_H -#define VBASEITEM_H - -#include // include basic defs - - class vBaseItem - { - public: //---------------------------------------- public - - vBaseItem(const vBaseItem& b); // Copy constructor - virtual ~vBaseItem(); // needed to free name - - const Widget vHandle() VCONST { return _vHandle; } - const char* name() VCONST { return (const char*) _name;} - - protected: //--------------------------------------- protected - - char* _name; // name of item - Widget _vHandle; // X widget - int _copied; - - vBaseItem(VCONST char* name); // Protected makes this a base class - // prevents instantiation - - private: //--------------------------------------- private - }; -#endif diff --git a/v/includex/v/vbasewin.h b/v/includex/v/vbasewin.h deleted file mode 100644 index 97fa8b4..0000000 --- a/v/includex/v/vbasewin.h +++ /dev/null @@ -1,48 +0,0 @@ -//=============================================================== -// vbasewin.h - vBaseWindow class definitions - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VBASEWIN_H -#define VBASEWIN_H - -#include // base info class - - - class vBaseWindow : public vBaseItem - { - - public: //---------------------------------------- public - - vBaseWindow(VCONST char* name); // Constructor - vBaseWindow(const vBaseWindow& w); // Copy Constructor - virtual ~vBaseWindow(); // Destructor - - virtual void initialize(void) {} // Pure virtual function - - virtual void ShowWindow(void) { showBaseWindow(); } - - void closeBaseWindow(void); // Kill window - - WindowType wType() VCONST {return _wType;} // what kind of window we are - - - protected: //--------------------------------------- protected - - WindowType _wType; // what kind of window we are building - Widget _topLevel; // the main window - - void showBaseWindow(void) - { XtPopup(_vHandle, XtGrabNone); } // Pop us up - - - private: //--------------------------------------- private - - }; -#endif diff --git a/v/includex/v/vbglcnv.h b/v/includex/v/vbglcnv.h deleted file mode 100644 index 4a70e21..0000000 --- a/v/includex/v/vbglcnv.h +++ /dev/null @@ -1,98 +0,0 @@ -//=============================================================== -// vglcnv.h GL Canvas C++ class .h file - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VGLCNV_H -#define VGLCNV_H - -#include -#include - -extern "C" -{ - - static void CGLKeyInEV(Widget w, XtPointer client_data, XEvent* event, char *x); - -// OpenGL stuff here - - void CgraphicsInit(Widget w, XtPointer clientData, XtPointer call); - -#include // Xt OpenGL drawing area widget. -#include -#include -#include - -} - -const unsigned int vGL_Default = 0; -const unsigned int vGL_RGB = 0x0001; -const unsigned int vGL_Alpha = 0x0002; -const unsigned int vGL_Indexed = 0x0004; -const unsigned int vGL_DoubleBuffer = 0x0008; -const unsigned int vGL_Stereo = 0x0010; -const unsigned int vGL_Stencil = 0x0020; -const unsigned int vGL_Accum = 0x0040; -const unsigned int vGL_Depth = 0x0080; - - - class vWindow; // we are part of a window - - class vBaseGLCanvasPane : public vCanvasPane - { - - friend void CgraphicsInit(Widget w, XtPointer clientData, XtPointer call); - friend void CGLKeyInEV(Widget w, XtPointer client_data, XEvent* event, char *x); - public: //---------------------------------------- public - - vBaseGLCanvasPane(unsigned int vGLmode = vGL_Default, PaneType pt = P_Canvas); - - virtual ~vBaseGLCanvasPane(); - - - // Expose/redraw event - virtual void Resize(int newW, int newH); // Resize event - - // OpenGL specific stuff - - virtual void graphicsInit(void); - - void vglMakeCurrent(void) - { - glXMakeCurrent(theApp->display(), XtWindow(DrawingWindow()), glxContext); - } - - virtual void vglFlush(); - - - XVisualInfo* GetXVisualInfo() { return _visinfo; } - - // Platform dependent - - - protected: //--------------------------------------- protected - - virtual void initialize(vWindow* pWindow, Widget pWidget, - Widget drawCanvas = (Widget)0, Widget drawArea=(Widget)0); - - void GLKeyInEV(unsigned int keycode, unsigned int state); - - XVisualInfo* chooseIndexed(unsigned int glMode); - XVisualInfo* chooseRGB(unsigned int glMode); - - GLXContext glxContext; - - private: //--------------------------------------- private - - static XVisualInfo* _visinfo; - static int _doubleBuffer; // if we have double buffering - static unsigned int _vGLmode; - - }; -#endif diff --git a/v/includex/v/vbrush.h b/v/includex/v/vbrush.h deleted file mode 100644 index 70d9347..0000000 --- a/v/includex/v/vbrush.h +++ /dev/null @@ -1,72 +0,0 @@ -//=============================================================== -// vbrush.h: brush class header for filling - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VBRUSH_H -#define VBRUSH_H - -#include // Basic defs -#include - -extern "C" // wrap in "C" -{ -#include -#include -} - -// Use Windows for brush styles, map to something reasonable for X - - class vBrush - { - public: //---------------------------------------- public - vBrush(unsigned int r = 0, unsigned int g = 0, unsigned int b = 0, - int style = vSolid, int fillMode = vAlternate) - { - brushColor._r = r, brushColor._g = g; brushColor._b = b; - brushFillMode = fillMode; brushStyle = style; - } - - //vBrush(const vBrush& p); Default OK - - int operator ==(const vBrush& b2) VCONST - { return (brushColor == b2.brushColor && brushFillMode == b2.brushFillMode && - brushStyle == b2.brushStyle); } - - int operator !=(const vBrush& b2) VCONST - { return (brushColor != b2.brushColor || brushFillMode != b2.brushFillMode || - brushStyle != b2.brushStyle); } - - ~vBrush() {} - - void SetStyle(int style) { brushStyle = style; } - int GetStyle() VCONST { return brushStyle; } - - void SetColor(vColor c) { if (c != brushColor) brushColor = c; } - void SetColor(unsigned int r, unsigned int g, unsigned int b) - { - if (brushColor._r != r || brushColor._g != g || brushColor._b != b) - brushColor.Set(r,g,b); - } - vColor GetColor() { return brushColor; } - - void SetFillMode(int fillMode) - { if (fillMode != brushFillMode) brushFillMode = fillMode; } - int GetFillMode() { return brushFillMode; } - - void SetBrushToPixel(Pixel px) { brushColor._pixel = px; brushColor._mapped = 1;} - - vColor brushColor; - int brushFillMode; - int brushStyle; - - protected: //--------------------------------------- protected - private: //--------------------------------------- private - }; -#endif diff --git a/v/includex/v/vbtncmd.h b/v/includex/v/vbtncmd.h deleted file mode 100644 index b596bf7..0000000 --- a/v/includex/v/vbtncmd.h +++ /dev/null @@ -1,56 +0,0 @@ -//=============================================================== -// vbtncmd.h - Button Command class -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VBTNCMD_H -#define VBTNCMD_H - -#include -#include // We are derived from vcmd - -extern "C" // wrap in "C" -{ -#include -#include -} - - class vCmdParent; - - extern "C" - { - void CButtonCmdCB(Widget w, XtPointer This, XtPointer call_data); - } - - class vButtonCmd : public vCmd - { - friend void CButtonCmdCB(Widget w, XtPointer This, XtPointer call_data); - - public: //---------------------------------------- public - - vButtonCmd(vCmdParent* dp, CommandObject* co); - - virtual ~vButtonCmd(void); - - virtual void initialize(void); - - virtual int GetCmdValue(ItemVal id) VCONST; - virtual void ResetItemValue(void); - virtual void SetCmdVal(ItemVal val, ItemSetType st); - - virtual void SetCmdStr(char* str); - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - - void ButtonCmdCB(void); // callback for user action - - }; -#endif diff --git a/v/includex/v/vcanvas.h b/v/includex/v/vcanvas.h deleted file mode 100644 index 21b553d..0000000 --- a/v/includex/v/vcanvas.h +++ /dev/null @@ -1,324 +0,0 @@ -//=============================================================== -// vcanvas.h Canvas C++ class .h file - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VCANVAS_H -#define VCANVAS_H - -#include // Basic defs -#include // we are derived from vPane -#include // we also derive from vDrawingCanvasDC -#include // for font stuff - -extern "C" -{ -#include -#include - -#ifndef Athena - void CinputCB(Widget w, XtPointer client_date, XtPointer call_data); - void CexposeCB(Widget w, XtPointer client_date, XtPointer call_data); - void CresizeCB(Widget w, XtPointer client_date, XtPointer call_data); -#else // ## Athena - void CchangeCB(Widget w, XtPointer client_data, XtPointer call_data); - - void CExposeEV(Widget w, XtPointer client_data, XEvent* event, char *x); - - void CMouseDownEV(Widget w, XtPointer client_data, XEvent* event, char *x); - void CMouseUpEV(Widget w, XtPointer client_data, XEvent* event, char *x); - void CMouseMoveEV(Widget w, XtPointer client_data, XEvent* event, char *x); -#endif - - // Common to both Motif and Athena - void CHJumpProcCB(Widget w, XtPointer This, XtPointer pc_ptr); - void CHScrollProcCB(Widget w, XtPointer This, XtPointer position); - void CVJumpProcCB(Widget w, XtPointer This, XtPointer pc_ptr); - void CVScrollProcCB(Widget w, XtPointer This, XtPointer position); - void CEnterEV(Widget w, XtPointer client_data, XEvent* event, char *x); - void CLeaveEV(Widget w, XtPointer client_data, XEvent* event, char *x); - -} - - typedef int VCursor; // For cursors - -// Define Cursor stuff - -const VCursor VC_None = 0; // No/Default cursor -const VCursor VC_Arrow = 1; // XC_top_left_arrow -const VCursor VC_CenterArrow = 2; // XC_center_ptr -const VCursor VC_CrossHair = 3; // XC_crosshair -const VCursor VC_EWArrows = 4; // XC_sb_h_double_arrow -const VCursor VC_Hand = 5; // XC_hand2 -const VCursor VC_IBar = 6; // XC_xterm -const VCursor VC_Icon = 7; // XC_icon -const VCursor VC_NSArrows = 8; // XC_sb_v_double_arrow -const VCursor VC_Pencil = 9; // XC_Pencil -const VCursor VC_Question = 10; // XC_question_arrow -const VCursor VC_Sizer = 11; // XC_sizing -const VCursor VC_Wait = 12; // XC_watch -const VCursor VC_X = 13; // XC_X_cursor -const VCursor VC_LAST = 13; -const int maxCursors = 13; - - class vWindow; // we are part of a window - class vMemoryDC; - - class vCanvasPane : public vPane - { -#ifndef Athena - - friend void CinputCB(Widget w, XtPointer client_date, XtPointer call_data); - friend void CexposeCB(Widget w, XtPointer client_date, XtPointer call_data); - friend void CresizeCB(Widget w, XtPointer client_date, XtPointer call_data); - -#else // Athena - friend void CchangeCB(Widget w, XtPointer client_data, XtPointer call_data); - friend void CExposeEV(Widget w, XtPointer client_data, XEvent* event, char *x); - - friend void CMouseDownEV(Widget w, XtPointer client_data, XEvent* event, char *x); - friend void CMouseUpEV(Widget w, XtPointer client_data, XEvent* event, char *x); - friend void CMouseMoveEV(Widget w, XtPointer client_data, XEvent* event, char *x); -#endif - // Common to both Motif and Athena - - friend void CHJumpProcCB(Widget w, XtPointer This, XtPointer pc_ptr); - friend void CHScrollProcCB(Widget w, XtPointer This, XtPointer position); - friend void CVJumpProcCB(Widget w, XtPointer This, XtPointer pc_ptr); - friend void CVScrollProcCB(Widget w, XtPointer This, XtPointer position); - - friend void CEnterEV(Widget w, XtPointer client_data, XEvent* event, char *x); - friend void CLeaveEV(Widget w, XtPointer client_data, XEvent* event, char *x); - - - public: //---------------------------------------- public - - vCanvasPane(PaneType pt = P_Canvas); - - virtual ~vCanvasPane(); - - virtual void ShowPane(int OnOrOff) VCONST; - - void SetWidthHeight(int width, int height); - // Cursor - void SetCursor(VCursor id); - VCursor GetCursor() { return _currentCursor; } - - void UnSetCursor(void); - void CompressRedraw(int val) { _compressRedraw = val; } - - // Scrolling - virtual void HPage(int Shown, int Top); // Horiz page event - virtual void VPage(int Shown, int Top); // Vert page event - virtual void HScroll(int step); // Horiz scroll event - virtual void VScroll(int step); // Vert scroll event - virtual void SetHScroll(int Shown, int Top); // Set Horiz Scroll bar - virtual void SetVScroll(int Shown, int Top); // Set Vert Scroll bar - virtual int GetVScroll(int& Shown, int& Top) VCONST; - virtual int GetHScroll(int& Shown, int& Top) VCONST; - virtual void ShowHScroll(int OnOff); - virtual void ShowVScroll(int OnOff); - - // Change messages - virtual void FontChanged(VCONST vFont& vf); - - // Events - virtual void MouseDown(int x, int y, int button); // Mouse Down at x,y - virtual void MouseUp(int x, int y, int button); // Mouse Up at x,y - virtual void MouseMove(int x, int y, int button); // Mouse Moved to x,y - virtual void MouseMotion(int /* x */, int /* y */) {} // no button: Mouse Moved to x,y - - virtual void EnterFocus(); - virtual void LeaveFocus(); - - // Expose/redraw event - virtual void Redraw(int x, int y, int width , int height); - virtual void Resize(int newW, int newH); // Resize event - - // Information - virtual int GetWidth() VCONST { return _width; } // Get width of canvas - virtual int GetHeight() VCONST { return _height; } // Get Height of canvas - - // Drawing - - virtual void Clear(void) - { _cpDC->Clear(); } - - virtual void ClearRect(int left, int top, int width, int height) - { _cpDC->ClearRect(left, top, width, height); } - - virtual void CopyFromMemoryDC(vMemoryDC* vmemdc, int destX, int destY, - int srcX = 0, int srcY = 0, int srcW = 0, int srcH = 0) // V:1.13 - { _cpDC->CopyFromMemoryDC(vmemdc, destX, destY,srcX,srcY,srcW,srcH);} - -#ifdef DRAWARC - virtual void DrawArc(int xx1, int yy1, int xx2, int yy2, int xxc, int yyc) - { _cpDC->DrawArc(xx1, yy1, xx2, yy2, xxc, yyc); } -#endif - - virtual void DrawAttrText(int x, int y, VCONST char* text, - const ChrAttr attr) - { _cpDC->DrawAttrText(x, y, text, attr); } - - virtual void DrawText(int x, int y, VCONST char* text) - { _cpDC->DrawText(x, y, text); } - - virtual void DrawEllipse(int x, int y, int width, int height) - { _cpDC->DrawEllipse(x, y, width, height); } - - virtual void DrawIcon(int x, int y, vIcon& icon) - { _cpDC->DrawIcon(x,y,icon); } - - virtual void DrawLine(int x, int y, int xend , int yend) - { _cpDC->DrawLine(x, y, xend , yend); } - - virtual void DrawLines(vLine* lineList, int count) - { _cpDC->DrawLines(lineList, count); } - - virtual void DrawLines(vPoint* points, int n) - { _cpDC->DrawLines(points, n); } - - virtual void DrawColorPoints(int x, int y, int nPoints, vColor* pointList) - {_cpDC->DrawColorPoints(x,y,nPoints,pointList); } - - virtual void DrawPoint(int x, int y) - { _cpDC->DrawPoint(x, y); } - - virtual void DrawPoints(vPoint* pointList, int count) - { _cpDC->DrawPoints(pointList, count); } - - virtual void DrawPolygon(int n, vPoint points[], int fillStyle = vAlternate) - { _cpDC->DrawPolygon(n, points, fillStyle); } - - virtual void DrawRectangle(int x, int y, int width, int height) - { _cpDC->DrawRectangle(x, y, width, height); } - - virtual void DrawRectangles(vRect* rectList, int count) - { _cpDC->DrawRectangles(rectList, count); } - - virtual void DrawRoundedRectangle(int x, int y, - int width, int height, int radius = 10) - { _cpDC->DrawRoundedRectangle(x, y, width, height, radius); } - - virtual void DrawRubberLine(int x, int y, int xend, int yend) - { _cpDC->DrawRubberLine(x, y, xend, yend); } - - virtual void DrawRubberEllipse(int x, int y, int width, int height) - { _cpDC->DrawRubberEllipse(x, y, width, height); } - - virtual void DrawRubberRectangle(int x, int y, int width, int height) - { _cpDC->DrawRubberRectangle(x, y, width, height); } - - virtual vBrush GetBrush(void) VCONST - { return _cpDC->GetBrush(); } - - virtual void SetBrush(VCONST vBrush& brush) - { _cpDC->SetBrush(brush); } - - virtual vFont GetFont(void) VCONST - { return _cpDC->GetFont(); } - - virtual void SetFont(VCONST vFont& fid) - { _cpDC->SetFont(fid); } - - virtual int TextWidth(VCONST char* str) VCONST - { return _cpDC->TextWidth(str);} - - virtual int TextHeight(int& asc, int& des) VCONST - { return _cpDC->TextHeight(asc, des); } - - // Appearance - - virtual void SetScale(int mult, int div) - { _cpDC->SetScale(mult,div); } - - virtual void GetScale(int& mult, int& div) VCONST - { _cpDC->GetScale(mult,div); } - - virtual void SetBackground(VCONST vColor color) - { _cpDC->SetBackground(color); } - - virtual void SetPen(VCONST vPen& pen) - { _cpDC->SetPen(pen); } - - virtual vPen GetPen() VCONST - { return _cpDC->GetPen(); } - - virtual void SetTranslate(int x, int y) { _cpDC->SetTranslate(x,y); } - virtual void SetTransX(int x) {_cpDC->SetTransX(x);} - virtual void SetTransY(int y) {_cpDC->SetTransY(y);} - virtual void GetTranslate(int& x, int& y) VCONST {_cpDC->GetTranslate(x,y);} - virtual int GetTransX() VCONST { return _cpDC->GetTransX(); } - virtual int GetTransY() VCONST { return _cpDC->GetTransY(); } - - virtual vDC* GetDC() { return _cpDC; } - - // Platform dependent - - Widget DrawingWindow() { return _drawWindow; } - Drawable GetXDrawable() { return (_Drawable == 0) ? - (_Drawable = (Drawable)XtWindow(_drawWindow)) : _Drawable;} - - protected: //--------------------------------------- protected - - virtual void CreateDC(void); - - vDC* _cpDC; // pointer to our drawing canvas - - virtual void initialize(vWindow* pWindow, Widget pWidget, - Widget drawCanvas = (Widget)0, Widget drawArea = (Widget)0); - - int _height; // height of draw window - int _width; // width of draw window - - void CnvKeyInEv(unsigned int keycode, unsigned int state); - - private: //--------------------------------------- private - - // Widgets for the canvas - Widget _drawCanvas; // whole canvas window - Widget _drawHScroll; // horiz scroll - Widget _drawVScroll; // vertical scroll - Widget _drawWindow; // window for drawing - Drawable _Drawable; - - static VCursor _currentCursor; // for cursor - - int _hasFocus; // for focus workaround - int _mouseDown; // for tracking mouse - - int _HOn; // on or off - int _VOn; - - int _HScrlShown; - int _HScrlTop; - int _VScrlShown; - int _VScrlTop; - - int _ResizeDone; - int _compressRedraw; - - void ChangeCB(void); - // Allow dual use for Athena and Motif - void HJumpProcCB(float percent, int motifValue); - void VJumpProcCB(float percent, int motifValue); - void HScrollProcCB(int); - void VScrollProcCB(int); - - void DrawHScroll(int Shown, int Top); - void DrawVScroll(int Shown, int Top); - - void ExposeEV(int x, int y, int width, int height, int count); - void EnterEV(void); - void LeaveEV(void); - void MouseUpEV(int x, int y, int button); - void MouseDownEV(int x, int y, int button); - void MouseMoveEV(int x, int y, int button); - }; -#endif diff --git a/v/includex/v/vcb2x4.h b/v/includex/v/vcb2x4.h deleted file mode 100644 index 204d423..0000000 --- a/v/includex/v/vcb2x4.h +++ /dev/null @@ -1,36 +0,0 @@ -//=============================================================== -// vcb2x8.h - defines a 2 row by 8 color button frame -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VCB2X4_H -#define VCB2X4_H -#ifndef vC_Size -#define vC_Size 8 -#endif -#ifndef vC_Frame -#define vC_Frame NoFrame -#endif -#ifndef vC_RightOf -#define vC_RightOf 0 -#endif -#ifndef vC_Below -#define vC_Below 0 -#endif -{C_Frame, M_ColorFrame,0,"",NoList,CA_NoSpace,isSens,vC_Frame,vC_RightOf,vC_Below,0}, -{C_ColorButton,M_Black, vC_Black,"",&vStdColors[vC_Black],CA_None,isSens,M_ColorFrame,0,0,vC_Size}, -{C_ColorButton,M_Red, vC_Red,"",&vStdColors[vC_Red],CA_None,isSens,M_ColorFrame,M_Black,0,vC_Size}, -{C_ColorButton,M_Green, vC_Green,"",&vStdColors[vC_Green],CA_None,isSens,M_ColorFrame,M_Red,0,vC_Size}, -{C_ColorButton,M_Blue, vC_Blue,"",&vStdColors[vC_Blue],CA_None,isSens,M_ColorFrame,M_Green,0,vC_Size}, - -{C_ColorButton,M_White, vC_White,"",&vStdColors[vC_White],CA_None,isSens,M_ColorFrame,0,M_Black,vC_Size}, -{C_ColorButton,M_Yellow, vC_Yellow,"",&vStdColors[vC_Yellow],CA_None,isSens,M_ColorFrame,M_White,M_Black,vC_Size}, -{C_ColorButton,M_Magenta, vC_Magenta,"",&vStdColors[vC_Magenta],CA_None,isSens,M_ColorFrame,M_Yellow,M_Black,vC_Size}, -{C_ColorButton,M_Cyan, vC_Cyan,"",&vStdColors[vC_Cyan],CA_None,isSens,M_ColorFrame,M_Magenta,M_Black,vC_Size}, -#endif diff --git a/v/includex/v/vcb2x8.h b/v/includex/v/vcb2x8.h deleted file mode 100644 index eb482f5..0000000 --- a/v/includex/v/vcb2x8.h +++ /dev/null @@ -1,43 +0,0 @@ -//=============================================================== -// vcb2x8.h - defines a 2 row by 8 color button frame -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VCB2X8_H -#define VCB2X8_H -#ifndef vC_Size -#define vC_Size 8 -#endif -#ifndef vC_Frame -#define vC_Frame NoFrame -#endif -#ifndef vC_RightOf -#define vC_RightOf 0 -#endif -#ifndef vC_Below -#define vC_Below 0 -#endif -{C_Frame, M_ColorFrame,0,"",NoList,CA_NoSpace,isSens,vC_Frame,vC_RightOf,vC_Below,0}, -{C_ColorButton,M_Black, vC_Black,"",&vStdColors[vC_Black],CA_None,isSens,M_ColorFrame,0,0,vC_Size}, -{C_ColorButton,M_White, vC_White,"",&vStdColors[vC_White],CA_None,isSens,M_ColorFrame,M_Black,0,vC_Size}, -{C_ColorButton,M_Red, vC_Red,"",&vStdColors[vC_Red],CA_None,isSens,M_ColorFrame,M_White,0,vC_Size}, -{C_ColorButton,M_Green, vC_Green,"",&vStdColors[vC_Green],CA_None,isSens,M_ColorFrame,M_Red,0,vC_Size}, -{C_ColorButton,M_Blue, vC_Blue,"",&vStdColors[vC_Blue],CA_None,isSens,M_ColorFrame,M_Green,0,vC_Size}, -{C_ColorButton,M_Yellow, vC_Yellow,"",&vStdColors[vC_Yellow],CA_None,isSens,M_ColorFrame,M_Blue,0,vC_Size}, -{C_ColorButton,M_Magenta, vC_Magenta,"",&vStdColors[vC_Magenta],CA_None,isSens,M_ColorFrame,M_Yellow,0,vC_Size}, -{C_ColorButton,M_Cyan, vC_Cyan,"",&vStdColors[vC_Cyan],CA_None,isSens,M_ColorFrame,M_Magenta,0,vC_Size}, -{C_ColorButton,M_DarkGray, vC_DarkGray,"",&vStdColors[vC_DarkGray],CA_None,isSens,M_ColorFrame,0,M_Black,vC_Size}, -{C_ColorButton,M_MedGray, vC_MedGray,"",&vStdColors[vC_MedGray],CA_None,isSens,M_ColorFrame,M_DarkGray,M_Black,vC_Size}, -{C_ColorButton,M_DimRed, vC_DimRed,"",&vStdColors[vC_DimRed],CA_None,isSens,M_ColorFrame,M_MedGray,M_Black,vC_Size}, -{C_ColorButton,M_DimGreen, vC_DimGreen,"",&vStdColors[vC_DimGreen],CA_None,isSens,M_ColorFrame,M_DimRed,M_Black,vC_Size}, -{C_ColorButton,M_DimBlue, vC_DimBlue,"",&vStdColors[vC_DimBlue],CA_None,isSens,M_ColorFrame,M_DimGreen,M_Black,vC_Size}, -{C_ColorButton,M_DimYellow, vC_DimYellow,"",&vStdColors[vC_DimYellow],CA_None,isSens,M_ColorFrame,M_DimBlue,M_Black,vC_Size}, -{C_ColorButton,M_DimMagenta, vC_DimMagenta,"",&vStdColors[vC_DimMagenta],CA_None,isSens,M_ColorFrame,M_DimYellow,M_Black,vC_Size}, -{C_ColorButton,M_DimCyan, vC_DimCyan,"",&vStdColors[vC_DimCyan],CA_None,isSens,M_ColorFrame,M_DimMagenta,M_Black,vC_Size}, -#endif diff --git a/v/includex/v/vcbtncmd.h b/v/includex/v/vcbtncmd.h deleted file mode 100644 index 139e1d1..0000000 --- a/v/includex/v/vcbtncmd.h +++ /dev/null @@ -1,52 +0,0 @@ -//=============================================================== -// vcbtncmd.h - Color Button Command class -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VCBTNCMD_H -#define VCBTNCMD_H - -#include -#include -#include // We are derived from vbtncmd -#include - -extern "C" // wrap in "C" -{ -#include -#include -} - - class vCmdParent; - - class vColorButtonCmd : public vButtonCmd - { - - public: //---------------------------------------- public - - vColorButtonCmd(vCmdParent* dp, CommandObject* co); - - virtual ~vColorButtonCmd(); - - virtual void SetCmdVal(ItemVal val, ItemSetType st); - - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - - vColor _color; // color of this button - vColor* _origColor; - - Pixel _pixel; - - void initColor(void); - - }; -#endif diff --git a/v/includex/v/vchkboxc.h b/v/includex/v/vchkboxc.h deleted file mode 100644 index 4713daf..0000000 --- a/v/includex/v/vchkboxc.h +++ /dev/null @@ -1,58 +0,0 @@ -//=============================================================== -// vckboxc.h - CheckBox Command class -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VCKBOXC_H -#define VCKBOXC_H - -#include // We are derived from vcmd - -extern "C" // wrap in "C" -{ -#include -#include -} - - class vCmdParent; - - extern "C" - { - void CCheckBoxCmdCB(Widget, XtPointer, XtPointer); - } - - class vCheckBoxCmd : public vCmd - { - friend void CCheckBoxCmdCB(Widget, XtPointer, XtPointer); - - public: //---------------------------------------- public - - vCheckBoxCmd(vCmdParent* dp, CommandObject* co); - - virtual ~vCheckBoxCmd(); - - virtual void initialize(void); - - virtual void ResetItemValue(void); - - virtual int GetCmdValue(ItemVal id) VCONST; - - virtual void SetCmdVal(ItemVal val, ItemSetType st); - - virtual void SetCmdStr(VCONST char* str); - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - - Widget _wLabel; // widget of the label - void CheckBoxCmdCB(void); // callback for user action - - }; -#endif diff --git a/v/includex/v/vclabelc.h b/v/includex/v/vclabelc.h deleted file mode 100644 index 1845fa4..0000000 --- a/v/includex/v/vclabelc.h +++ /dev/null @@ -1,52 +0,0 @@ -//=============================================================== -// vclabelc.h - Color Label Command class -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VCLABELC_H -#define VCLABELC_H - -#include -#include -#include // We are derived from vbtncmd -#include - -extern "C" // wrap in "C" -{ -#include -#include -} - - class vCmdParent; - - class vColorLabelCmd : public vLabelCmd - { - - public: //---------------------------------------- public - - vColorLabelCmd(vCmdParent* dp, CommandObject* co); - - virtual ~vColorLabelCmd(); - - virtual void SetCmdVal(ItemVal val, ItemSetType st); - - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - - vColor _color; // color of this button - vColor* _origColor; - - Pixel _pixel; - - void initColor(void); - - }; -#endif diff --git a/v/includex/v/vcmd.h b/v/includex/v/vcmd.h deleted file mode 100644 index 888b081..0000000 --- a/v/includex/v/vcmd.h +++ /dev/null @@ -1,81 +0,0 @@ -//=============================================================== -// vcmd.h - Base class for Cmds - normally used on Dialogs -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VCMD_H -#define VCMD_H - -#include // basic definitons - -extern "C" // wrap in "C" -{ -#include -#include -} - - // The definitions for this class are all contained in the .h file. - - class vCmdParent; - class vDialog; - - class vCmd - { - - friend class vCmdParent; - friend class vDialog; - - public: //---------------------------------------- public - - vCmd(vCmdParent* dp, CommandObject* co); - - virtual ~vCmd() {} - - void CopyToLocal(void); - - virtual void initialize(void) {} - - // define these to interface with specific Pane's setters - - virtual int GetCmdValue(ItemVal iv) VCONST {return 0;} - - virtual void ResetItemValue(void) { dlgCmd->retVal = _origVal;} - - virtual void SaveItemValue(void) { _origVal = dlgCmd->retVal;} - - virtual void SetCmdVal(ItemVal val, ItemSetType st) {} - - virtual void SetCmdStr(VCONST char* s) {} - - Widget GetWidget() { return (wBox != 0) ? wBox : wCmd;} - // stuff for tips - XtIntervalId GetIntId() { return _intervalId; } - void SetIntId(XtIntervalId iv) { _intervalId = iv; } - CommandObject* GetDlgCmd() { return dlgCmd; } - - protected: //--------------------------------------- protected - - vCmdParent* _parentWin; // parent window of this object - ItemVal _origVal; // original value of object - VCONST char* _title; - ItemVal _cmdId; - ItemVal _retVal; - int _Sensitive; - void* _itemList; - - Widget wParent; // parent widget used for this Cmd - Widget wBox; // many Cmds use a surrounding box - Widget wCmd; // main widget for this Cmd - - CommandObject* dlgCmd; // pointer to the static definition - - private: //--------------------------------------- private - XtIntervalId _intervalId; // stuff for tips - }; -#endif diff --git a/v/includex/v/vcmdpane.h b/v/includex/v/vcmdpane.h deleted file mode 100644 index 320e9a7..0000000 --- a/v/includex/v/vcmdpane.h +++ /dev/null @@ -1,49 +0,0 @@ -//=============================================================== -// vcmdpane.h - Command Pane class .h file - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VCMDPANE_H -#define VCMDPANE_H - -#include - -#include // we are derived from a pane -#include // and from cmdParent - - class vWindow; // we are part-of a vWindow - - class vCommandPane : public vPane, public vCmdParent - { - - public: //---------------------------------------- public - - vCommandPane(CommandObject* cList); - virtual ~vCommandPane(); - - virtual void ProcessCmd(ItemVal id, ItemVal rv, CmdType ct); - virtual void initialize(vWindow* pWin, Widget pWidget, - Widget drawCanvas = (Widget)0, Widget drawArea = (Widget)0); - virtual void ShowPane(int OnOrOff) VCONST; - - protected: //--------------------------------------- protected - - virtual int GetPaneValue(ItemVal id, int& val) VCONST; - virtual int GetPaneTextIn(ItemVal id, char* val, int maxlen) VCONST; -// virtual int GetPaneTextIn(ItemVal id, char* val, int maxlen VCONST; - virtual void SetPaneValue(ItemVal id, int val, ItemSetType setType); - virtual void SetPaneString(ItemVal id, VCONST char* str); - - - private: //--------------------------------------- private - - CommandObject* _origList; // handle to list of commands - - }; -#endif diff --git a/v/includex/v/vcmdprnt.h b/v/includex/v/vcmdprnt.h deleted file mode 100644 index fff4e7c..0000000 --- a/v/includex/v/vcmdprnt.h +++ /dev/null @@ -1,71 +0,0 @@ -//=============================================================== -// vcmdpar.h - A parent class for Cmds -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== -// -// This class is used by vDialog and CmdPane classes to -// allow the vCmd objects to have access to the ProcessCmd - -#ifndef VCMDPAR_H -#define VCMDPAR_H - -#include -#include - -extern "C" // wrap in "C" -{ -#include -} - - class vCmd; - - typedef struct DlgCmdList - { - vCmd* cmdP; // pointer to a command object - DlgCmdList* nextDCL; // next button - } DlgCmdList; - - class vCmdParent - { - public: //---------------------------------------- public - - vCmdParent(); - - virtual ~vCmdParent(); - - virtual void ProcessCmd(ItemVal id, ItemVal rv, CmdType ct) {} - - virtual int GetTextIn(ItemVal id, char* strout, int maxlen); - virtual int GetValue(ItemVal id) VCONST; - int HasId(ItemVal id) VCONST ; - virtual void SetValue(ItemVal id, ItemVal val, ItemSetType setType); - virtual void SetString(ItemVal id, VCONST char* str); - - virtual void SetFrameChildren(ItemVal frameId, int frameVal); - - DlgCmdList* GetCmdList() {return _cmdList;} // list of command items - - // These are platform dependent... - - Widget getParent(ItemVal id) VCONST; // to get parent widget - Widget getWidgetFromId(ItemVal id) VCONST; // also to get parent - Widget getFrameWidgetFromId(ItemVal id) VCONST; // also to get frame parent - - protected: //--------------------------------------- protected - - DlgCmdList* _cmdList; // list of command items - - Widget _wDialog; // widget used to hold dialog commands - - virtual vCmd* AddCmd(CommandObject* cmd); // Add a Cmd to the dialog - - private: //--------------------------------------- private - - }; -#endif diff --git a/v/includex/v/vcmdwin.h b/v/includex/v/vcmdwin.h deleted file mode 100644 index bb4dbff..0000000 --- a/v/includex/v/vcmdwin.h +++ /dev/null @@ -1,48 +0,0 @@ -//=============================================================== -// vcmdwin.h - vWin class definitions - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VCMDWIN_H -#define VCMDWIN_H - -#include // we are derived from vWindow class - - class vCmdWindow : public vWindow - { - friend class vMenuPane; - - public: //---------------------------------------- public - // the constructor - - vCmdWindow(VCONST char* name = "+", int width = 0, int height = 0); - - virtual ~vCmdWindow(); // Destructor - - // virtual methods - virtual void CloseWin(void); // callback for close button - virtual void _CloseWinFinal(void); - int NumCmdWindows() VCONST { return _numCmdWindows; } - - protected: //--------------------------------------- protected - vCmdWindow* GetCmdWinList() VCONST { return CmdWins; } - vCmdWindow* GetNextCmdWin() VCONST { return NextCmdWin; } - - private: //--------------------------------------- private - // data - static int _numCmdWindows; // how many total cmd windows are up - - static vCmdWindow* CmdWins; // list of all command windows - - int destroyed; // prevent multiple destruction - - vCmdWindow* NextCmdWin; // link to next window - - }; -#endif diff --git a/v/includex/v/vcolor.h b/v/includex/v/vcolor.h deleted file mode 100644 index 427c1aa..0000000 --- a/v/includex/v/vcolor.h +++ /dev/null @@ -1,118 +0,0 @@ -//=============================================================== -// vcolor.h: vColor class header for drawing - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VCOLOR_H -#define VCOLOR_H - -#include - -extern "C" // wrap in "C" -{ -#include -#include -} - -// For use in Color buttons -const int M_Black = 32200; -const int M_Red = 32201; -const int M_DimRed = 32202; -const int M_Green = 32203; -const int M_DimGreen = 32204; -const int M_Blue = 32205; -const int M_DimBlue = 32206; -const int M_Yellow = 32207; -const int M_DimYellow = 32208; -const int M_Magenta = 32209; -const int M_DimMagenta = 32210; -const int M_Cyan = 32211; -const int M_DimCyan = 32212; -const int M_DarkGray = 32213; -const int M_MedGray = 32214; -const int M_White = 32215; -const int M_ColorFrame = 32216; - -// Index into array -const int vC_Black = 0; -const int vC_Red = 1; -const int vC_DimRed = 2; -const int vC_Green = 3; -const int vC_DimGreen = 4; -const int vC_Blue = 5; -const int vC_DimBlue = 6; -const int vC_Yellow = 7; -const int vC_DimYellow = 8; -const int vC_Magenta = 9; -const int vC_DimMagenta = 10; -const int vC_Cyan = 11; -const int vC_DimCyan = 12; -const int vC_DarkGray = 13; -const int vC_MedGray = 14; -const int vC_White = 15; - - class vPen; - class vBrush; - - class vColor - { - friend class vPen; - friend class vBrush; - - public: //---------------------------------------- public - vColor(unsigned int rd = 0, unsigned int gr = 0, unsigned int bl = 0); - ~vColor(); - - vColor(const vColor& color); // copy constructor - vColor& operator =(const vColor& color); // = operator -#ifdef DONT_INLINE_COLOR_OPS - int operator ==(const vColor& c2) - {return (_r == c2._r && _g == c2._g && _b == c2._b);} - int operator !=(const vColor& c2) - {return (_r != c2._r || _g != c2._g || _b != c2._b);} -#endif - - int BitsOfColor() VCONST; - void ResetColor(unsigned int rd= 0, unsigned int gr = 0, unsigned int bl = 0); - void ResetColor(VCONST vColor& c); - void Set(unsigned int rd = 0, unsigned int gr = 0, unsigned int bl = 0); - void Set(VCONST vColor& c); - void SetR(unsigned int rd = 0); - void SetG(unsigned int gr = 0); - void SetB(unsigned int bl = 0); - - unsigned int r() const { return (unsigned int) _r;} - unsigned int g() const { return (unsigned int) _g;} - unsigned int b() const { return (unsigned int) _b;} - int IsMapped() VCONST { return _mapped != 0; } - void MapColor() VCONST;; - - Pixel pixel() VCONST { if (!_mapped) MapColor(); return _pixel; } - - protected: //--------------------------------------- protected - - unsigned char _r; - unsigned char _g; - unsigned char _b; - - private: //--------------------------------------- private - VMUTABLE unsigned char _mapped; - VMUTABLE Pixel _pixel; - }; - -#ifndef hpux - inline int operator==(const vColor &x, const vColor &y) - {return (x.r() == y.r() && x.g() == y.g() && x.b() == y.b());} - inline int operator != (const vColor& x, const vColor& y) - {return !(x == y);} -#endif - extern Pixel vXAllocColor(unsigned int r, unsigned int g, unsigned int b); - extern vColor vStdColors[16]; - extern char* vColorNames[16]; -#endif diff --git a/v/includex/v/vcomboc.h b/v/includex/v/vcomboc.h deleted file mode 100644 index 77384ce..0000000 --- a/v/includex/v/vcomboc.h +++ /dev/null @@ -1,78 +0,0 @@ -//=============================================================== -// vcomboc.h - ComboBox -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VCOMBOC_H -#define VCOMOBC_H - -#include // We are derived from vcmd - -extern "C" // wrap in "C" -{ -#include -#include -} - - const int MAX_COMBO_LIST = 64; // put 8 items in the list - - class vCmdParent; - - extern "C" - { -// void CComboAcceptCB(Widget w, XtPointer This, XtPointer lr); - void CComboDownCB(Widget w, XtPointer This, XtPointer lr); - void CComboBoxCmdCB(Widget w, XtPointer This, XtPointer lr); - } - - class vComboBoxCmd : public vCmd - { -// friend void CComboAcceptCB(Widget w, XtPointer This, XtPointer lr); - friend void CComboDownCB(Widget w, XtPointer This, XtPointer lr); - friend void CComboBoxCmdCB(Widget w, XtPointer This, XtPointer lr); - - public: //---------------------------------------- public - - vComboBoxCmd(vCmdParent* dp, CommandObject* dc); - - virtual ~vComboBoxCmd(); - - virtual void initialize(void); - - virtual int GetCmdValue(ItemVal id) VCONST; - virtual void SetCmdVal(ItemVal val, ItemSetType st); - - protected: //--------------------------------------- protected - - - private: //--------------------------------------- private - - char* _workList[MAX_COMBO_LIST]; // we will allow upto MAX_LIST items - - char** _fullList; // alias pointer to full list - int _maxWidth; // max width of any item - int _numItems; // number of items on list - int _curSelection; // index of current selected item - - int PoppedUp; - Widget _mainButton; // The main button of the combo - Widget _downButton; // Widget for the down button - Widget _popup; - Widget _popupList; - Widget _arrowBox; - - - void SetupComboList(void); - - void ComboBoxCmdCB(int index); // callback for user action -// void ComboAcceptCB(void); // callback for user action - void ComboDownCB(void); // callback for user action - - }; -#endif diff --git a/v/includex/v/vcpdc.h b/v/includex/v/vcpdc.h deleted file mode 100644 index 6d99cd1..0000000 --- a/v/includex/v/vcpdc.h +++ /dev/null @@ -1,47 +0,0 @@ -//=============================================================== -// vcpdc.h: CanvasPaneDC class .h file - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VCPDC_H -#define VCPDC_H - -#include - - class vCanvasPane; - - class vCanvasPaneDC : public vXDC - { - - public: //---------------------------------------- public - - vCanvasPaneDC(vCanvasPane* parentPane); - - virtual ~vCanvasPaneDC(); - - virtual void Clear(void); - virtual void SetBackground(VCONST vColor& color); - virtual void SetFont(VCONST vFont& vf); - - protected: //--------------------------------------- protected - - - private: //--------------------------------------- private - - virtual Drawable GetDrawable(); - - vCanvasPane* _parentPane; - - Widget _drawWidget; - - GC makeGC(Widget w); // make a GC to use - GC makeXorGC(Widget w); // make a GC to use - - }; -#endif diff --git a/v/includex/v/vctlclrs.h b/v/includex/v/vctlclrs.h deleted file mode 100644 index 173830c..0000000 --- a/v/includex/v/vctlclrs.h +++ /dev/null @@ -1,29 +0,0 @@ -/*=============================================================== -// v3dcolrs.h -- Centarl definitions of colors used to draw 3d stuff -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -// -// Note: this code is used by come C code, so needs old style comments -//=============================================================== */ - -#ifndef V3DCOLRS_H -#define V3DCOLRS_H - -extern "C" -{ -#include -} - - extern Pixel _vStatusBarBG; /* Background of status bar */ - extern Pixel _vDialogBG; /* Background for dialogs/command bar */ - extern Pixel _vMenuBarBG; /* Background for MenuBar */ - extern Pixel _vControlBG; /* Background for Controls */ - extern Pixel _vControlFace; /* Face of controls */ - extern Pixel _vLightControlShadow; /* light control shadow */ - extern Pixel _vDarkControlShadow; /* dark control shadow */ -#endif diff --git a/v/includex/v/vdc.h b/v/includex/v/vdc.h deleted file mode 100644 index 8f9e6ec..0000000 --- a/v/includex/v/vdc.h +++ /dev/null @@ -1,143 +0,0 @@ -//=============================================================== -// vdc.h: vDC class .h file - X11R5 -// -// Copyright (C) 1995-1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VDC_H -#define VDC_H - -#include // Basic defs -#include // for fonts -#include // for our pen -#include // for our brush - - class vIcon; - class vPrinter; - class vMemoryDC; - - typedef unsigned char ChrAttr; // An attribute for a display char - typedef unsigned char Chr; // A character to display - - typedef struct dChar // A display Char - { - ChrAttr attr; // The attribute of this char - Chr chr; // the character - } dChar; - -const ChrAttr ChNormal = 0; -const ChrAttr ChReverse = 0x01; -const ChrAttr ChHighlight = 0x02; -const ChrAttr ChBlackOnBG = 0x04; // Black on background color -const ChrAttr ChWhiteOnBG = 0x08; // White on background color -const ChrAttr ChDimColor = 0x80; // dim color (half intensity) -const ChrAttr ChRed = 0x40; // various colors -const ChrAttr ChGreen = 0x20; -const ChrAttr ChBlue = 0x10; -const ChrAttr ChYellow = 0x60; -const ChrAttr ChMagenta = 0x50; -const ChrAttr ChCyan = 0x30; -const ChrAttr ChGray = 0xF0; -const ChrAttr ChWhite = 0x70; - - class vDC - { - public: //---------------------------------------- public - vDC(void) { _Mult = 1; _Div = 1; _hasScale = 0; - _tx = 0; _ty = 0; _physHeight = _physWidth = 0;} - - virtual ~vDC(void) {} - - // Drawing - virtual void Clear(void) = 0; - virtual void ClearRect(int left, int top, int width, int height) = 0; - virtual void CopyFromMemoryDC(vMemoryDC* vmemdc, int destX, int destY, - int srcX = 0, int srcY = 0, int srcW = 0, int srcH = 0){}; // V:1.13 -#ifdef DRAWARC - virtual void DrawArc(int xx1, int yy1, int xx2, int yy2, int xxc, int yyc) = 0; -#endif - virtual void DrawAttrText(int x, int y, VCONST char* text, const ChrAttr attr) = 0; - virtual void DrawText(int x, int y, VCONST char* text) = 0; - virtual void DrawEllipse(int x, int y, int width, int height) = 0; - virtual void DrawIcon(int x, int y, VCONST vIcon& icon) {} - virtual void DrawLine(int x, int y, int xend , int yend) = 0; - virtual void DrawLines(vLine* lineList, int count) = 0; - virtual void DrawLines(vPoint* points, int n) = 0; - virtual void DrawColorPoints(int x, int y, int nPoints, vColor* pointList) {} - virtual void DrawPoint (int x, int y) = 0; - virtual void DrawPoints (vPoint* pointlist, int count) = 0; - virtual void DrawPolygon (int n, vPoint points[], - int fillStyle = vAlternate) = 0; - virtual void DrawRoundedRectangle(int x, int y, - int width, int height, int radius = 10) = 0; - virtual void DrawRectangle(int x, int y, int width, int height) = 0; - virtual void DrawRectangles(vRect* rectList, int count) = 0; - - // Not all DrawingCanvases need Rubber Lines! - virtual void DrawRubberLine(int x, int y, int xend, int yend) {} - virtual void DrawRubberEllipse(int x, int y, int width, int height) {} - virtual void DrawRubberPoint(int x, int y) {} - virtual void DrawRubberRectangle(int x, int y, int width, int height) {} - - // Printer - virtual int BeginPrinting(char* filename = 0, int ask = 1, int isColor = 0) {return 0;} - virtual void EndPrinting() {} - virtual void BeginPage() {} - virtual void EndPage() {} - - // Misc - - virtual int GetPhysHeight() VCONST { return _physHeight; } - virtual int GetPhysWidth() VCONST { return _physWidth; } - - virtual void SetBackground(VCONST vColor& color) = 0; - - virtual void SetScale(int mult, int div) - {_Mult = mult ; _Div = div ; _hasScale = (_Mult != 1 || _Div != 1); } - virtual void GetScale(int& m, int& d) VCONST { m = _Mult; d = _Div; } - - void SetTranslate(int x, int y) { _tx = x; _ty = y; } - void SetTransX(int x) {_tx = x;} - void SetTransY(int y) {_ty = y;} - void GetTranslate(int& x, int& y) {x = _tx; y = _ty;} - int GetTransX() VCONST { return _tx; } - int GetTransY() VCONST { return _ty; } - - virtual void SetBrush(VCONST vBrush& pen) = 0; - virtual vBrush GetBrush() VCONST { return _brush; } - - virtual void SetFont(VCONST vFont& vf) = 0; - virtual vFont GetFont() VCONST { return _font; } - - virtual void SetPen(VCONST vPen& pen) = 0; - virtual vPen GetPen() VCONST { return _pen; } - - virtual void SetPrinter(VCONST vPrinter& printer) {} - - virtual int TextHeight(int& asc, int& des) VCONST {return 0;} - virtual int TextWidth(VCONST char* str) VCONST {return 0;} - - protected: //--------------------------------------- protected - // V - vPen _pen; // the drawing pen - VMUTABLE vFont _font; // the current canvas font - vBrush _brush; // the painting brush - int _Mult; // scaling factors - int _Div; - int _hasScale; // if have scale - int _tx, _ty; // coordinate translation - - int _physHeight; // maximum height of canvas - int _physWidth; // max width of canvas - - int Scale(int x) { return (_hasScale) ? ((x*_Mult)/_Div) : x; } - - private: //--------------------------------------- private - - }; -#endif diff --git a/v/includex/v/vdebug.h b/v/includex/v/vdebug.h deleted file mode 100644 index 6e67443..0000000 --- a/v/includex/v/vdebug.h +++ /dev/null @@ -1,37 +0,0 @@ -//=============================================================== -// vdebug.h - set up debug -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VDEBUG_H -#define VDEBUG_H - -#include - - class vApp; - class vDebugDialog : public vModalDialog - { - public: //---------------------------------------- public - vDebugDialog(vBaseWindow* bw,char* title = "Debugging Options") : - vModalDialog(bw,title) { _cmdsAdded = 0; }; - vDebugDialog(vApp* aw,char* title = "Debugging Options") : - vModalDialog(aw,title) { _cmdsAdded = 0; }; - - ~vDebugDialog() {}; - - void SetDebug(); - - virtual void DialogCommand(ItemVal id, ItemVal val, CmdType ctype); - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - int _cmdsAdded; - }; -#endif diff --git a/v/includex/v/vdialog.h b/v/includex/v/vdialog.h deleted file mode 100644 index a744e22..0000000 --- a/v/includex/v/vdialog.h +++ /dev/null @@ -1,73 +0,0 @@ -//=============================================================== -// vdialog.h - general purpose dialog class - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VDIALOG_H -#define VDIALOG_H -#include // We inherit form vBaseWindow -#include // We also inherit from vCmdParent - - class vCmd; // Dialogs have Cmds - class vApp; - - class vDialog : public vBaseWindow, public vCmdParent - { - - public: //---------------------------------------- public - - vDialog(vBaseWindow* creator, int modal = 0, - VCONST char* title = ""); // The construtor - vDialog(vApp* creator, int modal = 0, - VCONST char* title = ""); // The construtor - vDialog(const vDialog&); // Copy constructor - ~vDialog(); - - void init(int modal, VCONST char* title); // finish constructor - virtual void AddDialogCmds(CommandObject* cList); // Add a list of Cmds - virtual void CancelDialog(void); // Cancel selected - virtual void CloseDialog(void); // Close dialog - virtual void SetDialogTitle(VCONST char * title); - - // Dialog action selected - virtual void DialogCommand(ItemVal id, ItemVal retval, CmdType ctype); - virtual void DialogDisplayed(); - - int IsDisplayed(void) VCONST { return _IsDisplayed; } // If displayed or not - virtual void GetDialogPosition(int& left, int& top, int& width, int& height) VCONST; - virtual void SetDialogPosition(int left, int top); - virtual void ShowDialog(VCONST char* msg); // called to invoke dialog - - - // functions from vCmdParent to override - - virtual void ProcessCmd(ItemVal id, ItemVal rv, CmdType ct); - - - protected: //--------------------------------------- protected - - virtual void showBaseWindow(void) { }; // no-op for dialog - - private: //--------------------------------------- private - - int _modal; // if modal or modeless - - Widget _parentHandle; - - Widget _dialogFrame; - - int _IsDisplayed; // if popped up or not - int _addedWDW; - - - vCmd* _DefaultButton; // for easy Warp to default button - vCmd* _FirstTextIn; // for SetKeyBoardFocus - - }; -#endif diff --git a/v/includex/v/vfilesel.h b/v/includex/v/vfilesel.h deleted file mode 100644 index b5d9ee8..0000000 --- a/v/includex/v/vfilesel.h +++ /dev/null @@ -1,57 +0,0 @@ -//=============================================================== -// vfilesel.h - reply modal dialog -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VFILESEL_H -#define VFILESEL_H -#include - -#define maxFiles 800 -#define maxDirs 200 -#define maxFileLen 200 - - class vApp; - class vFileSelect : protected vModalDialog - { - public: //---------------------------------------- public - vFileSelect(vBaseWindow* bw, VCONST char* title = "File Select") : - vModalDialog(bw,title) { _cmdsAdded = 0; } - vFileSelect(vApp* aw, VCONST char* title = "File Select") : - vModalDialog(aw,title) { _cmdsAdded = 0; } - ~vFileSelect() {} - - int FileSelect(VCONST char* msg, char* filename, - const int maxlen, char** filter, int& filterIndex); - int FileSelectSave(VCONST char* msg, char* filename, - const int maxlen, char** filter, int& filterIndex); - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - int curSel; - int dirSel; - int _cmdsAdded; - int _curFilter; - int _showHidden; - - const char* fileFilter; - char **filterPtr; // ptr to filter list - char curDir[maxFileLen]; // to hold current dir - char origFile[maxFileLen]; // to hold original file - char* fileList[maxFiles]; // the list of files - char* dirList[maxFiles]; // the list of directories - - virtual void DialogCommand(ItemVal id, ItemVal val, CmdType ctype); - - void GetDirList(const char *dir, const char* wild, - char** filelist, const int max, char** dirlist, const int maxdir); - - }; -#endif diff --git a/v/includex/v/vfinddlg.h b/v/includex/v/vfinddlg.h deleted file mode 100644 index 8345c4d..0000000 --- a/v/includex/v/vfinddlg.h +++ /dev/null @@ -1,43 +0,0 @@ -//=============================================================== -// vFind.h - reply modal dialog - common Win/X -// -// Copyright (C) 1995-1999 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef vFind_H -#define vFind_H -#include - -#ifndef V_EXPORT -#define V_EXPORT -#endif - - class V_EXPORT vApp; - class V_EXPORT vFindDialog : protected vModalDialog - { - public: //---------------------------------------- public - vFindDialog(vBaseWindow* bw, VCONST char* title = "Find") : - vModalDialog(bw, title) - { added = 0;} - vFindDialog(vApp *aw, VCONST char* title = "Find") : - vModalDialog(aw, title) - { added = 0;} - ~vFindDialog() {} - - int AskFindPat(char* reply, const int maxlen, int& caseSens, - int& Down, int& Wrap); - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - - int added; - virtual void DialogCommand(ItemVal id, ItemVal val, CmdType ctype); - - }; -#endif diff --git a/v/includex/v/vfont.h b/v/includex/v/vfont.h deleted file mode 100644 index 36d6daf..0000000 --- a/v/includex/v/vfont.h +++ /dev/null @@ -1,111 +0,0 @@ -//=============================================================== -// vfont.h - The font class - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VFONT_H -#define VFONT_H - -#include - - class vCanvasPane; // the vCanvasPane needs to the the X font - class vApp; // the vApp needs Xfont, too - class vListCmd; - class vComboBoxCmd; - - enum vFontID // various font related ids - { - vfDefaultSystem, // the default system font - vfDefaultFixed, // the system default fixed font - vfDefaultVariable, // the system default variable font - vfSerif, // serifed font - TimesRoman - vfSansSerif, // SansSerif - Swiss or Helvetica - vfFixed, // fixed font - Courier - vfDecorative, // decorative - dingbat - vfOtherFont, // for all other fonts - vfNormal, // normal style, weight - vfBold, // boldface - vfItalic, // italic style - vfSerif2, // alternative fonts... - vfSansSerif2, - vfFixed2, - vfDecorative2, - vfEndOfList - }; - - - class vFont // make the font stuff a class to make it portable - { - friend class vCanvasPane; - friend class vApp; - friend class vFontList; - - public: //---------------------------------------- public - vFont(vFontID fam = vfDefaultFixed, int size = 10, - vFontID sty = vfNormal, vFontID wt = vfNormal, - int und = 0, int ang = 0); - - vFont(const vFont &ft); // copy constructor - - ~vFont(); - - vFont& operator =(const vFont& ft) VCONST; // vFont = vFont - int operator ==(const vFont& ft) VCONST - { return (_family == ft._family && _style == ft._style && - _weight == ft._weight && _pointSize == ft._pointSize && - _underlined == ft._underlined && _angle == ft._angle); } - - int operator !=(const vFont& ft) VCONST - { return !(_family == ft._family && _style == ft._style && - _weight == ft._weight && _pointSize == ft._pointSize && - _underlined == ft._underlined && _angle == ft._angle); } - - void SetNativeFontString(char* fontStr); - void GetNativeFontString(char* fontStr); - - - vFontID GetFamily() VCONST { return _family; } - - int GetPointSize() VCONST { return _pointSize; } - - vFontID GetStyle() VCONST { return _style; } - - vFontID GetWeight() VCONST { return _weight; } - - int GetUnderlined() VCONST { return _underlined; } - - int GetAngle() VCONST { return _angle; } - - void SetFontValues(vFontID fam = vfDefaultFixed, int size = 10, - vFontID sty = vfNormal, vFontID wt = vfNormal, int und = 0, int ang = 0); - - // Following should be used only internally - - void LoadFont() VCONST; // make sure font with given id is loaded - - int XTextW(VCONST char* str) VCONST; - int XFontH(int& asc, int& des) VCONST; - - XFontStruct* GetXFont() { return _XFont;} - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - VMUTABLE vFontID _family; // family - vfSerif, etc. - VMUTABLE vFontID _style; // style - nomal, italic - VMUTABLE vFontID _weight; // weight - normal, light, bold - VMUTABLE int _pointSize; // point size of font - VMUTABLE int _underlined; // if underlined or not - VMUTABLE int _angle; // angle to print at - - VMUTABLE XFontStruct* _XFont; // windows handle to font - - }; - -#endif diff --git a/v/includex/v/vfontlst.h b/v/includex/v/vfontlst.h deleted file mode 100644 index 7c2969c..0000000 --- a/v/includex/v/vfontlst.h +++ /dev/null @@ -1,34 +0,0 @@ -//=============================================================== -// vfontlst.h - Font List for loaded fonts -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== -#ifndef VFONTLST_H -#define VFONTLST_H -#include - - typedef struct fontList - { - vFont font; - fontList* next; - } fontList; - - class vFontList - { - public: //---------------------------------------- public - vFontList(); - ~vFontList(); - - void AddFont(vFont& f) VCONST; - vFont* FindFont(vFont& ff) VCONST; - - protected: //--------------------------------------- protected - private: //--------------------------------------- private - VMUTABLE fontList* _list; - }; -#endif diff --git a/v/includex/v/vfontsel.h b/v/includex/v/vfontsel.h deleted file mode 100644 index b008668..0000000 --- a/v/includex/v/vfontsel.h +++ /dev/null @@ -1,39 +0,0 @@ -//=============================================================== -// vfontsel.h - font select modal dialog -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VSELFONT_H -#define VSELFONT_H -#include -#include - - class vApp; - - class vFontSelect : protected vModalDialog - { - public: //---------------------------------------- public - vFontSelect(vBaseWindow* bw, VCONST char* title = "Select Font") : - vModalDialog(bw, title) {_added = 0;} - vFontSelect(vApp* aw, VCONST char* title = "Select Font") : - vModalDialog(aw, title) {_added = 0;} - ~vFontSelect() {} - - int FontSelect(vFont& font, const char* msg = "Select Font", - int fixedOnly = 0 ); - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - - virtual void DialogCommand(ItemVal id, ItemVal val, CmdType ctype); - int _added; - - }; -#endif diff --git a/v/includex/v/vframec.h b/v/includex/v/vframec.h deleted file mode 100644 index 22b08f8..0000000 --- a/v/includex/v/vframec.h +++ /dev/null @@ -1,42 +0,0 @@ -//=============================================================== -// vframec.h - Frame Command class -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VFRAMEC_H -#define VFRAMEC_H - -#include // We are derived from vcmd - -extern "C" // wrap in "C" -{ -#include -#include -} - - class vCmdParent; - - class vFrameCmd : public vCmd - { - - public: //---------------------------------------- public - - vFrameCmd(vCmdParent* dp, CommandObject* co); - - virtual ~vFrameCmd(); - - virtual void initialize(void); - virtual void SetCmdVal(ItemVal val, ItemSetType st); - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - - }; -#endif diff --git a/v/includex/v/vicon.h b/v/includex/v/vicon.h deleted file mode 100644 index 91fffe6..0000000 --- a/v/includex/v/vicon.h +++ /dev/null @@ -1,47 +0,0 @@ -//=============================================================== -// vicon.h - Class for Icons -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VICON_H -#define VICON_H - -#include - - enum IconType {Normal, Transparent}; // types of icons - - class vIcon // an icon - { - friend class vCanvasPaneDC; - friend class vLabelCmd; - friend class vButtonCmd; - - public: //---------------------------------------- public - vIcon(unsigned char* ic, int h, int w, int d = 1, IconType it = Normal); - ~vIcon(); - - IconType iType; // type of icon - int height; // height in pixels - int width; // width in pixels - int depth; // bits per pixel - unsigned char* icon; // ptr to icon array - - Pixmap GetXPM(int cmd = 0, unsigned long pbg = 0) VCONST; // X version - Pixmap GetInsensXPM(int cmd = 0, unsigned long pbg = 0) VCONST; // X version - - protected: //--------------------------------------- protected - private: //--------------------------------------- private - VMUTABLE Pixmap _pm; - VMUTABLE Pixmap _inspm; - static GC _GC; - static GC _insGC; - int _cmd; - - }; -#endif diff --git a/v/includex/v/vkeys.h b/v/includex/v/vkeys.h deleted file mode 100644 index 797e843..0000000 --- a/v/includex/v/vkeys.h +++ /dev/null @@ -1,99 +0,0 @@ -//=============================================================== -// vkeys.h - Defintions for V keys -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VKEYS_H -#define VKEYS_H - -#define vk_None 0x0 /* no key */ - - // Masks for various shift modes - -#define VKM_Shift 1 -#define VKM_Ctrl 4 -#define VKM_Alt 8 - -#define vk_BackSpace 0x08 -#define vk_Tab 0x09 -#define vk_Linefeed 0x0A -#define vk_Return 0x0D -#define vk_Pause 0x13 -#define vk_Escape 0x1B -#define vk_Delete 0x7F - -#define vk_BackTab 0xFF09 - -#define vk_Home 0xFF50 -#define vk_Left 0xFF51 -#define vk_Up 0xFF52 -#define vk_Right 0xFF53 -#define vk_Down 0xFF54 -#define vk_Page_Up 0xFF55 -#define vk_Page_Down 0xFF56 -#define vk_End 0xFF57 -#define vk_Insert 0xFF58 - -#define vk_Num_Lock 0xFF7F - -#define vk_KP_Enter 0xFF0D -#define vk_KP_Home 0xFF95 -#define vk_KP_Left 0xFF96 -#define vk_KP_Up 0xFF97 -#define vk_KP_Right 0xFF98 -#define vk_KP_Down 0xFF99 -#define vk_KP_Page_Up 0xFF9A -#define vk_KP_Page_Down 0xFF9B -#define vk_KP_End 0xFF9C -#define vk_KP_Insert 0xFF9E -#define vk_KP_Delete 0xFF7F -#define vk_KP_Equal 0xFF3D -#define vk_KP_Multiply 0xFF2A -#define vk_KP_Add 0xFF2B -#define vk_KP_Subtract 0xFF2D -#define vk_KP_Decimal 0xFF2E -#define vk_KP_Divide 0xFF2F - -#define vk_KP_0 0xFF30 -#define vk_KP_1 0xFF31 -#define vk_KP_2 0xFF32 -#define vk_KP_3 0xFF33 -#define vk_KP_4 0xFF34 -#define vk_KP_5 0xFF35 -#define vk_KP_6 0xFF36 -#define vk_KP_7 0xFF37 -#define vk_KP_8 0xFF38 -#define vk_KP_9 0xFF39 - - -#define vk_F1 0xFFC1 -#define vk_F2 0xFFC2 -#define vk_F3 0xFFC3 -#define vk_F4 0xFFC4 -#define vk_F5 0xFFC5 -#define vk_F6 0xFFC6 -#define vk_F7 0xFFC7 -#define vk_F8 0xFFC8 -#define vk_F9 0xFFC9 -#define vk_F10 0xFFCA -#define vk_F11 0xFFCB -#define vk_F12 0xFFCC - -// The following are modifer keys pressed by themselves - -#define vk_Shift 0xFFE1 -#define vk_Control 0xFFE4 -#define vk_Caps_Lock 0xFFE5 -#define vk_Alt 0xFFE9 - -#define vk_IsModifier(x) (x>=vk_Shift && x<=vk_Alt) - -#define vk_space 0x020 -#define vk_asciitilde 0x07e -#endif diff --git a/v/includex/v/vlabelc.h b/v/includex/v/vlabelc.h deleted file mode 100644 index fb24797..0000000 --- a/v/includex/v/vlabelc.h +++ /dev/null @@ -1,45 +0,0 @@ -//=============================================================== -// vlablec.h - Lable Command Class -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VLABELC_H -#define VLABELC_H - -#include -#include // We are derived from vcmd - -extern "C" // wrap in "C" -{ -#include -#include -} - - class vCmdParent; - - class vLabelCmd : public vCmd - { - - public: //---------------------------------------- public - - vLabelCmd(vCmdParent* dp, CommandObject* co); - - virtual ~vLabelCmd(); - - virtual void initialize(void); - - virtual void SetCmdStr(VCONST char* str); - virtual void SetCmdVal(ItemVal val, ItemSetType st); - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - - }; -#endif diff --git a/v/includex/v/vlistc.h b/v/includex/v/vlistc.h deleted file mode 100644 index b22085e..0000000 --- a/v/includex/v/vlistc.h +++ /dev/null @@ -1,97 +0,0 @@ -//=============================================================== -// vlistc.h - List Command class -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VLISTC_H -#define VLISTC_H - -#include // We are derived from vcmd - -extern "C" // wrap in "C" -{ -#include -#include -#ifndef Athena -#include -#endif -} - - const int MAX_LIST = 32; // max items in the list - - class vCmdParent; - - extern "C" - { - void CListCmdCB(Widget w, XtPointer This, XtPointer lr); -#ifdef Athena - void CJumpProcCB(Widget w, XtPointer This, XtPointer pc_ptr); - void CScrollProcCB(Widget w, XtPointer This, XtPointer position); -#endif - } - - class vListCmd : public vCmd - { - friend void CListCmdCB(Widget w, XtPointer This, XtPointer lr); -#ifdef Athena - friend void CJumpProcCB(Widget w, XtPointer This, XtPointer pc_ptr); - friend void CScrollProcCB(Widget w, XtPointer This, XtPointer position); -#endif - - public: //---------------------------------------- public - - vListCmd(vCmdParent* dp, CommandObject* co); - - virtual ~vListCmd(); - - virtual void initialize(void); - - virtual int GetCmdValue(ItemVal id) VCONST; - virtual void SetCmdVal(ItemVal val, ItemSetType st); - - protected: //--------------------------------------- protected - - - private: //--------------------------------------- private - -#ifdef Athena - Widget _wScroll; // Scroll widget for list - - int _ScrlTop; // Position of top of thumb - int _ScrlShown; // Portion of thumb shown - int _scale; // scale factor - float _fscale; // scale factor - - char* _workList[MAX_LIST + 1]; // we will make up to a 32 item list -#endif - - int _workMapsTo; // _workList[0] maps to _fullList[n] - - char** _fullList; // alias pointer to full list - int _maxWidth; // max width of any item - int _numItems; // number of items on list - int _curSelection; // index of current selected item - int _listRows; // how many rows user wanted (8 def) - -#ifndef Athena - XmStringTable _strList; // copy for motif widget - int _listItems; // length -#else - void SetScroll(int Shown, int Top); // set scroll values - void DoScroll(int cnt); // scroll list by n lines - void ScrollProcCB(int position); - void JumpProcCB(int percent); -#endif - - void SetupList(void); - - void ListCmdCB(int index); // callback for user action - - }; -#endif diff --git a/v/includex/v/vmemdc.h b/v/includex/v/vmemdc.h deleted file mode 100644 index 2d7d492..0000000 --- a/v/includex/v/vmemdc.h +++ /dev/null @@ -1,46 +0,0 @@ -//=============================================================== -// vcpdc.h: MemoryDC class .h file - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VMEMDC_H -#define VMEMDC_H - -#include - - class vMemory; - - class vMemoryDC : public vXDC - { - - public: //---------------------------------------- public - - vMemoryDC(int width = 256, int height = 256); - - virtual ~vMemoryDC(); - - virtual void Clear(void); - virtual void SetBackground(VCONST vColor& color); - - int CreatedOK() VCONST {return _pixmap != 0;} - - virtual Drawable GetDrawable() VCONST; - - protected: //--------------------------------------- protected - - - private: //--------------------------------------- private - - Pixmap _pixmap; - - GC makeGC(); // make a GC to use - GC makeXorGC(); // make a GC to use - - }; -#endif diff --git a/v/includex/v/vmenu.h b/v/includex/v/vmenu.h deleted file mode 100644 index 8dfaaa6..0000000 --- a/v/includex/v/vmenu.h +++ /dev/null @@ -1,114 +0,0 @@ -//=============================================================== -// vmenu.h - vmenu class definitions - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VMENU_H -#define VMENU_H - -#include - -#include // we are derived from a pane - -// The _menuButton array will point to static arrays of menus. -// The user will allocate these, e.g.: -// -// vMenu EditMenu[] = -// { -// {"Item 1", MENU_1, isSens, notChk, noKeyLbl, noKey, noSub}, -// {"Item 2", MENU_2, isSens, notChk, noKeyLbl, noKey, noSub}, -// {NULL} -// }; -// -// and to define the menu bar -// -// vMenu myMenu[] = -// { -// {"Edit", M_File, isSens, notChk, noKeyLbl, noKey, &EditMenu[0]}, -// {NULL} -// }; -// -// the _menuButton will be done dynamically. The call back -// will pass the value of an item to a given window. - - typedef struct MenuInfo // Implementation dependent stuff - { - Widget WItem; // Widget for each menu item - int ItemIndex; - int SubMenuIndex; - MenuInfo* NxtInfo; - } MenuInfo; - - typedef struct MenuButton - { - VCONST char* label; // Label for button - vMenu* SubMenu; // the menu items associated with this button - MenuInfo* mInfo; // dynamically allocated info list - - // System dependent handles - - Widget XMenuButton; // an X widget for the button - Widget XPopUp; // and X widget for the popup - } MenuButton; - - const int MAX_MENU_BUTTONS = 80; // Up to 20 menu buttons + submenus - // per window - - extern "C" - { - void CmenuCB(Widget w, XtPointer ItmPtr, XtPointer call_data); - }; - - class vWindow; - class vCmdWindow; // we are part of a vCmdWindow - - class vMenuPane : public vPane - { - friend void CmenuCB(Widget w, XtPointer ItmPtr, XtPointer call_data); - - friend class vWindow; - friend class vCmdWindow; - - public: //---------------------------------------- public - // the constructors - vMenuPane(VCONST vMenu* menu); - vMenuPane(const vMenuPane& m); // Copy constructor - virtual ~vMenuPane(); // Destructor - - - // non-virtual methods - - void initialize(vWindow* pWin, Widget pWidget, - Widget drawCanvas = (Widget)0, Widget drawArea = (Widget)0); - vMenuPane* GetMenuThis(Widget w); - void doSubMenu(Widget parent, Widget subitem, int x, int y); - int CheckAccel(vKey vkey, unsigned int shift, ItemVal& id) VCONST; - - protected: //--------------------------------------- protected - - virtual int GetPaneValue(ItemVal id, int& val) VCONST; - virtual void SetPaneValue(ItemVal id, int val, ItemSetType setType); - - virtual void SetPaneString(ItemVal id, VCONST char* str); // set menu item label - - private: //--------------------------------------- private - // data - - int _nextMenuButton; - int _nextSubMenu; - MenuButton _mb[MAX_MENU_BUTTONS]; // Up to 10 menu items per window - - // methods - void doAddMenu(int id, Widget parent); // build the menu - void menuCB(Widget w); // callback for menu selection - - void fixLabel(VCONST char* lbl, VCONST char* key = 0, int isMainMenu = 0) VCONST; - }; - -#endif diff --git a/v/includex/v/vmodald.h b/v/includex/v/vmodald.h deleted file mode 100644 index b2702b0..0000000 --- a/v/includex/v/vmodald.h +++ /dev/null @@ -1,46 +0,0 @@ -//=============================================================== -// vmodald.h - general purpose modal dialog class - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VMODALD_H -#define VMODALD_H - -#include // derived from vDialog - - class vApp; - class vModalDialog : public vDialog - { - public: //---------------------------------------- public - - vModalDialog(vBaseWindow* creator, VCONST char* title = ""); - vModalDialog(vApp* creator, VCONST char* title = ""); - virtual ~vModalDialog(); - - virtual void CloseDialog(void); - - // called when command entered - virtual void DialogCommand(ItemVal id, ItemVal retval, CmdType ctype); - - virtual void ShowDialog(VCONST char* msg); // called to invoke the dialog - - virtual ItemVal ShowModalDialog(VCONST char* msg, ItemVal& retval); - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - - void WaitForX(int* flag); - int _mdDone; // for returning modally - ItemVal _mdItemVal; - ItemVal _mdItemID; - CmdType _mdCmdType; - - }; -#endif diff --git a/v/includex/v/vnlprntr.h b/v/includex/v/vnlprntr.h deleted file mode 100644 index 3a7c836..0000000 --- a/v/includex/v/vnlprntr.h +++ /dev/null @@ -1,77 +0,0 @@ -//=============================================================== -// vnlprntr.h: null Printer class .h file - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VNLPRNTR_H -#define VNLPRNTR_H - -#define vPaperLetter 0 -#define vPaperLegal 1 -#define vPaperTabloid 2 -#define vPaperLedger 3 -#define vPaperStatement 4 -#define vPaperExecutive 5 -#define vPaperA3 6 -#define vPaperA4 7 -#define vPaperA5 8 -#define vPaperB4 9 -#define vPaperB5 10 -#define vPaperFolio 11 -#define vPaperQuarto 12 -#define vPaper10x14 13 - -#define vPaperDefault vPaperLetter // Index to default paper - - class vNullPrinter - { - class ofstream; - public: //---------------------------------------- public - vNullPrinter(){} - ~vNullPrinter(){} - - ofstream* OpenPrinter() VCONST {return 0;} - void ClosePrinter() {} - - int GetHeight() VCONST {return _height;} - int GetWidth() VCONST {return _width;} - - VCONST char* GetDocName() VCONST {return 0;} - - int GetPortrait() VCONST {return _portrait;} - void SetPortrait(int p) {_portrait = p;} - - int GetUseColors() VCONST {return _useColor;} - void SetUseColors(int c) {_useColor = c;} - - int GetPaper() VCONST {return _paperType;} - VCONST char* GetPaperName() VCONST {return 0;} - - int GetCopies() VCONST {return _copies;} - void SetCopies(int s) {_copies = s;} - - int GetToFile() VCONST {return _toFile;} - - int Setup( VCONST char* fn = 0) VCONST {return 0;} - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - - int _width; // width of printer - int _height; // height of printer - int _portrait; // true if portrait, else landscape - int _useColor; // true if printer supports colors - - int _paperType; - int _copies; - int _toFile; - }; - -#endif diff --git a/v/includex/v/vnotice.h b/v/includex/v/vnotice.h deleted file mode 100644 index c4abe04..0000000 --- a/v/includex/v/vnotice.h +++ /dev/null @@ -1,36 +0,0 @@ -//=============================================================== -// vnotice.h - notice modal dialog -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VNOTICE_H -#define VNOTICE_H -#include - - class vApp; - class vNoticeDialog : protected vModalDialog - { - public: //---------------------------------------- public - vNoticeDialog(vBaseWindow* bw, VCONST char* title = "Notice") : - vModalDialog(bw,title) { _cmdsAdded = 0; } - vNoticeDialog(vApp* aw, VCONST char* title = "Notice") : - vModalDialog(aw,title) { _cmdsAdded = 0; } - ~vNoticeDialog() {} - - void Notice(VCONST char* msg); - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - - int _cmdsAdded; - virtual void DialogCommand(ItemVal id, ItemVal val, CmdType ctype); - - }; -#endif diff --git a/v/includex/v/vnulldc.h b/v/includex/v/vnulldc.h deleted file mode 100644 index 9f9438d..0000000 --- a/v/includex/v/vnulldc.h +++ /dev/null @@ -1,75 +0,0 @@ -//=============================================================== -// vnulldc.h: a NULL DC class .h file - All platforms -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VNULLDC_H -#define VNULLDC_H - -#include - -class vNullDC : public vDC -{ -public: //---------------------------------------- public - vNullDC(void) {} - virtual ~vNullDC() {} - - // Drawing - virtual void Clear(void) {} - virtual void ClearRect(int left, int top, int width, int height) {} - virtual void DrawAttrText(int x, int y, VCONST char* text, VCONST ChrAttr attr) {} - virtual void DrawText(int x, int y, VCONST char* text) {} - virtual void DrawEllipse(int x, int y, int width, int height) {} - virtual void DrawIcon(int x, int y, VCONST vIcon& icon) {} - virtual void DrawLine(int x, int y, int xend , int yend) {} - virtual void DrawPoint (int x, int y) {} - virtual void DrawPolygon (int n, vPoint points[], - int fillStyle = vAlternate) {} - virtual void DrawRoundedRectangle(int x, int y, - int width, int height, int radius = 10) {} - virtual void DrawRectangle(int x, int y, int width, int height) {} - virtual void DrawLines(vLine* lineList){}; - virtual void DrawPoints (vPoint* pointList){}; - virtual void DrawRectangles(vRect* rectList){}; - - // Misc - - virtual int GetPhysHeight() VCONST { return 0; } - virtual int GetPhysWidth() VCONST { return 0; } - - virtual void SetBackground(VCONST vColor& color) {} - - virtual void SetScale(int mult, int div) {} - virtual void GetScale(int& m, int& d) VCONST { m = 1; d = 1; } - - void SetTranslate(int x, int y) { } - void SetTransX(int x) {} - void SetTransY(int y) {} - void GetTranslate(int& x, int& y) VCONST {x = 0; y = 0;} - int GetTransX() VCONST { return 0; } - int GetTransY() VCONST { return 0; } - - virtual void SetFont(VCONST vFont& vf) {} - virtual vFont GetFont() VCONST { return _vf; } - - virtual void SetPen(VCONST vPen& /*pen*/) {} - virtual vPen GetPen() VCONST { return _vp; } - - virtual void SetBrush(VCONST vBrush& brush) {}; - virtual vBrush GetBrush() VCONST { return _vb; } - - virtual int TextHeight(int& asc, int& des) VCONST {asc = des = 0; return 0;} - virtual int TextWidth(VCONST char* str) VCONST {return 0;} - -private: - vFont _vf; - vBrush _vb; - vPen _vp; -}; -#endif diff --git a/v/includex/v/vos.h b/v/includex/v/vos.h deleted file mode 100644 index 1a05d2e..0000000 --- a/v/includex/v/vos.h +++ /dev/null @@ -1,37 +0,0 @@ -//=============================================================== -// vos. - the OS interface object -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VOS_H -#define VOS_H - - class vOS - { - public: - vOS(); - ~vOS(); - - - char* vGetFullPath(char *buf, char *fname, int len); - int vGetEnvVal(char* name, char *val, int maxlen=255); - int vChDrive(int drive); - int vGetUserName( char* s, int len); - void vGetHostName(char* s, int len); - long vGetPid(); - int vGetCWD(char* buf, int len); - int vChDir(const char *path); - void vSleep(long MSec); - - int vDeleteFile(const char* filename); - int vRenameFile(const char* filename, const char* newFilename); - int vRunProcess(const char* cmd, const char* StdOut = 0, - const char* StdErr = 0, const int Wait = 0, const int minimize = 0); - }; -#endif diff --git a/v/includex/v/vpane.h b/v/includex/v/vpane.h deleted file mode 100644 index c0136cf..0000000 --- a/v/includex/v/vpane.h +++ /dev/null @@ -1,78 +0,0 @@ -//=============================================================== -// vpane.h - Base class for window panes -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VPANE_H -#define VPANE_H - -// panes will be canvases, menus, and command bars - -#include // basic definitons - -extern "C" // wrap in "C" -{ -#include -#include -} - -// This is a small class, and everything is inline here -// in the .h file. - - class vWindow; // all panes are part-of a vWindow - - class vPane - { - friend class vWindow; - friend class vCmdWindow; - - public: //---------------------------------------- public - - vPane(PaneType pt) - { - SysDebug1(Constructor,"vPane::vPane(type: %d) constructor\n",pt) - _paneType = pt; - } - - virtual ~vPane() - { - SysDebug(Destructor,"vPane::~vPane() destructor\n") - } - - virtual void initialize(vWindow* pw, Widget bw, - Widget drawCanvas = (Widget)0, Widget drawArea = (Widget)0) - {_parentWin = pw; _baseW = bw; } - - // define these to interface with specific Pane's setters - - virtual int GetPaneValue(ItemVal /* id */, int& /* v */) VCONST {return 0;} - - virtual int GetPaneTextIn(ItemVal /* id */, char* /* v */, int /*max*/) VCONST {return 0;} - - virtual void SetPaneValue(ItemVal /* id */, int /* v */, ItemSetType /* st */) {} - - virtual void SetPaneString(ItemVal /* id */, VCONST char* /* s */) {} - - virtual void ShowPane(int /* OnOrOff */) VCONST {} - - virtual vWindow* GetPaneParent() {return _parentWin; } - - protected: //--------------------------------------- protected - - vWindow* _parentWin; // parent window of this object - - Widget _baseW; // base widget used for this pane - - PaneType _paneType; // type of this pane - - private: //--------------------------------------- private - - - }; -#endif diff --git a/v/includex/v/vpaneold.h b/v/includex/v/vpaneold.h deleted file mode 100644 index 51b6c64..0000000 --- a/v/includex/v/vpaneold.h +++ /dev/null @@ -1,76 +0,0 @@ -//=============================================================== -// vpane.h - Base class for window panes -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VPANE_H -#define VPANE_H - -// panes will be canvases, menus, and command bars - -#include // basic definitons - -extern "C" // wrap in "C" -{ -#include -#include -} - -// This is a small class, and everything is inline here -// in the .h file. - - class vWindow; // all panes are part-of a vWindow - - class vPane - { - friend class vWindow; - friend class vCmdWindow; - - public: //---------------------------------------- public - - vPane(PaneType pt) - { - SysDebug1(Constructor,"vPane::vPane(type: %d) constructor\n",pt) - _paneType = pt; - } - - virtual ~vPane() - { - SysDebug(Destructor,"vPane::~vPane() destructor\n") - } - - virtual void initialize(vWindow* pw, Widget bw, - Widget drawCanvas = (Widget)0, Widget drawArea = (Widget)0) - {_parentWin = pw; _baseW = bw; } - - // define these to interface with specific Pane's setters - - virtual int GetPaneValue(ItemVal /* id */, int& /* v */) VCONST {return 0;} - - virtual void SetPaneValue(ItemVal /* id */, int /* v */, ItemSetType /* st */) {} - - virtual void SetPaneString(ItemVal /* id */, VCONST char* /* s */) {} - - virtual void ShowPane(int /* OnOrOff */) VCONST {} - - virtual vWindow* GetPaneParent() {return _parentWin; } - - protected: //--------------------------------------- protected - - vWindow* _parentWin; // parent window of this object - - Widget _baseW; // base widget used for this pane - - PaneType _paneType; // type of this pane - - private: //--------------------------------------- private - - - }; -#endif diff --git a/v/includex/v/vpen.h b/v/includex/v/vpen.h deleted file mode 100644 index a4e5bfa..0000000 --- a/v/includex/v/vpen.h +++ /dev/null @@ -1,68 +0,0 @@ -//=============================================================== -// vpen.h: pen class header for drawing - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VPEN_H -#define VPEN_H - -#include // Basic defs -#include - -extern "C" // wrap in "C" -{ -#include -#include -} - - class vPen - { - public: //---------------------------------------- public - vPen(unsigned int r = 0, unsigned int g = 0, unsigned int b = 0, - int width = 1, int style = vSolid) - { - penColor._r = r, penColor._g = g; penColor._b = b; - penWidth = width; penStyle = style; - } - - // Default shallow copy constructor and assignment will be OK - - int operator ==(const vPen& p2) VCONST - { return (penColor == p2.penColor && penWidth == p2.penWidth && - penStyle == p2.penStyle); } - - int operator !=(const vPen& p2) VCONST - { return (penColor != p2.penColor || penWidth != p2.penWidth || - penStyle != p2.penStyle); } - - void SetStyle(int style) { penStyle = style;} - int GetStyle(void) VCONST { return penStyle; } - void SetWidth(int width) { penWidth = width;} - int GetWidth() VCONST { return penWidth; } - - void SetColor(VCONST vColor& c) {if (c != penColor) penColor = c; } - void SetColor(unsigned int r, unsigned int g, unsigned int b) - { if (penColor.r() != r || penColor.g() != g || penColor.b() != b) - penColor.Set(r,g,b); - } - vColor GetColor() VCONST { return penColor; } - - ~vPen() {} - - void SetPenToPixel(Pixel px) { penColor._pixel = px; penColor._mapped = 1;} - - vColor penColor; - int penWidth; - int penStyle; - - protected: //--------------------------------------- protected - private: //--------------------------------------- private - }; - -#endif diff --git a/v/includex/v/vpopmenu.h b/v/includex/v/vpopmenu.h deleted file mode 100644 index 9eda989..0000000 --- a/v/includex/v/vpopmenu.h +++ /dev/null @@ -1,122 +0,0 @@ -//=============================================================== -// vpopmenu.h - vpopmenu class definitions - X -// -// Copyright (C) 1995-1999 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VPOPMENU_H -#define VPOPMENU_H - -#include -#include - -// The _menuButton array will point to static arrays of menus. -// The user will allocate these, e.g.: -// -// vMenu EditMenu[] = -// { -// {"Item 1", MENU_1, isSens, notChk, noKeyLbl, noKey, noSub}, -// {"Item 2", MENU_2, isSens, notChk, noKeyLbl, noKey, noSub}, -// {NULL} -// }; -// -// and to define the menu bar -// -// vMenu myMenu[] = -// { -// {"Edit", M_File, isSens, notChk, noKeyLbl, noKey, &EditMenu[0]}, -// {NULL} -// }; -// -// the _menuButton will be done dynamically. The call back -// will pass the value of an item to a given window. - - typedef struct PMenuInfo // Implementation dependent stuff - { - Widget WItem; // Widget for each menu item - int ItemIndex; - int SubMenuIndex; - PMenuInfo* NxtInfo; - } PMenuInfo; - - typedef struct PMenuButton - { - VCONST char* label; // Label for button - vMenu* SubMenu; // the menu items associated with this button - PMenuInfo* mInfo; // dynamically allocated info list - - // System dependent handles - Widget XMenuButton; // an X widget for the button - Widget XPopUp; // and X widget for the popup - - } PMenuButton; - - static const int MAX_PMENU_BUTTONS = 20; // Up to 20 menu buttons + submenus - - extern "C" - { - void CPmenuCB(Widget w, XtPointer ItmPtr, XtPointer call_data); - }; - // per window - class vPopupMenu - { - - public: //---------------------------------------- public - friend void CPmenuCB(Widget w, XtPointer ItmPtr, XtPointer call_data); - // the constructors - vPopupMenu(VCONST vMenu* menu, VCONST vWindow* pWin); - vPopupMenu(const vPopupMenu& m); // Copy constructor - virtual ~vPopupMenu(); // Destructor - - // non-virtual methods - void initialize(); - -#ifdef VX_HASPOPUPS - int isImplemented() { return 1; } -#else - int isImplemented() { return 0; } -#endif - - int GetValue(ItemVal id) VCONST; - void SetValue(ItemVal id, int val, ItemSetType setType); - void SetString(ItemVal id, VCONST char* str); - - void ShowMenu(int x, int y); - - protected: //--------------------------------------- protected - - - private: //--------------------------------------- private - - // data -#ifdef VX_HASPOPUPS - int initDone; - - vWindow* _parentWin; - - Widget _topLevelMenu; - - int _nextMenuButton; - int _nextSubMenu; - PMenuButton _mb[MAX_PMENU_BUTTONS]; // Up to 10 menu items per window - - // methods - void doAddMenu(int id, Widget parent); // build the menu - void PmenuCB(Widget w); // callback for menu selection - void doSubMenu(Widget parent, Widget subitem, int x, int y); - - void fixLabel(VCONST char* lbl, VCONST char* key = 0) VCONST; -#ifdef Athena - vPopupMenu* GetMenuThis(Widget w); -#endif - int CheckAccel(vKey vkey, unsigned int shift, ItemVal& id) VCONST; - void menuCB(Widget w); -#endif // VX_HASPOPUPS - }; - -#endif diff --git a/v/includex/v/vprintdc.h b/v/includex/v/vprintdc.h deleted file mode 100644 index fed48b3..0000000 --- a/v/includex/v/vprintdc.h +++ /dev/null @@ -1,28 +0,0 @@ -//=============================================================== -// vpsdc.h: Print DC class .h file - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VPRINTDC_H -#define VPRINTDC_H - -#include - - // This is a simple renamimg of the PostScriptDC - - class vPrintDC : public vPostScriptDC - { - - public: //---------------------------------------- public - - vPrintDC(const int scale = 0) {} - - virtual ~vPrintDC() {} - }; -#endif diff --git a/v/includex/v/vprinter.h b/v/includex/v/vprinter.h deleted file mode 100644 index 10d7220..0000000 --- a/v/includex/v/vprinter.h +++ /dev/null @@ -1,31 +0,0 @@ -//=============================================================== -// vprinter.h: Printer class .h file - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VPRINTER_H -#define VPRINTER_H - -#include - - // For X version, this is a simple renaming of vPSPrinter - - class vPrinter : public vPSPrinter - { - public: //---------------------------------------- public - vPrinter() {} - virtual ~vPrinter() {} - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - - }; - -#endif diff --git a/v/includex/v/vprogrsc.h b/v/includex/v/vprogrsc.h deleted file mode 100644 index 321dc2e..0000000 --- a/v/includex/v/vprogrsc.h +++ /dev/null @@ -1,61 +0,0 @@ -//=============================================================== -// vprogrsc.h - List Command class -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VPROGRESSC_H -#define VPROGRESSC_H - -#include // We are derived from vcmd - -extern "C" // wrap in "C" -{ -#include -#include -} - - class vCmdParent; - - class vProgressCmd : public vCmd - { - - public: //---------------------------------------- public - - vProgressCmd(vCmdParent* dp, CommandObject* co); - - virtual ~vProgressCmd(); - - virtual void initialize(); - - virtual int GetCmdValue(ItemVal id) VCONST; - virtual void SetCmdVal(ItemVal val, ItemSetType st); - - protected: //--------------------------------------- protected - - - private: //--------------------------------------- private - - Widget _wScroll; // For a surrounding box - Widget _wLabel; // For a label - int _ScrlTop; // Position of top of thumb - int _ScrlShown; // Portion of thumb shown - - int _minVal; - int _maxVal; - - int _curVal; // current value - int _isVert; - int _perCent; - int _noLabel; - - void SetScroll(int Shown, int Top); // set scroll values - int mapVal(int val); - - }; -#endif diff --git a/v/includex/v/vpsdc.h b/v/includex/v/vpsdc.h deleted file mode 100644 index 81a89ea..0000000 --- a/v/includex/v/vpsdc.h +++ /dev/null @@ -1,97 +0,0 @@ -//=============================================================== -// vpsdc.h: PostScriptDC class .h file - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VPSDC_H -#define VPSDC_H - -#include -#include -#include - -using namespace std; - - class vPostScriptDC : public vDC - { - - friend class PSDCPrinterSetup; - - public: //---------------------------------------- public - - vPostScriptDC(const int scalePrinting = 0); - - virtual ~vPostScriptDC(); - - // Drawing - - virtual void Clear(void); - virtual void ClearRect(int left, int top, int width, int height); -#ifdef DRAWARC - virtual void DrawArc(int xx1, int yy1, int xx2, int yy2, int xxc, int yyc); -#endif - virtual void DrawAttrText(int x, int y, VCONST char* text, const ChrAttr attr); - virtual void DrawColorPoints(int x, int y, int nPoints, vColor* pointList); - virtual void DrawText(int x, int y, VCONST char* text); - virtual void DrawEllipse(int x, int y, int width, int height); - virtual void DrawIcon(int x, int y, vIcon& icon); - virtual void DrawLine(int x, int y, int xend , int yend); - virtual void DrawLines(vLine* lineList, int count); - virtual void DrawLines(vPoint* points, int n); - virtual void DrawPoint(int x, int y); - virtual void DrawPoints(vPoint* pointList, int count); - virtual void DrawPolygon(int n, vPoint points[], int fillStyle); - virtual void DrawRectangle(int x, int y, int width, int height); - virtual void DrawRectangles(vRect* rectList, int count); - virtual void DrawRoundedRectangle(int x, int y, - int width, int height, int radius); - virtual void DrawRubberLine(int x, int y, int xend, int yend); - virtual void DrawRubberEllipse(int x, int y, int width, int height); - virtual void DrawRubberPoint(int x, int y); - virtual void DrawRubberRectangle(int x, int y, int width, int height); - - - // Appearance - - virtual void SetBackground(vColor& color); - virtual void SetBrush(vBrush& brush); - virtual void SetFont(vFont& vf); - virtual void SetPen(vPen& pen); - virtual void SetPrinter(vPrinter& printer); - - virtual int TextHeight(int& asc, int& des); - virtual int TextWidth(VCONST char* str); - - virtual int BeginPrinting(char* filename = 0, int ask = 1, int isColor = 0); - virtual void EndPrinting(); - virtual void BeginPage(); - virtual void EndPage(); - - protected: //--------------------------------------- protected - - - private: //--------------------------------------- private - - void SetPSColor(vColor& bc); - - int _pages; - int _fontIndex; - ofstream *pstream; // PostScript output stream - - vColor _curColor; - vBrush _curBrush; - vPen _curPen; - vPrinter _printer; // the printer - - Pixmap iconPM; - - void SetGCtoPen(); - void SetGCtoBrush(); - }; -#endif diff --git a/v/includex/v/vpsprntr.h b/v/includex/v/vpsprntr.h deleted file mode 100644 index 2be4966..0000000 --- a/v/includex/v/vpsprntr.h +++ /dev/null @@ -1,93 +0,0 @@ -//=============================================================== -// vpsprntr.h: PS Printer class .h file - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VPSPRNTR_H -#define VPSPRNTR_H - -#include -#include -#include - -#define vPaperLetter 0 -#define vPaperLegal 1 -#define vPaperTabloid 2 -#define vPaperLedger 3 -#define vPaperStatement 4 -#define vPaperExecutive 5 -#define vPaperA3 6 -#define vPaperA4 7 -#define vPaperA5 8 -#define vPaperB4 9 -#define vPaperB5 10 -#define vPaperFolio 11 -#define vPaperQuarto 12 -#define vPaper10x14 13 - -using namespace std; - -#define vPaperDefault vPaperLetter // Index to default paper - - class vPSPrinter : public vModalDialog - { - public: //---------------------------------------- public - vPSPrinter(); - ~vPSPrinter(); - - vPSPrinter& operator =(const vPSPrinter& pr); - - ofstream* OpenPrinter(); - void ClosePrinter(); - - int GetHeight() {return _height;} - int GetWidth() {return _width;} - - char* GetDocName() {return _name;} - - int GetPortrait(){return _portrait;} - void SetPortrait(int p) {_portrait = p;} - - int GetUseColors() {return _useColor;} - void SetUseColors(int c) {_useColor = c;} - - int GetPaper() {return _paperType;} - char* GetPaperName(); - - int GetCopies() {return _copies;} - void SetCopies(int s) {_copies = s;} - - int GetToFile() {return _toFile;} - - int Setup(char* fn = 0); - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - virtual void DialogCommand(ItemVal id, ItemVal val, CmdType ctype); - - static int _instances; - - int _cmdsAdded; - - // Printer attributes - char* _name; // name of stream - ofstream* _pstream; // the stream - - int _width; // width of printer - int _height; // height of printer - int _portrait; // true if portrait, else landscape - int _useColor; // true if printer supports colors - - int _paperType; - int _copies; - int _toFile; - }; - -#endif diff --git a/v/includex/v/vradioc.h b/v/includex/v/vradioc.h deleted file mode 100644 index a78a911..0000000 --- a/v/includex/v/vradioc.h +++ /dev/null @@ -1,65 +0,0 @@ -//=============================================================== -// vradioc.h - Radio Button Command class -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VRADIOC_H -#define VRADIOC_H - -#include // We are derived from vcmd - -extern "C" // wrap in "C" -{ -#include -#include -} - - class vCmdParent; - - extern "C" - { - void CRadioButtonCmdCB(Widget w, XtPointer This, XtPointer call_data); - } - - class vRadioButtonCmd : public vCmd - { - friend void CRadioButtonCmdCB(Widget w, XtPointer This, XtPointer call_data); - - public: //---------------------------------------- public - - vRadioButtonCmd(vCmdParent* dp, CommandObject* co); - vRadioButtonCmd(const vRadioButtonCmd&); // Copy constructor - - virtual ~vRadioButtonCmd(); - - virtual void initialize(void); - - virtual void ResetItemValue(void); - - virtual int GetCmdValue(ItemVal id) VCONST; - - virtual void SetCmdVal(ItemVal val, ItemSetType st); - - virtual void SetCmdStr(VCONST char* str); - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - - static vRadioButtonCmd* _RBList; // list of all radio buttons - - int _copied; // For copy constructor - - vRadioButtonCmd* _nextRB; // ptr to next rb - - Widget _wLabel; // Widget for button label - - void RadioButtonCmdCB(int NotifyParent); // callback for user action - }; -#endif diff --git a/v/includex/v/vrepldlg.h b/v/includex/v/vrepldlg.h deleted file mode 100644 index 2c96f8d..0000000 --- a/v/includex/v/vrepldlg.h +++ /dev/null @@ -1,44 +0,0 @@ -//=============================================================== -// vrepldlg.h - find/replace modal dialog -// -// Copyright (C) 1995-1999 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef vReplDlg_H -#define vReplDlg_H -#include - -#ifndef V_EXPORT -#define V_EXPORT -#endif - class V_EXPORT vApp; - class V_EXPORT vReplaceDialog : protected vModalDialog - { - public: //---------------------------------------- public - vReplaceDialog(vBaseWindow* bw, VCONST char* title = "Find/Replace") : - vModalDialog(bw, title) - { added = 0;} - vReplaceDialog(vApp *aw, VCONST char* title = "Find/Replace") : - vModalDialog(aw, title) - { added = 0;} - ~vReplaceDialog() {} - - int AskReplacePat(char* findpat, const int maxlen, - char* replpat, const int maxrlen, - int& caseSens, int& Down, - int& Wrap, int& Prompt, int& All); - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - - int added; - virtual void DialogCommand(ItemVal id, ItemVal val, CmdType ctype); - - }; -#endif diff --git a/v/includex/v/vreply.h b/v/includex/v/vreply.h deleted file mode 100644 index fed1e6a..0000000 --- a/v/includex/v/vreply.h +++ /dev/null @@ -1,38 +0,0 @@ -//=============================================================== -// vreply.h - reply modal dialog -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VREPLY_H -#define VREPLY_H -#include - - class vApp; - class vReplyDialog : protected vModalDialog - { - public: //---------------------------------------- public - vReplyDialog(vBaseWindow* bw, VCONST char* title = "Reply") : vModalDialog(bw, title) - {added = 0; df = 0;} - vReplyDialog(vApp *aw, char* VCONST title = "Reply") : vModalDialog(aw, title) - {added = 0; df = 0;} - ~vReplyDialog() { if (df != 0) delete [] df;} - - int Reply(VCONST char* msg, char* reply, int maxlen, VCONST char* dflt=""); - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - - virtual void DialogDisplayed(); - virtual void DialogCommand(ItemVal id, ItemVal val, CmdType ctype); - int added; - char* df; - - }; -#endif diff --git a/v/includex/v/vsliderc.h b/v/includex/v/vsliderc.h deleted file mode 100644 index 88fe67b..0000000 --- a/v/includex/v/vsliderc.h +++ /dev/null @@ -1,69 +0,0 @@ -//=============================================================== -// vslider.h - List Command class -// -// Copyright (C) 1995-1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VSLIDERC_H -#define VSLIDERC_H - -#include // We are derived from vcmd - -extern "C" // wrap in "C" -{ -#include -#include -} - - class vCmdParent; - - extern "C" - { - void CSliderJumpProcCB(Widget w, XtPointer This, XtPointer pc_ptr); - void CSliderScrollProcCB(Widget w, XtPointer This, XtPointer position); - } - - class vSliderCmd : public vCmd - { - friend void CSliderJumpProcCB(Widget w, XtPointer This, XtPointer pc_ptr); - friend void CSliderScrollProcCB(Widget w, XtPointer This, XtPointer position); - - public: //---------------------------------------- public - - vSliderCmd(vCmdParent* dp, CommandObject* co); - - virtual ~vSliderCmd(); - - virtual void initialize(); - - virtual int GetCmdValue(ItemVal id) VCONST; - virtual void SetCmdVal(ItemVal val, ItemSetType st); - - protected: //--------------------------------------- protected - - - - private: //--------------------------------------- private - - int _ScrlTop; // Position of top of thumb - int _ScrlShown; // Portion of thumb shown - - int _curVal; // current value - - int _minVal; // Can scale to min and val - int _maxVal; - - int mapVal(int val); - - void SetScroll(int Shown, int Top); // set scroll values - - void ScrollProcCB(int position); - void JumpProcCB(float percent, int mVal); - - }; -#endif diff --git a/v/includex/v/vslist.h b/v/includex/v/vslist.h deleted file mode 100644 index fda027b..0000000 --- a/v/includex/v/vslist.h +++ /dev/null @@ -1,44 +0,0 @@ -//=============================================================== -// vslist.h - The vSList class - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VSLIST_H -#define VSLIST_H - -// define V_EXPORT for X version -#ifndef V_EXPORT -#define V_EXPORT -#endif - - class V_EXPORT vSList - { - - public: //---------------------------------------- public - vSList(int maxsize = 128); - ~vSList(); - -// vSList& operator =(const vSList& slist); - void init(); - void erase(); - int size() const; - int insert(int insAt, const char* strn) const; - int replace(int repAt, const char* strn) const; - int deleteItem(int delAt) const; - - int max; - char** list; - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - - }; - -#endif diff --git a/v/includex/v/vspinc.h b/v/includex/v/vspinc.h deleted file mode 100644 index 6bf0de8..0000000 --- a/v/includex/v/vspinc.h +++ /dev/null @@ -1,69 +0,0 @@ -//=============================================================== -// vspinc.h - Value Box -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VSPINC_H -#define VSPINC_H - -#include // We are derived from vcmd - -extern "C" // wrap in "C" -{ -#include -#include -} - - class vCmdParent; - - extern "C" - { - void CUpCB(Widget w, XtPointer This, XtPointer lr); - void CDownCB(Widget w, XtPointer This, XtPointer lr); - } - - class vSpinnerCmd : public vCmd - { - friend void CUpCB(Widget w, XtPointer This, XtPointer lr); - friend void CDownCB(Widget w, XtPointer This, XtPointer lr); - - public: //---------------------------------------- public - - vSpinnerCmd(vCmdParent* dp, CommandObject* co); - - virtual ~vSpinnerCmd(); - - virtual void initialize(void); - - virtual int GetCmdValue(ItemVal id) VCONST; - virtual void SetCmdVal(ItemVal val, ItemSetType st); - - protected: //--------------------------------------- protected - - - private: //--------------------------------------- private - - Widget _wUp; // Up arrow widget - Widget _wDown; // Down arrow widget - - char** _fullList; // alias pointer to full list - int _maxWidth; // max width of any item - int _numItems; // number of items on list - int _maxVal; - int _minVal; - int _step; - int _curSelection; // index of current selected item - int _TextList; - - void SetupList(void); - - void DownUpCB(int down); // callback for user action - - }; -#endif diff --git a/v/includex/v/vstatusp.h b/v/includex/v/vstatusp.h deleted file mode 100644 index fb76916..0000000 --- a/v/includex/v/vstatusp.h +++ /dev/null @@ -1,51 +0,0 @@ -//=============================================================== -// vstatusp.h - Status Bar class .h file - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VSTATUSP_H -#define VSTATUSP_H - -#include - -#include // we are derived from a pane - - class vWindow; // we are part-of a vWindow - - typedef struct StatusList - { - vStatus* statusPtr; // pointer to static status definition - Widget w; // widget for this status box - StatusList* nextSL; // next status - } StatusList; - - class vStatusPane : public vPane - { - public: //---------------------------------------- public - vStatusPane(vStatus* s_bar); - vStatusPane(const vStatusPane& b); // Copy constructor - ~vStatusPane(); - - virtual void initialize(vWindow* pWin, Widget pWidget, - Widget drawCanvas = (Widget)0, Widget drawArea = (Widget)0); - virtual void ShowPane(int OnOrOff); - - protected: //--------------------------------------- protected - - virtual void SetPaneValue(ItemVal id, int val, ItemSetType setType); - virtual void SetPaneString(ItemVal id, char* str); - - - private: //--------------------------------------- private - - Widget _statusBar; // Widget for Bar box - Widget _Shadow; // Motif only - StatusList* _statusList; // list of status boxes on this bar - }; -#endif diff --git a/v/includex/v/vtextc.h b/v/includex/v/vtextc.h deleted file mode 100644 index f0e3336..0000000 --- a/v/includex/v/vtextc.h +++ /dev/null @@ -1,45 +0,0 @@ -//=============================================================== -// vtextc.h - Text Output Command Class -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VTEXTC_H -#define VTEXTC_H - -#include // We are derived from vcmd - -extern "C" // wrap in "C" -{ -#include -#include -} - - class vCmdParent; - - class vTextCmd : public vCmd - { - - public: //---------------------------------------- public - - vTextCmd(vCmdParent* dp, CommandObject* co); - - virtual ~vTextCmd(); - - virtual void initialize(void); - - virtual void SetCmdVal(ItemVal val, ItemSetType st); - - virtual void SetCmdStr(VCONST char* str); - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - - }; -#endif diff --git a/v/includex/v/vtextcnv.h b/v/includex/v/vtextcnv.h deleted file mode 100644 index 66f3e0a..0000000 --- a/v/includex/v/vtextcnv.h +++ /dev/null @@ -1,143 +0,0 @@ -//=============================================================== -// vtextcnv.h - vTextCanvasPane class -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VTEXTCNV_H -#define VTEXTCNV_H - -const int MAX_ROWS = 100; -const int MAX_COLS = 256; - - -const int MARGIN = 2; - - -#define ScrChar(r,c) ((screen+(r*colsAllocated)+c)->chr) -#define ScrAttr(r,c) ((screen+(r*colsAllocated)+c)->attr) -#define ScrAddr(r,c) (screen+(r*colsAllocated)+c) - -#include - - class vTextCanvasPane : public vCanvasPane - { - public: //---------------------------------------- public - vTextCanvasPane(); - vTextCanvasPane(const vTextCanvasPane& t); - - virtual ~vTextCanvasPane(); - - // Window management/drawing - - virtual void Clear(void); // Clear text canvas window - - virtual void ClearRow(const int r, const int c); // Clear row of text - virtual void ClearToEnd(const int r, const int c); // Clr to end of screen - - int GetCols() VCONST { return maxCols; } - int GetRows() VCONST { return maxRows; } - - void GetRC(int& r, int& c) { r = curRow; c = curCol; } - void GotoRC(const int r, const int c); - - virtual void DrawAttrText(const char* text, const ChrAttr attr); - virtual void DrawAttrsText(const char* text, const ChrAttr* attr); - - virtual void DrawChar(const char chr, const ChrAttr attr); - - virtual void DrawAttrText(int x, int y, VCONST char* text, const ChrAttr attr) - { vCanvasPane::DrawAttrText(x, y, text, attr); } - - virtual void DrawText(int x, int y, VCONST char* text) - { vCanvasPane::DrawText(x, y, text); } - - virtual void DrawText(const char* text); - - void HideTextCursor(void) {DrawTextCursor(-1,-1);} - void ShowTextCursor(void) {DrawTextCursor(curRow,curCol);} - void SetTextRowsCols(int rows, int cols); - - // Scrolling - void ScrollText(const int lineCount); - - // Events - virtual void FontChanged(VCONST vFont& newFont); - - virtual void ResizeText(const int rows, const int cols); - virtual void Redraw(int x, int y, int width , int height); - virtual void Resize(int w, int h); - virtual void ResizeText(void); - - virtual void TextMouseDown(int row, int col, int button) - { - SysDebug3(MouseEvents,"TextMouseDown(r:%d,c:%d,btn:%d)\n",row,col,button); - }; - virtual void TextMouseUp(int row, int col, int button) - { - SysDebug3(MouseEvents,"TextMouseUp(r:%d,c:%d,btn:%d)\n",row,col,button); - }; - virtual void TextMouseMove(int row, int col, int button) - { - SysDebug3(MouseEvents,"TextMouseMove(r:%d,c:%d,btn:%d)\n",row,col,button); - }; - - int ColToX(int c) // convert col to X coord - { - return (c*cWidth) + MARGIN; - } - int RowToY(int r) // convert row to Y coord - { - return (r*cHeight) + cHeight + MARGIN; - } - - protected: //--------------------------------------- protected - - int cHeight; // height of a character - int cAscent; // Ascent of a character - int cDescent; // Descent of a character - int cWidth; // width of a chacter - int maxRows; // # rows that can be displayed - int maxCols; // # columns that can be displayed - - int curRow; // Current row - int curCol; // Current col - - int cursorRow; // Current row of cursor - int cursorCol; // Current col of cursor - ChrAttr cursorAttr; // The attribute of the cursor - Chr cursorChr; // the character at the cursor - - int rowsAllocated; // how many rows and columns - int colsAllocated; // actually allocated to - - dChar* screen; // array of pointers to dChar rows - - // make these protected now - - virtual void MouseDown(int x, int y, int button); - virtual void MouseUp(int x, int y, int button); - virtual void MouseMove(int x, int y, int button); - - - private: //--------------------------------------- private - - int _cursorSet; - - void ClearRowDisplay(const int r, const int c); // Clear screen only - - void DoDrawText(const char* text, const ChrAttr attr); - - void DrawTextScr(int r, int c, VCONST dChar* txt); - - void DrawTextCursor(int r, int c); - - int YToRow(int y); - int XToCol(int x); - }; -#endif diff --git a/v/includex/v/vtexted.h b/v/includex/v/vtexted.h deleted file mode 100644 index 13da61a..0000000 --- a/v/includex/v/vtexted.h +++ /dev/null @@ -1,471 +0,0 @@ -//=============================================================== -// vtexted.h - vTextEditor class definitions - based on vTextCanvas -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VTEXTED_H -#define VTEXTED_H - -#include - -// for X version -#ifndef V_EXPORT -#define V_EXPORT -#endif - - class V_EXPORT vCmdWindow; - class V_EXPORT vTextEdCmdInterp; - - // These values may be used a the id paramater of the - // EditCommand method, which will then carry out the - // specfied command. The val parameter is used to - // pass a count when necessary, and can usually be - // a positive or negative value. Thus edCharRight with - // a positive val moves right; with a negative val, left. - enum // editor commands - { - edBalMatch = 10000, // find matching paren (if > 1, up to val lines away) - edBufferBottom, // move to bottom of file (no val) - edCenterScreen, // center cursor in display window - edCharDelete, // delete +/- val chars - edCharFoldCase, // swap case of +/- val letters - edCharInsert, // insert char val - edCharRight, // move +/- val chars right - edCut, // Cut - edCopy, // Copy - edPaste, // Paste - edFill, // fill current line - edFind, // invoke TextEd's find dialog (no val) - edFindNext, // find next occurrence of prev (no val) - edHelp, // show help screen - edIndent, // autoindent if on - edLineBeginning, // move to line beginning (no val) - edLineDown, // move down +/- val lines in column - edLineDownBeg, // move down +/- val lines - edLineDelete, // delete +/- val lines - edLineDeleteFront, // delete to beginning of line (no val) - edLineDeleteToEnd, // delete to end of line (no val) - edLineEnd, // move to end of line (no val) - edLineGoto, // move cursor to line val - edLineOpen, // open val new blank lines - edFormatC, // format a C Line - edNoteLocation, // note which line we are on - edNoteGoto, // goto noted locateion - edScrollDown, // scroll val lines without changing cursor - edReplace, // Find/Replace - edUndo, // UnDo the last edit - edUnDoMove, // UnDo the last move - edVerify, // force repaint of screen (no val) - edWordRight, // move cursor +/- val words right - edNoOp - }; - - enum FileType - { - Text, - CPP, - HTML, - Java, - TeX, - gccError, - bccError, - javaError, - Perl, - Fortran, - Lisp, - XML, - Python, - Tcl, - Makefile, - Shellscript - }; - - enum ReplaceConfirm - { - YesRepl = 800, // Replace this instance - YesReplNext, // Replace, go to next - NoRepl, // Don't replace - NoReplNext, // Don't replace, goto next - QuitR, // Quit replacing - RepAll // Quit confirming, replace all - }; - - const int MAX_LINE = 500; // Max line length we will handle - const int MAX_UNDO = 4094; - - typedef char* BUFFPTR; - - typedef struct MARK_RANGE - { - long beg_lin; /* first line of marked range */ - long end_lin; /* last line of marked range */ - int beg_col; /* col where first line begins */ - int end_col; /* col where last line ends */ - BUFFPTR beg_chr; /* first chr */ - BUFFPTR end_chr; - } MARK_RANGE; - - typedef struct edState - { - long changes; // count of changes - - FileType ftype; // what kind of file type - int - autoIndent, // autoindent flag - counter, // counter for + insert - echof, // whether or not to echo action - ins_mode, // true if insert mode - delOnInsert, // true if delete selection on insert - readOnly; // true if read only - } edState; - - typedef struct globalState - { - int - findAtBeginning, // leave find at beginning of pattern - fixed_scroll, // flag if using fixed scroll - delOnInsert, // true if delete selection on insert - tabspc, // tab spacing - wraplm, // right limit - braceIndent; // indenting for {}'s - } globalState; - - -#include - - class V_EXPORT vTEConfirm : protected vModalDialog - { - public: - vTEConfirm(VCONST vCmdWindow *bw, VCONST char* title = "Replace?"): - vModalDialog((vBaseWindow*)bw,title) {added = 0;} - ~vTEConfirm() {} - int ConfirmRep(); - - protected: - - static DialogCmd ConfirmCmds[]; - - private: - virtual void DialogCommand(ItemVal id, ItemVal val, - CmdType ctype); - int added; - }; - - class V_EXPORT vTextEditor : public vTextCanvasPane // The main way to deal with a file - { - - public: //---------------------------------------- public - vTextEditor(VCONST vCmdWindow* parent); - ~vTextEditor(); // Destructor - - virtual void resetBuff(); // open the buffer - virtual int addLine(char* line); // add a line to end of buffer - virtual int getFirstLine(char* line, int maxChars); // first line in buffer - virtual int getNextLine(char* line, int maxChars); // next line in buffer, -1 = END - virtual int getLine(char* line, int maxChars, long lineNum); // retrieve given line - virtual void displayBuff(long lineNum = 1, int paintIt = 1); - // finished with buffer - virtual int insertLine(char* line, long before, bool doUndo = true); - virtual void adjustLines(long line_1, int by); - - // Editor command interpreter - - virtual int EditCommand(int id, long val); - virtual int EditKeyIn(vKey key, unsigned int shift); - void ChangeCmdInterp(vTextEdCmdInterp* newCI); - vTextEdCmdInterp* GetCmdInterp() VCONST { return _teCInt; } - - // State Notification - - virtual void ChangeLoc(long line, int col) {} // just state change - virtual void ChangeInsMode(int IsInsMode, char* msg = 0) {} - virtual void StatusMessage(char *msg) {} - virtual void ErrorMsg(char *str) {}; - globalState GetGlobalState() VCONST { return gState; } - void SetGlobalState(globalState setGState) { gState = setGState; } - edState GetEdState() VCONST { return state; } - void SetEdState(edState setState) { state = setState; } - void SetRdOnly(int ro) {state.readOnly = ro;} - void SetInsMode(int ins) {state.ins_mode = ins;} - void SetEchoF(int e) {state.echof = e;} - void SetAutoIndent(int ai) {state.autoIndent = ai;} - FileType GetFileType() VCONST { return state.ftype; } - void SetFileType(FileType ft) {state.ftype = ft; } - long JLine() VCONST {return b_lastln; } - void SetJLine(long j) {b_lastln = j;} - void SetFindPat(char* newpat) - {if (strlen(newpat) < MAX_LINE) strcpy(theFindPat,newpat); } - char* GetFindPat() VCONST { return theFindPat; } - - long GetLines() VCONST { return lastLine; } - long GetCurLine() VCONST { return curlin; } - int getColPos() {return col_pos(curchr);} - int OldLen() VCONST { return oldlen; } - void SetOldLen(int val) {oldlen = val; } - int Changed() VCONST { return state.changes > 0; } - void IncChanges() { ++state.changes; }; - void Verify(void); // repaint screen - - // ******* Methods used by command interpreters ************ - - // Character oriented methods - - int charDelete(long cnt, bool doUndo = true, - bool removeRange = true); // delete next cnt chars - int charFoldCase(long cnt); // swap case of letter - int charInsert(int ival, bool doUndo = true); // forced insert - int charRight(long cnt, int clear_mark = 1); // move char right - - // line oriented methods - - void lineAutoFill(void); // automatic filling - void lineBeginning(); // move to line beginning - int lineDown(long cnt, int clrRange = 1);// move down cnt lines - int lineDownBeg(long cnt, int notify = 1, - int clrRange = 1); // move down cnt lines - void lineDelete(long cnt, bool doUndo = true); // delete cnt lines - int lineDeleteFront(bool doUndo = true); // delete to beginning of line - int lineDeleteToEnd(bool doUndo = true); // delete to end of line - void lineEnd(int clrRange = 1); // move to end of line - int lineFill(long count); // fill count lines - int lineGoto(long cnt); // move cursor to line cnt - int lineOpen(long cnt); // open new blank line - - int formatC(long count); - - // misc - int autoIndent(); - int BalMatch(long val); // find matching paren - void CenterScreen(); - int wordRight(long cnt); - void scrollDown(long delta); - int getSelection(char* sel, int max); - void setSelection(int howmuch); - int EditCut(); - int EditCopy(); - int EditPaste(); - int Find(char* pat, int caseSensitive = 0, int Down = 1, int Wrap = 0); - int FindNext(int caseSensitive = 0, int Down = 1, int Wrap = 0); - int Replace(const char* pat, const char* repl, int caseSensitive = 0, - int Down = 1, int Wrap = 0, int Confirm = 0, int replaceAll = 0); - int undoEdit(void); - void bufferBottom(void); // move to bottom of file - void newscr(void); - - void ClearMarkRange(void); - int RemoveMarkRange(bool doUndo = true); - - int insertToRange(char* atFront, char* atEnd); - void addToRange(long rows, long cols); // add to mark range - - void highLightCurLine(); - - virtual int defaultKeyIn(vKey key, unsigned int shift); - - virtual void TextMouseDown(int row, int col, int button); - virtual void TextMouseUp(int row, int col, int button); - virtual void TextMouseMove(int row, int col, int button); - - int mint(int v1, int v2); - int maxt(int v1, int v2); - long minl(long v1,long v2); - long maxl(long v1, long v2); - int clower(int ch); - int cupper(int ch); - - protected: //--------------------------------------- protected - - virtual void initBuff(); // create buffers - virtual BUFFPTR GLine(long lineNum); - virtual int GCh(BUFFPTR charNum) VCONST { return *(charNum); } - virtual BUFFPTR deleteCharBF(BUFFPTR charNum, long lineNum); - virtual long deleteLinesBF(long start, long end); - virtual int insertCharBF(int chr, BUFFPTR& curchr, long& curlin); - virtual int lineLenBF(long lineNum); - virtual long lastLineBF() VCONST { return _nextLine - 1; } // last line in buff - - // Scrolling - - virtual void HPage(int, int); - virtual void VPage(int, int); - - virtual void HScroll(int); - virtual void VScroll(int); - - // Events - - virtual void FontChanged(VCONST vFont& newFont); - virtual void ResizeText(const int rows, const int cols); - virtual void Redraw(int x, int y, int width , int height); - - // utilities for formatC - int has_key(char *buff_ptr, char *key); - int is_key_word(char *bf, int case_def); - long get_prev(char *prev_buff, long start); - - // misc methods - - int SelectionLen(); // get len of marked range - void AddToRangeRow(long cnt); // add to mark range - void AddToRangeCol(int col); // add to mark range - int CopySelection(char* buff, int max, int unmark); - - void setHighlight(ChrAttr hl) {_highlighter = hl;} - ChrAttr getHighlight() {return _highlighter;} - - virtual void paintLine(char* linout, int lineStart, - int hiStart, int hiLast, long lineNum); - - vCmdWindow* _parent; - - edState state; // state stuff for outside - static globalState gState; - static int findCaseSensitive; - static char theFindPat[MAX_LINE + 2]; // one static find pattern - static char theReplPat[MAX_LINE + 2]; // one static repl pattern - static int findDown; - static int findWrap; - static int replaceConfirm; - static int replaceAll; - - private: //--------------------------------------- private - - int IsEndLine(int chr) VCONST { return (chr == '\n' || chr == '\r'); } - void tvhdln(void); - void setScrollBar(); - void checkIfScrolled(); - void FindDispLine(long& ibeg, int& cnt); - int CombineLines(void); - int findX(void); - int line_can_fit(long l); - int Fill1(int dir, int val); - void range(long cnt,long *lbeg, long *lend); - void updateScroll(long change); - void updateNoScroll(long change); - void getCurLineFront(char* buff, long start); - bool isSpecial(char* curline); - BUFFPTR lastBX(long line); - void newScrollScreen(long ibeg); - bool SaveKillLine(long cnt, bool partialLine = false); - void tvtyln(long lineNum,BUFFPTR chrptr, int whole_line); - int IsWordChar(int chr); - void update(long change); - void MouseMoveTo(int row, int col); - int reallocLines(); - void retypeCurlin(int eraseLine=0); - - void undoOn(const char* msg); - void undoOff(const char* msg); - - // Screen manip - - void tvxy(int ix, int iy); - void tvplin(long lineNum, BUFFPTR chrptr, int whole_line, int hibeg, int hiend); - void type_lines(long ibeg, int icnt, int wholeLine = 0); - void tvbotb(int n); - void tvclr(void); - void tvelin(void); - void tvescr(void); - void tvtopb(int n); - - // Utils - int col_pos(BUFFPTR chr_pos, int do_shift = 0 ); - - BUFFPTR appendToBuff(char* line); - - // Operating state - type of scrolling, etc. - - // variables ------------------------------------------- - int - ddline, // default display line - dsplin, // the default display line - last_col_out, // last column output - leftmg, // left margin of display - linptr, // used to build output lines - mouseCol, // where mouse is (on down) - mouseRow, - mouseMoveCol, - mouseMoveRow, - oldcol, // beginning column for dwncol - oldlen, // length for '=' command - setCursor, // if need to reset cursor after resize - tvdlin, // the "active" display line - tvx, // current x cursor position - tvy, // current y cursor position - use_wild, // use wild cards in match - wasColCmd, // if last command was a column - xoutcm; // used for 240 col virtual screen - - long - b_lastln, // last line for JUMP - curlin, // pointer to current line - noteloc[26], // note locations 0-25 (or a-z) - lastLine, // last line in file - scroll_lin; // for scrolling commands - - BUFFPTR - curchr, // pointer to current character - scroll_chr; // for scroll commands - - MARK_RANGE mark; // marked portion of this - - BUFFPTR* _lines; - - long _nextLine; // index into line array - long _curLineBF; // current line for getXLine - long _maxLines; // size of line array - - ChrAttr _highlighter; - - // UnDo stuff - char* undoBuff; // one line of unkill - int undoCurcol; // column of current character - long undoCurlin; - bool undoPartialLine; // if a partial line saved - bool undoKillLast; - - - // objects used by editor - - vTextEdCmdInterp* _teCInt; - vTEConfirm* myConfirm; - - }; - - class V_EXPORT vTextEdCmdInterp // easy class to override - { - - public: - vTextEdCmdInterp(VCONST vTextEditor* textEd, VCONST vCmdWindow* cw); - virtual ~vTextEdCmdInterp(); - - - virtual int ProcessKey(vKey key, unsigned int shift); - virtual vTextEditor* te() VCONST { return _textEd; } - virtual vCmdWindow* cmdWin() VCONST { return _myCmdWindow; } - virtual void InitCmdInterp(); - virtual void CmdInterpHelp(); - virtual void MouseJump(int row, int col) { /* no-op by default */ } - - protected: - - long cmdCount; // how many times to repeat command - - int - countWait, // if building a count - metaChar, // the meta char for commands - metaWait; // if waiting on a meta command - - private: - vTextEditor* _textEd; - vCmdWindow* _myCmdWindow; - }; - -#endif -/* ************************************************************************ */ diff --git a/v/includex/v/vtextinc.h b/v/includex/v/vtextinc.h deleted file mode 100644 index ea9725d..0000000 --- a/v/includex/v/vtextinc.h +++ /dev/null @@ -1,59 +0,0 @@ -//=============================================================== -// vtextinc.h - Button Command class -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VTEXTIN_H -#define VTEXTIN_H - -#include // We are derived from vcmd - -extern "C" // wrap in "C" -{ -#include -#include -} - - class vCmdParent; - - extern "C" - { - void CtextReturnA(Widget w, XEvent* ev, String* pars, Cardinal* np); - } - - class vTextInCmd : public vCmd - { - friend void CtextReturnA(Widget w, XEvent* ev, String* pars, Cardinal* np); - - public: //---------------------------------------- public - - vTextInCmd(vCmdParent* dp, CommandObject* co); - - virtual ~vTextInCmd(); - - virtual void initialize(void); - - int GetTextIn(ItemVal id, char* str, int maxlen) VCONST; // to get the text back - - virtual void SetCmdVal(ItemVal val, ItemSetType st); - - virtual void SetCmdStr(VCONST char* str); - - - protected: //--------------------------------------- protected - - - private: //--------------------------------------- private - - void textReturn(void); // to handle Return for default exit - static vTextInCmd* _TList; // list of all TextInCmds - vTextInCmd* _nextT; // ptr to next TextIn - - }; -#endif diff --git a/v/includex/v/vtimer.h b/v/includex/v/vtimer.h deleted file mode 100644 index 2184b5f..0000000 --- a/v/includex/v/vtimer.h +++ /dev/null @@ -1,53 +0,0 @@ -//=============================================================== -// vtimer.h - a timer class -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VTIMER_H -#define VTIMER_H - -extern "C" // wrap in "C" -{ -#include -} - - extern "C" - { - void CtimerCB(XtPointer client_data, XtIntervalId* notUsed); - } - - class vTimer - { - - friend void CtimerCB(XtPointer client_data, XtIntervalId* notUsed); - - public: //---------------------------------------- public - - vTimer(); // constructor - virtual ~vTimer(); // destructor - - virtual int TimerSet(long interval); - virtual void TimerStop(void); - virtual void TimerTick(void); - - - protected: //--------------------------------------- protected - - - private: //--------------------------------------- private - - void tick(void); // internal tick routine - - long _interval; // approx. how long in milliseconds between ticks - - XtIntervalId _id; // id used by X - - }; - -#endif diff --git a/v/includex/v/vtipwin.h b/v/includex/v/vtipwin.h deleted file mode 100644 index 790e46f..0000000 --- a/v/includex/v/vtipwin.h +++ /dev/null @@ -1,49 +0,0 @@ -//=============================================================== -// vTipWindow.h - vTipWindow class definitions - X11R5 -// -// Copyright (C) 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef vTipWindow_H -#define vTipWindow_H - -#include - - class vTipWindow - { - - public: //---------------------------------------- public - vTipWindow(); // Constructor - vTipWindow(const vTipWindow& w); // Copy Constructor - - virtual ~vTipWindow(); // Destructor - - // Utility Methods - - virtual void GetPosition(int& left, int& top, int& width, int& height); - virtual void SetPosition(int left, int top); - virtual void RaiseWindow(void); // raise this window - - // Other Methods - - virtual void ShowTipWindow(int x, int y, VCONST char* tip); - virtual void CloseTipWindow(void); - - // Internal Methods - - protected: //--------------------------------------- protected - virtual void initialize(); - - private: //--------------------------------------- private - Widget _popup; // the popup widget - Widget _wLbl; // the label - - int PoppedUp; - - }; -#endif diff --git a/v/includex/v/vutil.h b/v/includex/v/vutil.h deleted file mode 100644 index a500dad..0000000 --- a/v/includex/v/vutil.h +++ /dev/null @@ -1,24 +0,0 @@ -//=============================================================== -// vutil.h - V utility funcitons -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VUTIL_H -#define VUTIL_H -#include - extern void LongToStr(long intg, char* str); // prototype - extern void IntToStr(int intg, char* str); - extern void vGetLocalTime(char* tm); - extern void vGetLocalDate(char* tm); - extern void ByteToStr(unsigned char byteval, char* str); - extern long StrToLong(VCONST char* str); - extern void vBeep(); - extern int vGetcmdIdIndex(ItemVal cmdId, CommandObject *cmdObj); - extern int vGetMenuIdIndex(ItemVal cmdId, vMenu *cmdObj); -#endif diff --git a/v/includex/v/vwindow.h b/v/includex/v/vwindow.h deleted file mode 100644 index 3f644e4..0000000 --- a/v/includex/v/vwindow.h +++ /dev/null @@ -1,142 +0,0 @@ -//=============================================================== -// vWindow.h - vWin class definitions - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VWINDOW_H -#define VWINDOW_H - -#include -#include // we are derived from vBaseWindow -#include // we are a friend of the app class - -#include // so we can get to GetMenuThis - - // We will allow a Button Bar and a Status Bar in Windows - - class vPane; - class vCanvasPane; - - typedef struct PaneList - { - vPane* pane; // pointer to the pane object - PaneList *nextPL; // next pane - } PaneList; - - extern "C" - { -#ifdef USE_CLOSE_CB - void CcloseCB(Widget w, XtPointer client_data, XtPointer call_data); -#endif - void CwmDeleteCB(Widget w, XtPointer client_data, XEvent* e); - void CKeyInEV(Widget w, XtPointer client_data, XEvent* event, char *x); - } - - class vWindow : public vBaseWindow - { - // gnu c++ doesn't seem to let these work right - -#ifdef USE_CLOSE_CB - friend void CcloseCB(Widget w, XtPointer client_data, XtPointer call_data); -#endif - friend void CwmDeleteCB(Widget w, XtPointer client_data, XEvent* e); - friend void CKeyInEV(Widget w, XtPointer client_data, XEvent* event, char *x); - - friend class vPane; - friend class vCanvasPane; - friend class vBaseGLCanvasPane; - - public: //---------------------------------------- public - vWindow(VCONST char *name = "+", int width = 0, int height = 0, - WindowType wintype = WINDOW); // Constructor - - vWindow(const vWindow&); // Copy Constructor - - virtual ~vWindow(); // Destructor - - // Methods to Override - - virtual void KeyIn(vKey keysym, unsigned int shift); // KeyIn method - virtual void MenuCommand(ItemVal id); - virtual void WindowCommand(ItemVal id, ItemVal retval, CmdType ctype); - virtual void WorkSlice(void) {} - - // Utility Methods - - virtual void AddPane(vPane* add_pane); // add a pane to the window - virtual int GetValue(ItemVal id) VCONST; - virtual void GetPosition(int& left, int& top, int& width, - int& height) VCONST; - virtual void SetPosition(int left, int top); - virtual int GetTextIn(ItemVal id, char* val, int maxlen) VCONST; - virtual void RaiseWindow(void); // raise this window - virtual void SetString(ItemVal id, VCONST char* str); - virtual void SetStringAll(ItemVal id, VCONST char* str); - virtual void SetTitle(VCONST char* title); - virtual void SetValue(ItemVal id, int val, ItemSetType setType); - virtual void SetValueAll(ItemVal id, int val, ItemSetType setType); - void ShowPane(vPane* wpane, int OnOrOff) VCONST; - virtual void ShowWindow(bool show = true); - virtual void UpdateView(vWindow* sender, int hint, void* pHint); - - // Other Methods - - virtual void CloseWin(void); // callback for close button - virtual void _CloseWinFinal(void); - - // Internal Methods - - vMenuPane* GetMenuThis(Widget w); - void vAddMenuBar(void); - - int getWinHeight() VCONST {return _WinHeight;} - int getWinWidth() VCONST {return _WinWidth;} - void setWinHeight(const int h) {_WinHeight = h;} - void setWinWidth(const int w) {_WinWidth = w;} - - void setcmdArea(Widget w) {_cmdArea = w;} - Widget getcmdArea() {return _cmdArea;} - void setworkArea(Widget w) {_workArea = w;} - Widget getmsgArea() {return _msgArea;} - void setmsgArea(Widget w) {_msgArea = w;} - - protected: //--------------------------------------- protected - - - Widget _menuBar; // the menu bar widget - Widget _closeButton; // close button widget - - Widget _cmdArea; // the command bar area - Widget _workArea; // the work area - Widget _msgArea; // the message area - - int _WinHeight; // height of draw window - int _WinWidth; // width of draw window - - private: //--------------------------------------- private - - int _shown; // if ShowWindow called 1st time - int wm_delete_added; - - void initialize(void); - - static int _numWindows; // how many total windows are up - - static vWindow* _WinList; // all windows - - PaneList* _paneList; // panes for this window - - vPane* _menuPane; // pointer to our menu - - vWindow* _NextWin; // link to next window - - void KeyInEV(unsigned int keycode, unsigned int state); - - }; -#endif diff --git a/v/includex/v/vx2vkey.h b/v/includex/v/vx2vkey.h deleted file mode 100644 index 03915f8..0000000 --- a/v/includex/v/vx2vkey.h +++ /dev/null @@ -1,18 +0,0 @@ -//=============================================================== -// vx2vkey.h - translate V key mappings -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VX2VKEY_H -#define VX2VKEY_H -// -// Copyright 1995, Bruce E. Wampler, All Rights Reserved. -// - extern vKey MapXtoVkey(unsigned int Xkey, unsigned int& shift); -#endif diff --git a/v/includex/v/vxdc.h b/v/includex/v/vxdc.h deleted file mode 100644 index 0dbf619..0000000 --- a/v/includex/v/vxdc.h +++ /dev/null @@ -1,100 +0,0 @@ -//=============================================================== -// vcpdc.h: CanvasPaneDC class .h file - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VXDC_H -#define VXDC_H - -#include - -extern "C" -{ -#include -} - - class vWindow; // we are part of a window - class vMemoryDC; - - class vXDC : public vDC - { - - public: //---------------------------------------- public - - vXDC(); - - virtual ~vXDC(); - - // Drawing - - virtual void Clear(void); - virtual void ClearRect(int left, int top, int width, int height); - virtual void CopyFromMemoryDC(vMemoryDC* vmemdc, int destX, int destY, - int srcX = 0, int srcY = 0, int srcW = 0, int srcH = 0); // V:1.13 -#ifdef DRAWARC - virtual void DrawArc(int xx1, int yy1, int xx2, int yy2, int xxc, int yyc); -#endif - virtual void DrawAttrText(int x, int y, VCONST char* text, const ChrAttr attr); - virtual void DrawText(int x, int y, VCONST char* text); - virtual void DrawEllipse(int x, int y, int width, int height); - virtual void DrawIcon(int x, int y, VCONST vIcon& icon); - virtual void DrawLine(int x, int y, int xend , int yend); - virtual void DrawLines(vLine* lineList, int count); - virtual void DrawLines(vPoint* points, int n); - virtual void DrawColorPoints(int x, int y, int nPoints, vColor* pointList); - virtual void DrawPoint(int x, int y); - virtual void DrawPoints(vPoint* pointList, int count); - virtual void DrawPolygon(int n, vPoint points[], int fillStyle); - virtual void DrawRectangle(int x, int y, int width, int height); - virtual void DrawRectangles(vRect* rectList, int count); - virtual void DrawRoundedRectangle(int x, int y, - int width, int height, int radius); - virtual void DrawRubberLine(int x, int y, int xend, int yend); - virtual void DrawRubberEllipse(int x, int y, int width, int height); - virtual void DrawRubberPoint(int x, int y); - virtual void DrawRubberRectangle(int x, int y, int width, int height); - - virtual void SetFont(VCONST vFont& vf); // Set Text font to vf - - // Appearance - - virtual void SetBackground(VCONST vColor& color); - - virtual void SetPen(VCONST vPen& pen); - - virtual void SetBrush(VCONST vBrush& brush); - - virtual int TextHeight(int& asc, int& des) VCONST; - virtual int TextWidth(VCONST char* str) VCONST; - - protected: //--------------------------------------- protected - - virtual Drawable GetDrawable(); - - unsigned long _canvasFG; // the foreground color - unsigned long _canvasBG; // the background color - - Display* _XDisplay; - - void SetPenStyle(GC gc); - void SetGCtoPen(); - void SetGCtoBrush(); - - static vFont _GCFont; // the font actually in the GC - static vPen _GCPen; // the pen in use - static vBrush _GCBrush; // the brush in use - - // Default GC for the widget - GC _GC; // will be filled in - GC _XorGC; // will be filled in - - private: //--------------------------------------- private - - }; -#endif diff --git a/v/includex/v/vxutil.h b/v/includex/v/vxutil.h deleted file mode 100644 index 8aae033..0000000 --- a/v/includex/v/vxutil.h +++ /dev/null @@ -1,27 +0,0 @@ -//=============================================================== -// vxutil.h - utility macros for Motif/Athena duality -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VXUTIL_H -#define VXUTIL_H - -#ifndef Athena // ---------------------------------- Motif ---- - -#define Nbelow(x) XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, x, -#define NrightOf(x) XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, x, - -#else //------------------------------------------ Athena ---- - -#define Nbelow(x) XtNfromVert, x, -#define NrightOf(x) XtNfromHoriz, x, - -#endif // ----------------------------------------------------- - -#endif diff --git a/v/includex/v/vynreply.h b/v/includex/v/vynreply.h deleted file mode 100644 index c8d1c70..0000000 --- a/v/includex/v/vynreply.h +++ /dev/null @@ -1,36 +0,0 @@ -//=============================================================== -// vynreply.h - yes no dialog -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#ifndef VYNREPLY_H -#define VYNREPLY_H -#include - - class vApp; - class vYNReplyDialog : protected vModalDialog - { - public: //---------------------------------------- public - vYNReplyDialog(vBaseWindow* bw, VCONST char* title = "Yes or No") : - vModalDialog(bw,title) { _cmdsAdded = 0; } - vYNReplyDialog(vApp* aw, VCONST char* title = "Yes or No") : - vModalDialog(aw,title) { _cmdsAdded = 0; } - ~vYNReplyDialog() {} - - int AskYN(VCONST char* msg); - - protected: //--------------------------------------- protected - - private: //--------------------------------------- private - - int _cmdsAdded; - virtual void DialogCommand(ItemVal id, ItemVal val, CmdType ctype); - - }; -#endif diff --git a/v/lib/.cvsignore b/v/lib/.cvsignore deleted file mode 100644 index 6135b5b..0000000 --- a/v/lib/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -.directory -*.a diff --git a/v/objwin/.cvsignore b/v/objwin/.cvsignore deleted file mode 100644 index bfe9bed..0000000 --- a/v/objwin/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -.directory -*.o diff --git a/v/objx/.cvsignore b/v/objx/.cvsignore deleted file mode 100644 index bfe9bed..0000000 --- a/v/objx/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -.directory -*.o diff --git a/v/srcwin/Makefile b/v/srcwin/Makefile deleted file mode 100644 index 274e03f..0000000 --- a/v/srcwin/Makefile +++ /dev/null @@ -1,449 +0,0 @@ -#=============================================================== -# V Libray Build Makefile - Version 1.25 - 22Sep00 -# -# For the GNU WIN32 compilers: mingw32, cygwin and egcs variants -# -# Copyright (C) 1995-2000 Bruce E. Wampler -# -# This file is part of the V C++ GUI Framework, and is covered -# under the terms of the GNU Library General Public License, -# Version 2. This library has NO WARRANTY. See the source file -# vapp.cxx for more complete information about license terms. -#=============================================================== -# -# Available targets: -# -# all : vlib -# vlib : builds V library -# clean : removes backup stuff -# -#=============================================================== - -CONFIG = ../Config.mk - -include $(CONFIG) - -oDirDll = $(oDir)dll - -#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -# -# fix library name and C/C++ compile options for the library build -# -#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - - CFLAGSLIB = $(CFLAGS) - - -#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -# -# Object and header file lists -# -#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - -# vstartup.o MUST be first for gnuwin32 to work correctly! -LibGLObjs =\ - $(oDir)/vbglcnv.o - -LibObjs =\ - $(oDir)/vstartup.o \ - $(oDir)/vapp.o \ - $(oDir)/vawinfo.o \ - $(oDir)/vbaseitm.o \ - $(oDir)/vbasewin.o \ - $(oDir)/vboxlblc.o \ - $(oDir)/vbrush.o \ - $(oDir)/vbtncmd.o \ - $(oDir)/vcanvas.o \ - $(oDir)/vcbtncmd.o \ - $(oDir)/vchkboxc.o \ - $(oDir)/vclabelc.o \ - $(oDir)/vcmd.o \ - $(oDir)/vcmdpane.o \ - $(oDir)/vcmdprnt.o \ - $(oDir)/vcmdwin.o \ - $(oDir)/vcolor.o \ - $(oDir)/vcomboc.o \ - $(oDir)/vcpdc.o \ - $(oDir)/vdebug.o \ - $(oDir)/vdialog.o \ - $(oDir)/vfilesel.o \ - $(oDir)/vfinddlg.o \ - $(oDir)/vfont.o \ - $(oDir)/vfontsel.o \ - $(oDir)/vframec.o \ - $(oDir)/vicon.o \ - $(oDir)/vlabelc.o \ - $(oDir)/vlistc.o \ - $(oDir)/vmemdc.o \ - $(oDir)/vmenu.o \ - $(oDir)/vmodald.o \ - $(oDir)/vnotice.o \ - $(oDir)/vos.o \ - $(oDir)/vpen.o \ - $(oDir)/vpopmenu.o \ - $(oDir)/vprogrsc.o \ - $(oDir)/vradioc.o \ - $(oDir)/vreply.o \ - $(oDir)/vrepldlg.o \ - $(oDir)/vsliderc.o \ - $(oDir)/vslist.o \ - $(oDir)/vspinc.o \ - $(oDir)/vtextc.o \ - $(oDir)/vtextcnv.o \ - $(oDir)/vtexted.o \ - $(oDir)/vtextinc.o \ - $(oDir)/vthislst.o \ - $(oDir)/vtimer.o \ - $(oDir)/vutil.o \ - $(oDir)/vwindc.o \ - $(oDir)/vwindow.o \ - $(oDir)/vwinprdc.o \ - $(oDir)/vwinprtr.o \ - $(oDir)/vynreply.o - -BASEDEP =\ - v_defs.h vbaseitm.h vbasewin.h vapp.h vwin32.h - -PANEDEP =\ - vpane.h vwindow.h - -CMDDEP =\ - v_defs.h vdialog.h vcmd.h vcmdprnt.h - -CMDS =\ - vbtncmd.h vcbtncmd.h vlabelc.h vframec.h vchkboxc.h vradioc.h \ - vprogrsc.h vsliderc.h vtextinc.h vlistc.h vcomboc.h vtextc.h \ - vcolor.h vpen.h vclabelc.h vspinc.h - - -#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -# -# targets -# -#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - -.PHONY: default -all: vlib vlibgl - -.PHONY: cleanwin -cleanwin: - -rm -f $(CLEANEXTS) - -rm -f $(HOMEV)/appgen/tags - -rm -f $(HOMEV)/appgen/*.bak - -rm -f $(HOMEV)/appgen/*.o - -rm -f $(HOMEV)/appgen/*.obj - -rm -f $(HOMEV)/appgen/*.exe - -rm -f $(HOMEV)/draw/*.bak - -rm -f $(HOMEV)/draw/tags - -rm -f $(HOMEV)/draw/*.o - -rm -f $(HOMEV)/draw/*.obj - -rm -f $(HOMEV)/drawex/*.bak - -rm -f $(HOMEV)/drawex/tags - -rm -f $(HOMEV)/examp/*.bak - -rm -f $(HOMEV)/examp/tags - -rm -f $(HOMEV)/iconed/*.bak - -rm -f $(HOMEV)/iconed/tags - -rm -f $(HOMEV)/iconed/*.o - -rm -f $(HOMEV)/iconed/*.obj - -rm -f $(HOMEV)/iconed/*.exe - -rm -f $(HOMEV)/icons/*.bak - -rm -f $(HOMEV)/icons/tags - -rm -f $(HOMEV)/icons/*.o - -rm -f $(HOMEV)/icons/*.obj - -rm -f $(HOMEV)/icons/*.exe - -rm -f $(HOMEV)/includew/v/*.bak - -rm -f $(HOMEV)/includew/v/tags - -rm -f $(HOMEV)/srcwin/*.bak - -rm -f $(HOMEV)/srcwin/tags - -rm -f $(HOMEV)/texted/*.bak - -rm -f $(HOMEV)/texted/tags - -rm -f $(HOMEV)/texted/*.o - -rm -f $(HOMEV)/texted/*.obj - -rm -f $(HOMEV)/texted/*.exe - -rm -f $(HOMEV)/vrefman/*.bak - -rm -f $(HOMEV)/vrefman/*.tmp - -rm -f $(HOMEV)/vide/*.class - -rm -f $(HOMEV)/vide/*.bak - -rm -f $(HOMEV)/vide/tags - -rm -f $(HOMEV)/vide/*.o - -rm -f $(HOMEV)/vide/*.obj - -rm -f $(HOMEV)/vide/*.exe - -rm -f $(HOMEV)/vide/testgdb/*.o - -rm -f $(HOMEV)/vide/testgdb/*.exe - -rm -f $(HOMEV)/vide/testgdb/*.bak - -rm -f $(HOMEV)/vide/testgdb/tags - -rm -f $(HOMEV)/test/*.bak - -rm -f $(HOMEV)/test/tags - -rm -f $(HOMEV)/bin/*.exe - -touch $(HOMEV)/bin/ThisIs - -rm -f $(HOMEV)/lib/*.* - -touch $(HOMEV)/lib/ThisIs - -rm -f $(HOMEV)/obj/*.* - -touch $(HOMEV)/obj/ThisIs - -rm -f $(HOMEV)/objdll/*.* - -touch $(HOMEV)/objdll/ThisIs - - -rm -f $(HOMEV)/msvc6/vlib/*.ncb - -rm -f $(HOMEV)/msvc6/vlib/*.opt - -rm -f $(HOMEV)/msvc6/vlib/Release/*.* - -touch $(HOMEV)/msvc6/vlib/Release/ThisIs - -rm -f $(HOMEV)/msvc6/vlib/Debug/*.* - -touch $(HOMEV)/msvc6/vlib/Debug/ThisIs - - -rm -f $(HOMEV)/msvc6/vtestlib/*.ncb - -rm -f $(HOMEV)/msvc6/vtestlib/*.opt - -rm -f $(HOMEV)/msvc6/vtestlib/Release/*.* - -touch $(HOMEV)/msvc6/vtestlib/Release/ThisIs - -rm -f $(HOMEV)/msvc6/vtestlib/Debug/*.* - -touch $(HOMEV)/msvc6/vtestlib/Debug/ThisIs - - -rm -f $(HOMEV)/msvc6/vide/*.ncb - -rm -f $(HOMEV)/msvc6/vide/*.opt - -rm -f $(HOMEV)/msvc6/vide/Release/*.* - -touch $(HOMEV)/msvc6/vide/Release/ThisIs - -rm -f $(HOMEV)/msvc6/vide/Debug/*.* - -touch $(HOMEV)/msvc6/vide/Debug/ThisIs - - -rm -f $(HOMEV)/msvc6/vgl/*.ncb - -rm -f $(HOMEV)/msvc6/vgl/*.opt - -rm -f $(HOMEV)/msvc6/vgl/Release/*.* - -touch $(HOMEV)/msvc6/vgl/Release/ThisIs - -rm -f $(HOMEV)/msvc6/vgl/Debug/*.* - -touch $(HOMEV)/msvc6/vgl/Debug/ThisIs - - -rm -f $(HOMEV)/msvc6/gears/*.ncb - -rm -f $(HOMEV)/msvc6/gears/*.opt - -rm -f $(HOMEV)/msvc6/gears/Release/*.* - -touch $(HOMEV)/msvc6/gears/Release/ThisIs - -rm -f $(HOMEV)/msvc6/gears/Debug/*.* - -touch $(HOMEV)/msvc6/gears/Debug/ThisIs - - -rm -f $(HOMEV)/bccide/*.bak - -rm -f $(HOMEV)/bccide/*.~de - -rm -f $(HOMEV)/bccide/*.csm - -rm -f $(HOMEV)/bccide/*.dsw - -rm -f $(HOMEV)/bccide/*.mrt - -rm -f $(HOMEV)/bccide/*.mbt - -rm -f $(HOMEV)/bccide/*.obr - -.PHONY: clean -clean: - -rm -f $(CLEANEXTS) - -rm -f $(oDir)/*.o - - -#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -# -# target for building the v library -# -#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -.PHONY: vlibgl -vlibgl: $(LibDir)/$(LIBNAME)gl.a - -.PHONY: vlib -vlib: $(LibDir)/$(LIBNAME).a - -$(LibDir)/$(LIBNAME).a: $(LibObjs) - rm -f $(LibDir)/$(LIBNAME).a - $(AR) cr $(LibDir)/$(LIBNAME).a $(LibObjs) $(Lib3dObjs) - $(RANLIB) $(LibDir)/$(LIBNAME).a - -$(LibDir)/$(LIBNAME)gl.a: $(LibGLObjs) - rm -f $(LibDir)/$(LIBNAME)gl.a - $(AR) cr $(LibDir)/$(LIBNAME)gl.a $(LibGLObjs) - $(RANLIB) $(LibDir)/$(LIBNAME)gl.a - - -#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -# -# .o's for the library -# -# note: $@ gives target ($(oDir)/xx.o, -# $< gives first dependency (xx.cpp) -# $(CXX) -c $(CFLAGS) -o $@ $< -# -#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - -$(oDir)/vapp.o: vapp.cpp $(BASEDEP) vfont.h vawinfo.h vcmdwin.h - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vawinfo.o: vawinfo.cpp $(BASEDEP) vawinfo.h - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vbaseitm.o: vbaseitm.cpp vbaseitm.h v_defs.h - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vbasewin.o: vbasewin.cpp $(BASEDEP) - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vbglcnv.o: vbglcnv.cpp vbglcnv.h vcanvas.h vcpdc.h \ - $(BASEDEP) $(PANEDEP) - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vboxlblc.o: vboxlblc.cpp $(BASEDEP) vboxlblc.h vcmdprnt.h - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vbrush.o: vbrush.cpp $(BASEDEP) vbrush.h - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vbtncmd.o: vbtncmd.cpp vbtncmd.h $(CMDDEP) - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vcanvas.o: vcanvas.cpp vcanvas.h vfont.h vcpdc.h vbrush.h \ - vpen.h $(BASEDEP) $(PANEDEP) - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vcbtncmd.o: vcbtncmd.cpp vcbtncmd.h $(CMDDEP) - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vchkboxc.o: vchkboxc.cpp vchkboxc.h $(CMDDEP) - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vclabelc.o: vclabelc.cpp vclabelc.h $(CMDDEP) - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vcmd.o: vcmd.cpp vcmd.h $(BASEDEP) $(PANEDEP) - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vcmdpane.o: vcmdpane.cpp vcmdpane.h $(BASEDEP) $(PANEDEP) - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vcmdwin.o: vcmdwin.cpp $(BASEDEP) vwindow.h vpane.h vcmdwin.h - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vcmdprnt.o: vcmdprnt.cpp $(BASEDEP) vcmdprnt.h $(CMDS) - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vcomboc.o: vcomboc.cpp vcomboc.h $(CMDDEP) - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vcolor.o: vcolor.cpp vcolor.h $(CMDDEP) - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vdebug.o: vdebug.cpp vdebug.h $(BASEDEP) vcmdprnt.h vmodald.h - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vdialog.o: vdialog.cpp vdialog.h $(BASEDEP) vcmdprnt.h - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vcpdc.o: vcpdc.cpp vdc.h vcpdc.h vpen.h $(BASEDEP) - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vpsdc.o: vpsdc.cpp vdc.h vpsdc.h vprinter.h vpsprntr.h $(BASEDEP) - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vfilesel.o: vfilesel.cpp vfilesel.h $(BASEDEP) vcmdprnt.h \ - vmodald.h - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vfinddlg.o: vfinddlg.cpp vfinddlg.h $(BASEDEP) vcmdprnt.h \ - vmodald.h - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vfontsel.o: vfontsel.cpp vfontsel.h vfont.h $(BASEDEP) vcmdprnt.h \ - vmodald.h - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vfont.o: vfont.cpp vfont.h $(BASEDEP) - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vframec.o: vframec.cpp vframec.h $(CMDDEP) - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vicon.o: vicon.cpp vicon.h $(CMDDEP) - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vlabelc.o: vlabelc.cpp vlabelc.h $(CMDDEP) - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vlistc.o: vlistc.cpp vlistc.h $(CMDDEP) - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vmemdc.o: vmemdc.cpp vmemdc.h vdc.h vpen.h vpen.h $(BASEDEP) - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vmenu.o: vmenu.cpp vmenu.h $(BASEDEP) $(PANEDEP) vcmdwin.h - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vmodald.o: vmodald.cpp vmodald.h vdialog.h \ - $(BASEDEP) vcmdprnt.h - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vnotice.o: vnotice.cpp vnotice.h $(BASEDEP) vcmdprnt.h \ - vmodald.h - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vos.o: vos.cpp vos.h $(BASEDEP) - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vpen.o: vpen.cpp vpen.h $(BASEDEP) - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vpopmenu.o: vpopmenu.cpp vpopmenu.h $(BASEDEP) $(PANEDEP) - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vprogrsc.o: vprogrsc.cpp vprogrsc.h $(CMDDEP) - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vpsprntr.o: vpsprntr.cpp vpsprntr.h vprinter.h $(BASEDEP) - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vradioc.o: vradioc.cpp vradioc.h $(CMDDEP) - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vsliderc.o: vsliderc.cpp vsliderc.h $(CMDDEP) - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vslist.o: vslist.cpp vslist.h - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vrepldlg.o: vrepldlg.cpp vrepldlg.h $(BASEDEP) vcmdprnt.h \ - vmodald.h - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vreply.o: vreply.cpp vreply.h $(BASEDEP) vcmdprnt.h vmodald.h - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vspinc.o: vspinc.cpp vspinc.h $(CMDDEP) - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vstartup.o: vstartup.cpp vapp.h - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vtextc.o: vtextc.cpp vtextc.h $(CMDDEP) - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vtextcnv.o: vtextcnv.cpp vtextcnv.h vcanvas.h vcpdc.h \ - $(BASEDEP) $(PANEDEP) - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vtexted.o: vtexted.cpp vtexted.h vtextcnv.h vcanvas.h vcpdc.h \ - $(BASEDEP) $(PANEDEP) - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vtextinc.o: vtextinc.cpp vtextinc.h $(CMDDEP) - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vthislst.o: vthislst.cpp vthislst.h vwin32.h - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vtimer.o: vtimer.cpp vtimer.h vapp.h - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vutil.o: vutil.cpp vutil.h - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vwindc.o: vwindc.cpp $(BASEDEP) vwindc.h vmemdc.h vcanvas.h vicon.h - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vwindow.o: vwindow.cpp $(BASEDEP) vwindow.h vpane.h - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vwinprdc.o: vwinprdc.cpp $(BASEDEP) vwinprdc.h - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vwinprtr.o: vwinprtr.cpp $(BASEDEP) vwinprtr.h - $(CXX) -c $(CFLAGSLIB) -o $@ $< - -$(oDir)/vynreply.o: vynreply.cpp vynreply.h $(BASEDEP) vcmdprnt.h vmodald.h - $(CXX) -c $(CFLAGSLIB) -o $@ $< diff --git a/v/srcwin/Makefile.v b/v/srcwin/Makefile.v deleted file mode 100644 index c62fac1..0000000 --- a/v/srcwin/Makefile.v +++ /dev/null @@ -1,77 +0,0 @@ -#======================================================================= -#@V@:Note: File automatically generated by VIDE: (10:38:07 15 Mar 2000) (BCC32). -# This file regenerated each time you run VIDE, so save under a -# new name if you hand edit, or it will be overwritten. -#======================================================================= - -# Standard defines: -.AUTODEPEND - -# Borland C++ tools -IMPLIB = $(BCCROOT)\bin\Implib -ILINK32 = $(BCCROOT)\bin\ILink32 -TLIB = $(BCCROOT)\bin\TLib -BRC32 = $(BCCROOT)\bin\Brc32 -TASM32 = $(BCROOT)\bin\Tasm32 -CC = $(BCCROOT)\bin\BCC32 - -BCCROOT = C:\borland\bcc55 - -HOMEV = -VPATH = $(HOMEV)\include -oDir = ..\obj -Bin = ..\lib -Src = . -libDirs = -L$(BCCROOT)\lib;$(BCCROOT)\lib\psdk - -incDirs = -I$(BCCROOT)\include;..\includew - -LIBS = -v- -C_FLAGS = -O1 -v- -a2 - -SRCS =\ - $(Src)\vbglcnv.cpp - -EXOBJS =\ - $(oDir)\vbglcnv.obj - -ALLOBJS = $(EXOBJS) -BCCJUNK = *.il* *.csm *.tds -ALLBIN = $(Bin)\vglbcc.lib -ALLTGT = $(Bin)\vglbcc.lib - -# User defines: - -#@# Targets follow --------------------------------- - -all: $(ALLTGT) - -objs: $(ALLOBJS) - -cleanobjs: - rm -f $(ALLOBJS) - -cleanbin: - rm -f $(ALLBIN) $(BCCJUNK) - -clean: cleanobjs cleanbin - -cleanall: cleanobjs cleanbin - -#@# User Targets follow --------------------------------- - -# BCC32 RT lib: cw32.lib static -BCC32RTLIB = cw32 -# BCC32 Startup: c0x32.obj-console, c0w32.obj-winapi - -#@# Dependency rules follow ----------------------------- - -$(Bin)\vglbcc.lib : $(EXOBJS) - rm -f $< - $(TLIB) $< @&&| - +$(oDir)\vbglcnv.obj -| - -$(oDir)\vbglcnv.obj : $(Src)\vbglcnv.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vbglcnv.cpp - diff --git a/v/srcwin/Makefile.vbor b/v/srcwin/Makefile.vbor deleted file mode 100644 index 0d237bf..0000000 --- a/v/srcwin/Makefile.vbor +++ /dev/null @@ -1,398 +0,0 @@ -#======================================================================= -#@V@:Note: File automatically generated by VIDE: (09:43:00 14 Mar 2000) (bcc32). -# This file regenerated each time you run VIDE, so save under a -# new name if you hand edit, or it will be overwritten. -#======================================================================= - -# Standard defines: -.AUTODEPEND - -# Borland C++ tools -IMPLIB = $(BCCROOT)\bin\Implib -ILINK32 = $(BCCROOT)\bin\ILink32 -TLIB = $(BCCROOT)\bin\TLib -BRC32 = $(BCCROOT)\bin\Brc32 -TASM32 = $(BCROOT)\bin\Tasm32 -CC = $(BCCROOT)\bin\bcc32 - -BCCROOT = C:\borland\bcc55 - -HOMEV = -VPATH = $(HOMEV)\include -oDir = ..\obj -Bin = ..\lib -Src = . -libDirs = - -incDirs = -I$(BCCROOT)\include;..\includew - -LIBS = -C_FLAGS = -P- -w -O1 -v- - -SRCS =\ - $(Src)\vapp.cpp\ - $(Src)\vawinfo.cpp\ - $(Src)\vbaseitm.cpp\ - $(Src)\vbasewin.cpp\ - $(Src)\vboxlblc.cpp\ - $(Src)\vbrush.cpp\ - $(Src)\vbtncmd.cpp\ - $(Src)\vcanvas.cpp\ - $(Src)\vcbtncmd.cpp\ - $(Src)\vchkboxc.cpp\ - $(Src)\vclabelc.cpp\ - $(Src)\vcmd.cpp\ - $(Src)\vcmdpane.cpp\ - $(Src)\vcmdprnt.cpp\ - $(Src)\vcmdwin.cpp\ - $(Src)\vcolor.cpp\ - $(Src)\vcomboc.cpp\ - $(Src)\vcpdc.cpp\ - $(Src)\vdebug.cpp\ - $(Src)\vdialog.cpp\ - $(Src)\vfilesel.cpp\ - $(Src)\vfinddlg.cpp\ - $(Src)\vfont.cpp\ - $(Src)\vfontsel.cpp\ - $(Src)\vframec.cpp\ - $(Src)\vicon.cpp\ - $(Src)\vlabelc.cpp\ - $(Src)\vlistc.cpp\ - $(Src)\vmemdc.cpp\ - $(Src)\vmenu.cpp\ - $(Src)\vmodald.cpp\ - $(Src)\vnotice.cpp\ - $(Src)\vos.cpp\ - $(Src)\vpen.cpp\ - $(Src)\vpopmenu.cpp\ - $(Src)\vprogrsc.cpp\ - $(Src)\vradioc.cpp\ - $(Src)\vrepldlg.cpp\ - $(Src)\vreply.cpp\ - $(Src)\vsliderc.cpp\ - $(Src)\vslist.cpp\ - $(Src)\vspinc.cpp\ - $(Src)\vstartup.cpp\ - $(Src)\vtextc.cpp\ - $(Src)\vtextcnv.cpp\ - $(Src)\vtexted.cpp\ - $(Src)\vtextinc.cpp\ - $(Src)\vthislst.cpp\ - $(Src)\vtimer.cpp\ - $(Src)\vwindc.cpp\ - $(Src)\vutil.cpp\ - $(Src)\vwindow.cpp\ - $(Src)\vwinprdc.cpp\ - $(Src)\vwinprtr.cpp\ - $(Src)\vynreply.cpp - -EXOBJS =\ - $(oDir)\vapp.obj\ - $(oDir)\vawinfo.obj\ - $(oDir)\vbaseitm.obj\ - $(oDir)\vbasewin.obj\ - $(oDir)\vboxlblc.obj\ - $(oDir)\vbrush.obj\ - $(oDir)\vbtncmd.obj\ - $(oDir)\vcanvas.obj\ - $(oDir)\vcbtncmd.obj\ - $(oDir)\vchkboxc.obj\ - $(oDir)\vclabelc.obj\ - $(oDir)\vcmd.obj\ - $(oDir)\vcmdpane.obj\ - $(oDir)\vcmdprnt.obj\ - $(oDir)\vcmdwin.obj\ - $(oDir)\vcolor.obj\ - $(oDir)\vcomboc.obj\ - $(oDir)\vcpdc.obj\ - $(oDir)\vdebug.obj\ - $(oDir)\vdialog.obj\ - $(oDir)\vfilesel.obj\ - $(oDir)\vfinddlg.obj\ - $(oDir)\vfont.obj\ - $(oDir)\vfontsel.obj\ - $(oDir)\vframec.obj\ - $(oDir)\vicon.obj\ - $(oDir)\vlabelc.obj\ - $(oDir)\vlistc.obj\ - $(oDir)\vmemdc.obj\ - $(oDir)\vmenu.obj\ - $(oDir)\vmodald.obj\ - $(oDir)\vnotice.obj\ - $(oDir)\vos.obj\ - $(oDir)\vpen.obj\ - $(oDir)\vpopmenu.obj\ - $(oDir)\vprogrsc.obj\ - $(oDir)\vradioc.obj\ - $(oDir)\vrepldlg.obj\ - $(oDir)\vreply.obj\ - $(oDir)\vsliderc.obj\ - $(oDir)\vslist.obj\ - $(oDir)\vspinc.obj\ - $(oDir)\vstartup.obj\ - $(oDir)\vtextc.obj\ - $(oDir)\vtextcnv.obj\ - $(oDir)\vtexted.obj\ - $(oDir)\vtextinc.obj\ - $(oDir)\vthislst.obj\ - $(oDir)\vtimer.obj\ - $(oDir)\vwindc.obj\ - $(oDir)\vutil.obj\ - $(oDir)\vwindow.obj\ - $(oDir)\vwinprdc.obj\ - $(oDir)\vwinprtr.obj\ - $(oDir)\vynreply.obj - -ALLOBJS = $(EXOBJS) -BCCJUNK = *.il* *.csm *.tds -ALLBIN = $(Bin)\vguibcc.lib -ALLTGT = $(Bin)\vguibcc.lib - -# User defines: - -#@# Targets follow --------------------------------- - -all: $(ALLTGT) - -objs: $(ALLOBJS) - -cleanobjs: - rm -f $(ALLOBJS) - -cleanbin: - rm -f $(ALLBIN) $(BCCJUNK) - -clean: cleanobjs cleanbin - -cleanall: cleanobjs cleanbin - -#@# User Targets follow --------------------------------- - - -#@# Dependency rules follow ----------------------------- - -$(Bin)\vguibcc.lib : $(EXOBJS) - rm -f $< - $(TLIB) $< @&&| - +$(oDir)\vapp.obj & - +$(oDir)\vawinfo.obj & - +$(oDir)\vbaseitm.obj & - +$(oDir)\vbasewin.obj & - +$(oDir)\vboxlblc.obj & - +$(oDir)\vbrush.obj & - +$(oDir)\vbtncmd.obj & - +$(oDir)\vcanvas.obj & - +$(oDir)\vcbtncmd.obj & - +$(oDir)\vchkboxc.obj & - +$(oDir)\vclabelc.obj & - +$(oDir)\vcmd.obj & - +$(oDir)\vcmdpane.obj & - +$(oDir)\vcmdprnt.obj & - +$(oDir)\vcmdwin.obj & - +$(oDir)\vcolor.obj & - +$(oDir)\vcomboc.obj & - +$(oDir)\vcpdc.obj & - +$(oDir)\vdebug.obj & - +$(oDir)\vdialog.obj & - +$(oDir)\vfilesel.obj & - +$(oDir)\vfinddlg.obj & - +$(oDir)\vfont.obj & - +$(oDir)\vfontsel.obj & - +$(oDir)\vframec.obj & - +$(oDir)\vicon.obj & - +$(oDir)\vlabelc.obj & - +$(oDir)\vlistc.obj & - +$(oDir)\vmemdc.obj & - +$(oDir)\vmenu.obj & - +$(oDir)\vmodald.obj & - +$(oDir)\vnotice.obj & - +$(oDir)\vos.obj & - +$(oDir)\vpen.obj & - +$(oDir)\vpopmenu.obj & - +$(oDir)\vprogrsc.obj & - +$(oDir)\vradioc.obj & - +$(oDir)\vrepldlg.obj & - +$(oDir)\vreply.obj & - +$(oDir)\vsliderc.obj & - +$(oDir)\vslist.obj & - +$(oDir)\vspinc.obj & - +$(oDir)\vstartup.obj & - +$(oDir)\vtextc.obj & - +$(oDir)\vtextcnv.obj & - +$(oDir)\vtexted.obj & - +$(oDir)\vtextinc.obj & - +$(oDir)\vthislst.obj & - +$(oDir)\vtimer.obj & - +$(oDir)\vwindc.obj & - +$(oDir)\vutil.obj & - +$(oDir)\vwindow.obj & - +$(oDir)\vwinprdc.obj & - +$(oDir)\vwinprtr.obj & - +$(oDir)\vynreply.obj -| - -$(oDir)\vapp.obj : $(Src)\vapp.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vapp.cpp - -$(oDir)\vawinfo.obj : $(Src)\vawinfo.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vawinfo.cpp - -$(oDir)\vbaseitm.obj : $(Src)\vbaseitm.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vbaseitm.cpp - -$(oDir)\vbasewin.obj : $(Src)\vbasewin.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vbasewin.cpp - -$(oDir)\vboxlblc.obj : $(Src)\vboxlblc.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vboxlblc.cpp - -$(oDir)\vbrush.obj : $(Src)\vbrush.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vbrush.cpp - -$(oDir)\vbtncmd.obj : $(Src)\vbtncmd.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vbtncmd.cpp - -$(oDir)\vcanvas.obj : $(Src)\vcanvas.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vcanvas.cpp - -$(oDir)\vcbtncmd.obj : $(Src)\vcbtncmd.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vcbtncmd.cpp - -$(oDir)\vchkboxc.obj : $(Src)\vchkboxc.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vchkboxc.cpp - -$(oDir)\vclabelc.obj : $(Src)\vclabelc.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vclabelc.cpp - -$(oDir)\vcmd.obj : $(Src)\vcmd.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vcmd.cpp - -$(oDir)\vcmdpane.obj : $(Src)\vcmdpane.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vcmdpane.cpp - -$(oDir)\vcmdprnt.obj : $(Src)\vcmdprnt.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vcmdprnt.cpp - -$(oDir)\vcmdwin.obj : $(Src)\vcmdwin.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vcmdwin.cpp - -$(oDir)\vcolor.obj : $(Src)\vcolor.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vcolor.cpp - -$(oDir)\vcomboc.obj : $(Src)\vcomboc.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vcomboc.cpp - -$(oDir)\vcpdc.obj : $(Src)\vcpdc.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vcpdc.cpp - -$(oDir)\vdebug.obj : $(Src)\vdebug.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vdebug.cpp - -$(oDir)\vdialog.obj : $(Src)\vdialog.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vdialog.cpp - -$(oDir)\vfilesel.obj : $(Src)\vfilesel.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vfilesel.cpp - -$(oDir)\vfinddlg.obj : $(Src)\vfinddlg.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vfinddlg.cpp - -$(oDir)\vfont.obj : $(Src)\vfont.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vfont.cpp - -$(oDir)\vfontsel.obj : $(Src)\vfontsel.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vfontsel.cpp - -$(oDir)\vframec.obj : $(Src)\vframec.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vframec.cpp - -$(oDir)\vicon.obj : $(Src)\vicon.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vicon.cpp - -$(oDir)\vlabelc.obj : $(Src)\vlabelc.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vlabelc.cpp - -$(oDir)\vlistc.obj : $(Src)\vlistc.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vlistc.cpp - -$(oDir)\vmemdc.obj : $(Src)\vmemdc.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vmemdc.cpp - -$(oDir)\vmenu.obj : $(Src)\vmenu.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vmenu.cpp - -$(oDir)\vmodald.obj : $(Src)\vmodald.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vmodald.cpp - -$(oDir)\vnotice.obj : $(Src)\vnotice.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vnotice.cpp - -$(oDir)\vos.obj : $(Src)\vos.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vos.cpp - -$(oDir)\vpen.obj : $(Src)\vpen.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vpen.cpp - -$(oDir)\vpopmenu.obj : $(Src)\vpopmenu.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vpopmenu.cpp - -$(oDir)\vprogrsc.obj : $(Src)\vprogrsc.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vprogrsc.cpp - -$(oDir)\vradioc.obj : $(Src)\vradioc.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vradioc.cpp - -$(oDir)\vrepldlg.obj : $(Src)\vrepldlg.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vrepldlg.cpp - -$(oDir)\vreply.obj : $(Src)\vreply.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vreply.cpp - -$(oDir)\vsliderc.obj : $(Src)\vsliderc.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vsliderc.cpp - -$(oDir)\vslist.obj : $(Src)\vslist.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vslist.cpp - -$(oDir)\vspinc.obj : $(Src)\vspinc.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vspinc.cpp - -$(oDir)\vstartup.obj : $(Src)\vstartup.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vstartup.cpp - -$(oDir)\vtextc.obj : $(Src)\vtextc.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vtextc.cpp - -$(oDir)\vtextcnv.obj : $(Src)\vtextcnv.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vtextcnv.cpp - -$(oDir)\vtexted.obj : $(Src)\vtexted.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vtexted.cpp - -$(oDir)\vtextinc.obj : $(Src)\vtextinc.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vtextinc.cpp - -$(oDir)\vthislst.obj : $(Src)\vthislst.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vthislst.cpp - -$(oDir)\vtimer.obj : $(Src)\vtimer.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vtimer.cpp - -$(oDir)\vwindc.obj : $(Src)\vwindc.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vwindc.cpp - -$(oDir)\vutil.obj : $(Src)\vutil.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vutil.cpp - -$(oDir)\vwindow.obj : $(Src)\vwindow.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vwindow.cpp - -$(oDir)\vwinprdc.obj : $(Src)\vwinprdc.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vwinprdc.cpp - -$(oDir)\vwinprtr.obj : $(Src)\vwinprtr.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vwinprtr.cpp - -$(oDir)\vynreply.obj : $(Src)\vynreply.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vynreply.cpp - diff --git a/v/srcwin/Makefile.vborgl b/v/srcwin/Makefile.vborgl deleted file mode 100644 index ea7d315..0000000 --- a/v/srcwin/Makefile.vborgl +++ /dev/null @@ -1,77 +0,0 @@ -#======================================================================= -#@V@:Note: File automatically generated by VIDE: (10:38:15 15 Mar 2000) (BCC32). -# This file regenerated each time you run VIDE, so save under a -# new name if you hand edit, or it will be overwritten. -#======================================================================= - -# Standard defines: -.AUTODEPEND - -# Borland C++ tools -IMPLIB = $(BCCROOT)\bin\Implib -ILINK32 = $(BCCROOT)\bin\ILink32 -TLIB = $(BCCROOT)\bin\TLib -BRC32 = $(BCCROOT)\bin\Brc32 -TASM32 = $(BCROOT)\bin\Tasm32 -CC = $(BCCROOT)\bin\BCC32 - -BCCROOT = C:\borland\bcc55 - -HOMEV = -VPATH = $(HOMEV)\include -oDir = ..\obj -Bin = ..\lib -Src = . -libDirs = -L$(BCCROOT)\lib;$(BCCROOT)\lib\psdk - -incDirs = -I$(BCCROOT)\include;..\includew - -LIBS = -v- -C_FLAGS = -O1 -v- -a2 - -SRCS =\ - $(Src)\vbglcnv.cpp - -EXOBJS =\ - $(oDir)\vbglcnv.obj - -ALLOBJS = $(EXOBJS) -BCCJUNK = *.il* *.csm *.tds -ALLBIN = $(Bin)\vglbcc.lib -ALLTGT = $(Bin)\vglbcc.lib - -# User defines: - -#@# Targets follow --------------------------------- - -all: $(ALLTGT) - -objs: $(ALLOBJS) - -cleanobjs: - rm -f $(ALLOBJS) - -cleanbin: - rm -f $(ALLBIN) $(BCCJUNK) - -clean: cleanobjs cleanbin - -cleanall: cleanobjs cleanbin - -#@# User Targets follow --------------------------------- - -# BCC32 RT lib: cw32.lib static -BCC32RTLIB = cw32 -# BCC32 Startup: c0x32.obj-console, c0w32.obj-winapi - -#@# Dependency rules follow ----------------------------- - -$(Bin)\vglbcc.lib : $(EXOBJS) - rm -f $< - $(TLIB) $< @&&| - +$(oDir)\vbglcnv.obj -| - -$(oDir)\vbglcnv.obj : $(Src)\vbglcnv.cpp - $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\vbglcnv.cpp - diff --git a/v/srcwin/Makefile.vdll b/v/srcwin/Makefile.vdll deleted file mode 100644 index 4e41093..0000000 --- a/v/srcwin/Makefile.vdll +++ /dev/null @@ -1,343 +0,0 @@ -#======================================================================= -#@V@:Note: File automatically generated by VIDE: (12:46:47 18 Sep 2000) (g++). -# This file regenerated each time you run VIDE, so save under a -# new name if you hand edit, or it will be overwritten. -#======================================================================= - -# Standard defines: -CC = g++ - -WRES = windres - -HOMEV = -VPATH = $(HOMEV)/include -oDir = ../objdll -Bin = ../lib -Src = . -libDirs = -incDirs = -I../includew - -LIBS = -C_FLAGS = -O\ - -DBUILD_V_DLL - -SRCS =\ - $(Src)/vapp.cpp\ - $(Src)/vawinfo.cpp\ - $(Src)/vbaseitm.cpp\ - $(Src)/vbasewin.cpp\ - $(Src)/vboxlblc.cpp\ - $(Src)/vbrush.cpp\ - $(Src)/vbtncmd.cpp\ - $(Src)/vcanvas.cpp\ - $(Src)/vcbtncmd.cpp\ - $(Src)/vchkboxc.cpp\ - $(Src)/vclabelc.cpp\ - $(Src)/vcmd.cpp\ - $(Src)/vcmdpane.cpp\ - $(Src)/vcmdprnt.cpp\ - $(Src)/vcmdwin.cpp\ - $(Src)/vcolor.cpp\ - $(Src)/vcomboc.cpp\ - $(Src)/vcpdc.cpp\ - $(Src)/vdebug.cpp\ - $(Src)/vdialog.cpp\ - $(Src)/vfilesel.cpp\ - $(Src)/vfinddlg.cpp\ - $(Src)/vfont.cpp\ - $(Src)/vfontsel.cpp\ - $(Src)/vframec.cpp\ - $(Src)/vicon.cpp\ - $(Src)/vlabelc.cpp\ - $(Src)/vlistc.cpp\ - $(Src)/vmemdc.cpp\ - $(Src)/vmenu.cpp\ - $(Src)/vmodald.cpp\ - $(Src)/vnotice.cpp\ - $(Src)/vos.cpp\ - $(Src)/vpen.cpp\ - $(Src)/vpopmenu.cpp\ - $(Src)/vprogrsc.cpp\ - $(Src)/vradioc.cpp\ - $(Src)/vrepldlg.cpp\ - $(Src)/vreply.cpp\ - $(Src)/vsliderc.cpp\ - $(Src)/vslist.cpp\ - $(Src)/vspinc.cpp\ - $(Src)/vtextc.cpp\ - $(Src)/vtextcnv.cpp\ - $(Src)/vtexted.cpp\ - $(Src)/vtextinc.cpp\ - $(Src)/vthislst.cpp\ - $(Src)/vtimer.cpp\ - $(Src)/vwindc.cpp\ - $(Src)/vutil.cpp\ - $(Src)/vwindow.cpp\ - $(Src)/vwinprdc.cpp\ - $(Src)/vwinprtr.cpp\ - $(Src)/vynreply.cpp - -EXOBJS =\ - $(oDir)/vapp.o\ - $(oDir)/vawinfo.o\ - $(oDir)/vbaseitm.o\ - $(oDir)/vbasewin.o\ - $(oDir)/vboxlblc.o\ - $(oDir)/vbrush.o\ - $(oDir)/vbtncmd.o\ - $(oDir)/vcanvas.o\ - $(oDir)/vcbtncmd.o\ - $(oDir)/vchkboxc.o\ - $(oDir)/vclabelc.o\ - $(oDir)/vcmd.o\ - $(oDir)/vcmdpane.o\ - $(oDir)/vcmdprnt.o\ - $(oDir)/vcmdwin.o\ - $(oDir)/vcolor.o\ - $(oDir)/vcomboc.o\ - $(oDir)/vcpdc.o\ - $(oDir)/vdebug.o\ - $(oDir)/vdialog.o\ - $(oDir)/vfilesel.o\ - $(oDir)/vfinddlg.o\ - $(oDir)/vfont.o\ - $(oDir)/vfontsel.o\ - $(oDir)/vframec.o\ - $(oDir)/vicon.o\ - $(oDir)/vlabelc.o\ - $(oDir)/vlistc.o\ - $(oDir)/vmemdc.o\ - $(oDir)/vmenu.o\ - $(oDir)/vmodald.o\ - $(oDir)/vnotice.o\ - $(oDir)/vos.o\ - $(oDir)/vpen.o\ - $(oDir)/vpopmenu.o\ - $(oDir)/vprogrsc.o\ - $(oDir)/vradioc.o\ - $(oDir)/vrepldlg.o\ - $(oDir)/vreply.o\ - $(oDir)/vsliderc.o\ - $(oDir)/vslist.o\ - $(oDir)/vspinc.o\ - $(oDir)/vtextc.o\ - $(oDir)/vtextcnv.o\ - $(oDir)/vtexted.o\ - $(oDir)/vtextinc.o\ - $(oDir)/vthislst.o\ - $(oDir)/vtimer.o\ - $(oDir)/vwindc.o\ - $(oDir)/vutil.o\ - $(oDir)/vwindow.o\ - $(oDir)/vwinprdc.o\ - $(oDir)/vwinprtr.o\ - $(oDir)/vynreply.o - -ALLOBJS = $(EXOBJS) -ALLBIN = $(Bin)/vgui125.dll -ALLTGT = $(Bin)/vgui125.dll - -# User defines: -VVERS = 125 - -#@# Targets follow --------------------------------- - -all: $(ALLTGT) - -objs: $(ALLOBJS) - -cleanobjs: - rm -f $(ALLOBJS) - -cleanbin: - rm -f $(ALLBIN) - -clean: cleanobjs cleanbin - -cleanall: cleanobjs cleanbin - -#@# User Targets follow --------------------------------- - -#all - override 'all' target -# following contributed by franzo bez -$(Bin)/vgui$(VVERS).dll: $(EXOBJS) $(oDir)/vstartup.o $(oDir)/vbglcnv.o - rm -f $(Bin)/vgui$(VVERS).dll - rm -f $(Bin)/libVDLL.a - dllwrap --export-all --output-lib=$(Bin)/libVDLL.a --dllname=vgui$(VVERS).dll \ - -o$(Bin)/vgui$(VVERS).dll --driver-name=$(CC) \ - $(EXOBJS) -lopengl32 -lglu32 -lcomctl32 -lgdi32 -lshell32 -lcomdlg32 - strip $(Bin)/vgui$(VVERS).dll - ar q $(Bin)/libVDLL.a $(oDir)/vstartup.o $(oDir)/vbglcnv.o - ranlib $(Bin)/libVDLL.a -# -# added target to split out vstart from rest of source -$(oDir)/vstartup.o: vstartup.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vbglcnv.o: vbglcnv.cpp - $(CC) $(C_FLAGS) -DUSE_V_DLL $(incDirs) -c -o $@ $< - -#@# Dependency rules follow ----------------------------- - - -$(oDir)/vapp.o: vapp.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vawinfo.o: vawinfo.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vbaseitm.o: vbaseitm.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vbasewin.o: vbasewin.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vboxlblc.o: vboxlblc.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vbrush.o: vbrush.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vbtncmd.o: vbtncmd.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vcanvas.o: vcanvas.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vcbtncmd.o: vcbtncmd.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vchkboxc.o: vchkboxc.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vclabelc.o: vclabelc.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vcmd.o: vcmd.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vcmdpane.o: vcmdpane.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vcmdprnt.o: vcmdprnt.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vcmdwin.o: vcmdwin.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vcolor.o: vcolor.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vcomboc.o: vcomboc.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vcpdc.o: vcpdc.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vdebug.o: vdebug.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vdialog.o: vdialog.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vfilesel.o: vfilesel.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vfinddlg.o: vfinddlg.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vfont.o: vfont.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vfontsel.o: vfontsel.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vframec.o: vframec.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vicon.o: vicon.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vlabelc.o: vlabelc.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vlistc.o: vlistc.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vmemdc.o: vmemdc.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vmenu.o: vmenu.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vmodald.o: vmodald.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vnotice.o: vnotice.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vos.o: vos.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vpen.o: vpen.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vpopmenu.o: vpopmenu.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vprogrsc.o: vprogrsc.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vradioc.o: vradioc.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vrepldlg.o: vrepldlg.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vreply.o: vreply.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vsliderc.o: vsliderc.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vslist.o: vslist.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vspinc.o: vspinc.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vtextc.o: vtextc.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vtextcnv.o: vtextcnv.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vtexted.o: vtexted.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vtextinc.o: vtextinc.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vthislst.o: vthislst.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vtimer.o: vtimer.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vwindc.o: vwindc.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vutil.o: vutil.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vwindow.o: vwindow.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vwinprdc.o: vwinprdc.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vwinprtr.o: vwinprtr.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vynreply.o: vynreply.cpp - $(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< diff --git a/v/srcwin/fixcrlf.bat b/v/srcwin/fixcrlf.bat deleted file mode 100644 index 86ab5e3..0000000 --- a/v/srcwin/fixcrlf.bat +++ /dev/null @@ -1,48 +0,0 @@ -strpcrlf ..\appgen\*.cpp /CR -strpcrlf ..\appgen\make* /CR -strpcrlf ..\appgen\*.h /CR -strpcrlf ..\bmp2vbm\*.cpp /CR -strpcrlf ..\bmp2vbm\make* /CR -strpcrlf ..\bmp2vbm\*.h /CR -strpcrlf ..\configs\*.mk /CR -strpcrlf ..\configs\*.txt /CR -strpcrlf ..\draw\*.cpp /CR -strpcrlf ..\draw\make* /CR -strpcrlf ..\draw\*.h /CR -strpcrlf ..\drawex\*.cpp /CR -strpcrlf ..\drawex\make* /CR -strpcrlf ..\drawex\*.h /CR -strpcrlf ..\examp\*.cpp /CR -strpcrlf ..\examp\make* /CR -strpcrlf ..\examp\*.h /CR -strpcrlf ..\iconed\*.cpp /CR -strpcrlf ..\iconed\*.h /CR -strpcrlf ..\iconed\make* /CR -strpcrlf ..\icons\*.cpp /CR -strpcrlf ..\icons\*.h /CR -strpcrlf ..\icons\make* /CR -strpcrlf ..\includew\v\*.h /CR -strpcrlf ..\includex\v\*.h /CR -strpcrlf ..\make* /CR -strpcrlf ..\srcwin\*.cpp /CR -strpcrlf ..\srcwin\make* /CR -strpcrlf ..\srcx\*.cxx /CR -strpcrlf ..\srcx\make* /CR -strpcrlf ..\srcx\*.c /CR -strpcrlf ..\test\*.cpp /CR -strpcrlf ..\test\*.h /CR -strpcrlf ..\test\make* /CR -strpcrlf ..\texted\*.cpp /CR -strpcrlf ..\texted\*.h /CR -strpcrlf ..\texted\make* /CR -strpcrlf ..\tutor\*.cpp /CR -strpcrlf ..\tutor\*.h /CR -strpcrlf ..\tutor\make* /CR -strpcrlf ..\vide\*.cpp /CR -strpcrlf ..\vide\*.h /CR -strpcrlf ..\vide\make* /CR -strpcrlf ..\vopengl\*.cpp /CR -strpcrlf ..\vopengl\*.h /CR -strpcrlf ..\vopengl\make* /CR -strpcrlf ..\vrefman\*.htm /CR -strpcrlf ..\vrefman\*.html /CR diff --git a/v/srcwin/vapp.cpp b/v/srcwin/vapp.cpp deleted file mode 100644 index 171050f..0000000 --- a/v/srcwin/vapp.cpp +++ /dev/null @@ -1,1341 +0,0 @@ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// -// VV VV // -// VV VV V - A Portable C++ GUI Framework VV VV // -// VV VV designed and written by VV VV // -// VV VV VV VV // -// VV VV Bruce E. Wampler, Ph.D. VV VV // -// VVV e-mail: bruce@objectcentral.com VVV // -// V V // -// // -// date: 31 Mar 2000 10:12:59 -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// -// // -// vapp.cxx - The vApp control object (For Windows) // -// // -// Copyright (C) 1995-2000 Bruce E. Wampler // -// // -// This file is part of the V C++ GUI Framework. // -// // -// This license described in this file overrides all other licenses // -// that might be specified in other files for this library. // -// // -// This library is free software; you can redistribute it and/or // -// modify it under the terms of the GNU Lesser General Public // -// License as published by the Free Software Foundation; either // -// version 2.1 of the License, or (at your option) any later version. // -// // -// This library is distributed in the hope that it will be useful, // -// but WITHOUT ANY WARRANTY; without even the implied warranty of // -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // -// Library General Public License for more details. // -// // -// You should have received a copy of the GNU Lesser General Public // -// License along with this library (see COPYING.LIB); if not, write to the // -// Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -// // -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// -#include // for Win 32 stuff -#include // my header file -#include // Win header -#include // for font stuff -#include -#include -#include - -#include - -#include - -#include // for tooltips - - // These definitions contributed by Franco Bez V 1.24 -#ifndef BUILD_V_DLL -#if defined (__MINGW32__) || defined(__CYGWIN32__) - // This forces the GNU Linker to include vstartup.o in the executable - // Only needed here for the static library, for DLL use it must be - // in one of the Applications object files -> see vApp.h - int (*gnuw32dummy)(HINSTANCE,HINSTANCE,LPSTR,int) = WinMain; -#endif -#endif - - // Globals available to the world - - vApp* theGlobalApp = NULL; // to be filled in upon instantiation - int (*pAppMain)(int, char**); - DebugMask DebugState; - - - int CMain(HANDLE hInstance, HANDLE hPrevInstance, - LPSTR lpszCmdLine, int nCmdShow); - - static char szMdiFrameClass [] = "MdiFrameClass"; // To give it a name - static char szMdiWindowClass [] = "MdiWindowClass"; // To give it a name - static int _destroyed; // for destructor - - - static char copyright[] = - "****> Copyright (C) 1995-2000 Bruce E. Wampler; under terms of the\ - GNU Library General Public License, version 2 <****"; - -//========================>>> vApp::vApp <<<======================= - vApp::vApp(VCONST char* appName, int simSDI, int frameWidth, - int frameHeight) : vBaseItem(appName) // constructor - { - // First, set the global pointer to the main App. This happens - // when the user declares the instance of the app, either from - // a vApp object direct, or an object from a class derived - // from the vApp class. - - theGlobalApp = this; // this is our object - - // now the data members - - _curThis = 0; - _running = 0; // we are running - _WindowList = 0; // no windows registered - _DeleteList = 0; // 1.24a - gotta do it at the very END - _CmdPaneList = 0; // no command panes registered - _clipText = 0; - _inExit = 0; - _simSDI = simSDI; - - _frameWidth = (frameWidth > 0) ? frameWidth + 20 : 0; - _frameHeight = (frameHeight > 0) ? frameHeight + 20 : 0; - - _DefaultHeight = frameHeight; // default sizes for canvas window - _DefaultWidth = frameWidth; - _destroyed = 0; // Not destroyed yet - - _Frame = 0; // Not inited yet. - _Client = 0; // Not inited yet. - - // Set which debug items to show - - DebugState.System = 0; // System debug messages - DebugState.CmdEvents = 0; // Show command events (buttons, etc.) - DebugState.MouseEvents = 0; // Show mouse events - DebugState.WindowEvents = 0; // Window events (resize, etc.) - DebugState.Build = 0; // Define/Build window - DebugState.BadVals= 0; // Error values - DebugState.Misc = 0; // Misc stuff - DebugState.Text = 0; // Text events - DebugState.Constructor = 0; // Show constructors - DebugState.Destructor = 0; // Show destructors - DebugState.User = 0; // Debug user events - DebugState.UserApp1 = 0; // Level 1 User App - DebugState.UserApp2 = 0; // Level 2 User App - DebugState.UserApp3 = 0; - - } - -//========================>>> vApp::initialize <<<======================= - void vApp::initialize(int& argc, char** argv, - HANDLE hInstance, HANDLE hPrevInstance, int nCmdShow) - { - // Main interface to the parent windowing system - - for (int argn = 1 ; argn < argc ; ++argn) // look for vDebug switch - { - if (strcmp(argv[argn],"-vDebug") == 0) - { - // Turn them all off - DebugState.System = 0; // System debug messages - DebugState.CmdEvents = 0; // Show command events (buttons, etc.) - DebugState.MouseEvents = 0; // Show mouse events - DebugState.WindowEvents = 0; // Window events (resize, etc.) - DebugState.Build = 0; // Define/Build window - DebugState.BadVals= 0; // Error values - DebugState.Misc = 0; // Misc stuff - DebugState.Text = 0; // Text events - DebugState.Constructor = 0; // Show constructors - DebugState.Destructor = 0; // Show destructors - DebugState.User = 0; // Debug user events - DebugState.UserApp1 = 0; // Level 1 User App - DebugState.UserApp2 = 0; // Level 2 User App - DebugState.UserApp3 = 0; - - for (char* cp = argv[argn+1] ; *cp ; ++cp) - { - switch (*cp) - { - case 'S': - DebugState.System = 1; // System debug messages - break; - case 'c': - DebugState.CmdEvents = 1; // Show command events (buttons, etc.) - break; - case 'm': - DebugState.MouseEvents = 1; // Show mouse events - break; - case 'w': - DebugState.WindowEvents = 1; // Window events (resize, etc.) - break; - case 'b': - DebugState.Build = 1; // Define/Build window - break; - case 'v': - DebugState.BadVals= 1; // Error values - break; - case 'o': - DebugState.Misc = 1; // (Other) Misc stuff - break; - case 't': - DebugState.Text = 1; // Text events - break; - case 'C': - DebugState.Constructor = 1; // Show constructors - break; - case 'D': - DebugState.Destructor = 1; // Show destructors - break; - case 'U': - DebugState.User = 1; // Debug user events - break; - case '1': - DebugState.UserApp1 = 1; // Level 1 User App - break; - case '2': - DebugState.UserApp2 = 1; // Level 2 User App - break; - case '3': - DebugState.UserApp3 = 1; - break; - } - } - - // Now fixup the argument list and break loop - int ia; - for (ia = argn ; ia < argc ; ++ia) - argv[ia] = argv[ia+2]; - argv[ia] = 0; - argc -= 2; // eat the -vDebug args - break; - } - - } - - // This is pretty much the standard Windows startup code - // required by all Windows applications. - - WNDCLASS wndclass; - - _vHandle = hInstance; - - if (!hPrevInstance) - { - // Register the MDI frame window class - - _appicon = ::LoadIcon((HINSTANCE)hInstance,"vAppIcon"); - if (_appicon == NULL) - _appicon = ::LoadIcon(NULL,IDI_APPLICATION); - _winicon = ::LoadIcon((HINSTANCE)hInstance,"vWindowIcon"); - if (_winicon == NULL) - _winicon = ::LoadIcon(NULL,IDI_APPLICATION); - - wndclass.style = CS_HREDRAW | CS_VREDRAW; - wndclass.lpfnWndProc = (WNDPROC) PMdiFrameProc; - wndclass.cbClsExtra = 0; - wndclass.cbWndExtra = 0; - wndclass.hInstance = (HINSTANCE) hInstance; - wndclass.hIcon = _appicon; - wndclass.hCursor = LoadCursor (NULL, IDC_ARROW); - wndclass.hbrBackground = (HBRUSH)(COLOR_APPWORKSPACE + 1); - wndclass.lpszMenuName = NULL; - wndclass.lpszClassName = szMdiFrameClass; - - RegisterClass(&wndclass); - - // Register the MDI window class - - wndclass.style = CS_HREDRAW | CS_VREDRAW ; - wndclass.lpfnWndProc = (WNDPROC) PMdiWindowProc; - wndclass.cbClsExtra = 0; - wndclass.cbWndExtra = sizeof(void*); - wndclass.hInstance = (HINSTANCE) hInstance; - wndclass.hIcon = _winicon; - wndclass.hCursor = NULL; //LoadCursor (NULL, IDC_ARROW); - wndclass.hbrBackground = static_cast(::GetStockObject(WHITE_BRUSH)); - wndclass.lpszMenuName = NULL; - wndclass.lpszClassName = szMdiWindowClass; - - RegisterClass(&wndclass); - - } - - hFrameMenu = ::CreateMenu(); // A File menu - hFrameSubMenu = ::CreateMenu(); // Its submenu - - // Define a very simple default MDI menu - ::AppendMenu(hFrameSubMenu, MF_STRING, M_WindowsReserved1, "&New"); - ::AppendMenu(hFrameSubMenu, MF_STRING, M_WindowsReserved2, "&Open"); - ::AppendMenu(hFrameSubMenu, MF_SEPARATOR,0,0); - ::AppendMenu(hFrameSubMenu, MF_STRING, M_WindowsReserved3, "E&xit"); - ::AppendMenu(hFrameMenu, MF_POPUP, (UINT)hFrameSubMenu, "&File"); - - hAccel = 0; // No accelerators - _workTimer = 0; - - // Create the frame window - - _Frame = ::CreateWindow(szMdiFrameClass, _name, - WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_MAXIMIZE | - WS_VISIBLE | WS_MAXIMIZEBOX | WS_MINIMIZEBOX, - CW_USEDEFAULT, CW_USEDEFAULT, - // _DefaultWidth,_DefaultHeight, - (_frameWidth == 0) ? CW_USEDEFAULT : _frameWidth, - (_frameHeight == 0) ? CW_USEDEFAULT : _frameHeight, - NULL, hFrameMenu, (HINSTANCE)hInstance, NULL); - - - RECT frameRect; - ::GetWindowRect(_Frame, &frameRect); - //::GetClientRect(_Frame, &frameRect); - if (_DefaultHeight <= 0) - { - _DefaultHeight = frameRect.bottom - frameRect.top - 200; - if (_DefaultHeight < 50) - _DefaultHeight = 50; - } - if (_DefaultWidth <= 0) - { - _DefaultWidth = frameRect.right - frameRect.left - 50; - if (_DefaultWidth < 50) - _DefaultWidth = 50; - } - - _Client = ::GetWindow(_Frame, GW_CHILD); - - // Create some pens and brushes used for drawing custom controls - // and dialogs. - - _WhitePen = ::CreatePen(PS_SOLID,1, RGB(255,255,255)); - _GrayPen = ::CreatePen(PS_SOLID,1, RGB(128,128,128)); - _ShadowPen = ::CreatePen(PS_INSIDEFRAME, 1,::GetSysColor(COLOR_BTNSHADOW)); - if (::GetSysColor(COLOR_BTNHIGHLIGHT) == ::GetSysColor(COLOR_BTNFACE)) - _LightPen = ::CreatePen(PS_INSIDEFRAME, 1,RGB(255,255,255)); - else - _LightPen = ::CreatePen(PS_INSIDEFRAME, 1,::GetSysColor(COLOR_BTNHIGHLIGHT)); - _BarBrush = ::CreateSolidBrush(::GetSysColor(COLOR_BTNFACE)); - - - ::ShowWindow(_Frame, nCmdShow); - - ::UpdateWindow(_Frame); - - _running = 1; - } - -//======================>>> vApp::~vApp <<<======================= - vApp::~vApp() - { - // WARNING! This destructor never gets called automatically, - // at least with Borland C++ 4.5. - SysDebug(Destructor,"vApp::~vApp destructor\n") - - if (_clipText != 0) - delete [] _clipText; - - _destroyed = 1; - - } - -//======================>>> vApp::showAppWin <<<======================= - void vApp::showAppWin(bool show) - { - if (show) - { - ::ShowWindow(_Frame, SW_SHOW); - ::UpdateWindow(_Frame); - } - else - { - ::ShowWindow(_Frame, SW_HIDE); - ::UpdateWindow(_Frame); - } - } - -//======================>>> vApp::Exit <<<======================= - void vApp::Exit(void) - { - // Close All registered windows and exit - - WindList *curWin; - vWindow *tmp; - - if (_inExit) - return; - - SysDebug(Build,"vApp::Exit()\n") - - if (_workTimer) // Stop events first - { - _workTimer->TimerStop(); - delete _workTimer; - _workTimer = 0; - } - - _inExit = 1; // CloseAppWin needs this to not call unregister - - for (curWin = _WindowList ; curWin !=0 ; curWin = _WindowList) - { - int retv; - tmp = curWin->window; - if (IsHelpWin(tmp)) - retv = CloseHelpWin(tmp); - else - retv = CloseAppWin(tmp); // use local or derived close app - if (!retv) - { - _inExit = 0; - return; - } - } - - _inExit = 0; // done now, so can exit - AppExit(0); - } - -//======================>>> vApp::AppExit <<<======================= - void vApp::AppExit(int exitVal) - { - - if (!_inExit) // Only ONE, please! - { - ::PostQuitMessage(exitVal); - } - } - -//========================>>> vApp::CheckEvents <<<======================= - void vApp::CheckEvents() - { - extern int vChkWinDlgMsgs(MSG*); - extern int vChkCmdPaneMsgs(MSG*); - MSG msg; - - // Enter the modified message loop - - while (::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) - { - - if (!vChkWinDlgMsgs(&msg) && // Dialogs and cmd panes handle - !vChkCmdPaneMsgs(&msg) && // their own messages - !::TranslateMDISysAccel(_Client, &msg) && - !::TranslateAccelerator(_Frame, (HACCEL)hAccel, &msg)) // probably don't need? - { - ::TranslateMessage(&msg); - ::DispatchMessage(&msg); - } - } - } - -//==================>>> vApp::CloseLastCmdWindow <<<======================= - void vApp::CloseLastCmdWindow(vWindow* win, int exitcode) - { - // This method, new in 1.21, allows an empty MDI frame for - // Windows. Default behavior is to exit on last close. To - // overide, the derived CloseLastCmdWindow should simply return. - - // delete win; // this causes bug 1.21a - 1/6/99 - addToDeleteList(win); - AppExit(0); - } - -//==================>>> vApp::ClipboardSetText <<<======================= - int vApp::ClipboardSetText(VCONST char* text) VCONST - { - // set the system clipboard to the value in text - - int retval = 1; - int lines = 0; // how many lines in text - - for (VCONST char *tp = text ; *tp ; ++tp) - if (*tp == '\n') - ++lines; // count up lines - - char* temp = new char[strlen(text)+lines+4]; // space for txt - char* to = temp; - VCONST char *from = text; - while (*from) - { - if (*from != '\r') // all except CRs - { - if (*from == '\n') // force all cr/lf or lf to cr/lf - *to++ = '\r'; - *to++ = *from; - } - ++from; - } - *to = 0; // terminate - int len = strlen(temp); // how long string really is - - // Now, copy to system clipboard - HGLOBAL hMem = ::GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, len + 1); - if (hMem != 0) - { - char* strMem = (char*)::GlobalLock(hMem); - strcpy(strMem, temp); // copy our string - if (::OpenClipboard(0)) - { - if (::EmptyClipboard()) - { - ::SetClipboardData(CF_TEXT, hMem); - } - ::CloseClipboard(); - } - else - retval = 0; - ::GlobalUnlock(hMem); // Unlock memory, sys frees it - } - else - retval = 0; - - delete [] temp; - return retval; - } - -//====================>>> vApp::ClipboardGetText <<<===================== - char* vApp::ClipboardGetText() VCONST - { - // return a pointer to the clipboard text - we will allocate - // space for it as needed - - if (!::IsClipboardFormatAvailable(CF_TEXT)) - return 0; - if (!::OpenClipboard(0)) - return 0; - if (_clipText != 0) // had some previous data - delete [] _clipText; - _clipText = 0; // make 0 for default return - - HGLOBAL hMem = ::GetClipboardData(CF_TEXT); - if (hMem != NULL) // Got some text data - { - char* str = (char*) hMem; - _clipText = new char[strlen(str)+1]; - strcpy(_clipText, str); - } - ::CloseClipboard(); - return _clipText; - } - -//====================>>> vApp::ClipboardCheckText <<<=================== - int vApp::ClipboardCheckText() VCONST - { - // check if text available on system clipboard - return ::IsClipboardFormatAvailable(CF_TEXT); - } - -//====================>>> vApp::ClipboardClear <<<======================== - void vApp::ClipboardClear() VCONST - { - // Clear out the clipboard - ::EmptyClipboard(); - } - -//========================>>> vApp::CloseAppWin <<<======================= - int vApp::CloseAppWin(vWindow* win) - { - - SysDebug(Build,"vApp::CloseAppWin()\n"); - - win->CloseWin(); // let the window close itself - - unregisterWindow(win); // take it off the list - addToDeleteList(win); - return 1; - } - -//========================>>> vApp::CloseHelpWin <<<======================= - int vApp::CloseHelpWin(vWindow* win) - { - - SysDebug(Build,"vApp::CloseHelpWin()\n"); - - win->CloseWin(); // let the window close itself - unregisterWindow(win); // take it off the list - addToDeleteList(win); - return 1; - } - -//========================>>> vApp::IsHelpWin <<<======================= - int vApp::IsHelpWin(vWindow *Win) - { - WindList *curWin; - - for (curWin = _WindowList ; curWin !=0 ; curWin = curWin->nextWinList) - { - if (curWin->window == Win) - { - return (curWin->info == 0); // Help if 0 - } - } - return 0; - } - -//===========================>>> vApp::AppCommand <<<========================= - void vApp::AppCommand(vWindow* win, ItemVal id, ItemVal retval, CmdType ctype) - { - // Do nothing by default. - - SysDebug1(CmdEvents,"vApp::AppCmd(id: %d)\n",id); - if (id == M_Exit) - Exit(); - } - -//========================>>> vApp::GetDefaultFont <<<======================= - vFont vApp::GetDefaultFont() - { - vFont sysF(vfDefaultSystem); // construct a system font instance - return sysF; // return it - } - -//========================>>> vApp::getAppWinInfo <<<======================= - vAppWinInfo* vApp::getAppWinInfo(vWindow *Win) - { - // Search list to find associated vAppWinInfo. - - WindList *curWin; - - for (curWin = _WindowList ; curWin !=0 ; curWin = curWin->nextWinList) - { - if (curWin->window == Win) - { - return curWin->info; // return assocated info ptr - } - } - return 0; - } - -//===========================>>> vApp::KeyIn <<<=========================== - void vApp::KeyIn(vWindow* win, vKey key, unsigned int shift) - { - // Do nothing by default. - SysDebug(Misc,"vApp::KeyIn\n"); - } - -//========================>>> vApp::NewAppWin <<<======================= - vWindow* vApp::NewAppWin(vWindow* win, VCONST char* name, int w, int h, - vAppWinInfo* winInfo) - { - // The derived vApp needs to call this. - - vWindow* thisWin = win; - vAppWinInfo* awinfo = winInfo; - - SysDebug1(Build,"vApp::NewAppWin(%s)\n",name); - - if (!thisWin) // Not created - thisWin = new vCmdWindow(name, w, h); - - if (!winInfo) - awinfo = new vAppWinInfo(name); - - registerWindow(thisWin, awinfo); // register this window - return thisWin; - } - -//========================>>> vApp::NewHelpWin <<<======================= - vWindow* vApp::NewHelpWin(vWindow* win, VCONST char* name, int w, int h) - { - vWindow* thisWin = win; - - SysDebug1(Build,"vApp::NewHelpWin(%s)\n",name); - - if (!thisWin) // Not created - return 0; - registerWindow(thisWin, 0); // register this window - return thisWin; - } - -//========================>>> vApp::addToDeleteList <<<======================= - void vApp::addToDeleteList(vWindow *Win) - { - - WindList *chkWin; - for (chkWin = _DeleteList ; chkWin !=0 ; chkWin = chkWin->nextWinList) - { - if (chkWin->window == Win) - return; // don't add twice (1.24b - 3/31/00) - } - - WindList* newList = new WindList; // new cell to add to list - - newList->window = Win; // remember the window - newList->info = 0; // and its info class - - newList->nextWinList = _DeleteList; // link in at front - _DeleteList = newList; - } - -//========================>>> vApp::registerWindow <<<======================= - void vApp::registerWindow(vWindow *Win, vAppWinInfo *awinfo) - { - WindList* newList = new WindList; // new cell to add to list - - SysDebug1(Misc,"vApp::registerWindow - %s\n",Win->name()) - - newList->window = Win; // remember the window - newList->info = awinfo; // and its info class - - newList->nextWinList = _WindowList; // link in at front - _WindowList = newList; - } - -//========================>>> vApp::unregisterWindow <<<======================= - void vApp::unregisterWindow(vWindow *Win) - { - // Scan window list to unregister this window and free some space - - WindList *curWin, *tmp, *last, *next; - - last = 0; - - for (curWin = _WindowList ; curWin !=0 ; curWin = next) - { - next = curWin->nextWinList; - if (curWin->window == Win) - { - SysDebug1(Misc,"vApp::unregisterWindow - %s\n",Win->name()) - - tmp = curWin; - - if (curWin == _WindowList) - _WindowList = curWin->nextWinList; - else - last->nextWinList = curWin->nextWinList; - - delete curWin->info; // free the info space - delete tmp; // free the list space - } - last = curWin; - } - } - -//========================>>> vApp::registerCmdPane <<<====================== - void vApp::registerCmdPane(vCommandPane* cmdPane) - { - CmdPaneList* newList = new CmdPaneList; // new cell to add to list - - SysDebug(Misc,"vApp::registerCmdPane\n") - - newList->commandPane = cmdPane; // remember the cmd pane - - newList->nextCPList = _CmdPaneList; // link in at front - _CmdPaneList = newList; - } - -//========================>>> vApp::unregisterCmdPane <<<======================= - void vApp::unregisterCmdPane(vCommandPane* cmdPane) - { - // Scan pane list to unregister this window and free some space - CmdPaneList *curCP, *tmp, *last, *next; - - last = 0; - - for (curCP = _CmdPaneList ; curCP !=0 ; curCP = next) - { - next = curCP->nextCPList; - if (curCP->commandPane == cmdPane) - { - - SysDebug(Misc,"vApp::unregisterCmdPane\n") - - tmp = curCP; - - if (curCP == _CmdPaneList) - _CmdPaneList = curCP->nextCPList; - else - last->nextCPList = curCP->nextCPList; - - delete tmp; // free the list space - } - last = curCP; - } - } - -//========================>>> vApp::selectCmdPanes <<<======================= - void vApp::selectCmdPanes(vWindow* parent) - { - // This is needed by the MDI interface conventions. - - // This will turn off _isShown for panes that are children of other windows - // and turn onn all cmd panes that are in our window - CmdPaneList *curCP; - - // First, turn off all command panes in other windows - - for (curCP = _CmdPaneList ; curCP !=0 ; curCP = curCP->nextCPList) - { - if ((curCP->commandPane)->_parentWin != parent) - { - (curCP->commandPane)->_isShown = 0; - if (::IsWindow((curCP->commandPane)->_wDialog) && - ::IsWindowVisible((curCP->commandPane)->_wDialog)) - ::ShowWindow((curCP->commandPane)->_wDialog, SW_HIDE); - } - } - - // Now, turn ours on - for (curCP = _CmdPaneList ; curCP !=0 ; curCP = curCP->nextCPList) - { - if ((curCP->commandPane)->_parentWin == parent) - { - (curCP->commandPane)->_isShown = 1; - if (::IsWindow((curCP->commandPane)->_wDialog) && - !::IsWindowVisible((curCP->commandPane)->_wDialog)) - ::ShowWindow((curCP->commandPane)->_wDialog, SW_SHOW); - } - } - } - -//========================>>> vApp::SendWindowCommandAll <<<======================= - void vApp::SendWindowCommandAll(ItemVal id, int val, CmdType ctype) - { - // send a command to all windows - for (WindList* curWin = _WindowList ; curWin !=0 ; curWin = curWin->nextWinList) - { - (curWin->window)->WindowCommand(id, val, ctype); - } - } - -//========================>>> vApp::UpdateAllViews <<<======================= - void vApp::UpdateAllViews(vWindow* sender, int hint, void* pHint) - { - // Easy way to do MVC - call UpdateView in all windows - // This function is called by the user whenever a change is made to - // the model e.g the document. This causes vWindow::UpdateView to be - // called for every open window. The parameters are used to both filter and - // hint the windows on which actions to take in vWindow::UpdateView: - // - // sender: If this is not zero, this window will not invoke UpdateView, - // because typically the change of model was a result of - // an interaction with this window. - // hint: This should be an enum defined in your derived app class. - // Hints about which kind of change is made, so that only - // appropriate action is taken on appropriate windows. - // pHint: This is normally a pointer to the object representing the - // document - - for (WindList* curWin = _WindowList ; curWin !=0 ; curWin = curWin->nextWinList) - { - if (curWin->window != sender) - (curWin->window)->UpdateView(sender, hint, pHint); - } - } - -//========================>>> vApp::SetValueAll <<<======================= - void vApp::SetValueAll(ItemVal id, int val, ItemSetType setType) - { - // Set a Value in all windows - for (WindList* curWin = _WindowList ; curWin !=0 ; curWin = curWin->nextWinList) - { - (curWin->window)->SetValue(id, val, setType); - } - } - -//======================>>> vApp::SetAppTitle <<<========================== - void vApp::SetAppTitle(VCONST char* title) - { - // set the title in the title bar -- this is a no-op on some platforms - - ::SetWindowText(_Frame, title); - - } - -//========================>>> vApp::SetStringAll <<<======================= - void vApp::SetStringAll(ItemVal id, VCONST char* str) - { - // Set a string in all windows - for (WindList* curWin = _WindowList ; curWin !=0 ; curWin = curWin->nextWinList) - { - (curWin->window)->SetString(id, str); - } - } - -//========================>>> vApp::ShowList <<<======================= - int vApp::ShowList(void) - { - // This is a utility routine to show current information -#ifdef HAS_PRINTF - fprintf(stderr,"Registered windows:\n"); - for (WindList* curWin = _WindowList ; curWin !=0 ; curWin = curWin->nextWinList) - { - fprintf(stderr," %s\n",(curWin->window)->name()); - } -#endif - return 1; - } - -//====================>>> _appWorkTimer::TimerTick <<<==================== - void _appWorkTimer::TimerTick() - { - - theApp->DispatchWork(); - } - -//========================>>> vApp::EnableWorkSlice <<<==================== - int vApp::EnableWorkSlice(long slice) - { - - if (slice > 0) - { - if (_workTimer == 0) // First time to start timer - { - _workTimer = new _appWorkTimer; - } - return _workTimer->TimerSet(slice); - } - else - { - if (_workTimer) - { - _workTimer->TimerStop(); - delete _workTimer; - _workTimer = 0; - } - } - return 1; - } - -//========================>>> vApp::DispatchWork <<<======================= - void vApp::DispatchWork(void) - { - - WorkSlice(); // Work Slice for App - // Call WorkSlice for all windows - for (WindList* curWin = _WindowList ; curWin !=0 ; - curWin = curWin->nextWinList) - { - (curWin->window)->WorkSlice(); - } - } - -//========================>>> vApp::doEventLoop <<<======================= - int vApp::doEventLoop(void) - { - // This is where we grab and handle events from the - // parent windowing system - extern int vChkWinDlgMsgs(MSG*); - extern int vChkCmdPaneMsgs(MSG*); - MSG msg; - - // Enter the modified message loop - - while (::GetMessage(&msg, NULL, 0, 0)) - { - - if (!vChkWinDlgMsgs(&msg) && // Dialogs and cmd panes handle - !vChkCmdPaneMsgs(&msg) && // their own messages - !::TranslateMDISysAccel(_Client, &msg) && - !::TranslateAccelerator(_Frame, (HACCEL)hAccel, &msg)) // probably don't need? - { - ::TranslateMessage(&msg); - ::DispatchMessage(&msg); - } - } - - // The "Honor System" that Windows requires of returning every tiny - // resource you use really sucks. It took hours to figure out this - // way of freeing resources. Turns out that the destructor for the static - // vApp object never gets called once PostQuitMessage is called. We do come - // through here, however, so here is where we can return these - // resources. A reasonable operating system recovers system - // resources used by a process when it terminates. Not Windows... - - if (_workTimer) - { - _workTimer->TimerStop(); - delete _workTimer; - } - - - // ugly, but finally delete all the window objects we had - - WindList *curWin, *next; - for (curWin = _DeleteList ; curWin !=0 ; curWin = next) - { - next = curWin->nextWinList; - delete curWin->window; // delete the object - delete curWin; // and this space - } - - ::DestroyIcon(_appicon); - ::DestroyIcon(_winicon); - - ::DeleteObject(_WhitePen); - ::DeleteObject(_GrayPen); - ::DeleteObject(_LightPen); - ::DeleteObject(_ShadowPen); - ::DeleteObject(_BarBrush); - - ::DestroyMenu(hFrameSubMenu); - ::DestroyMenu(hFrameMenu); - - ::DestroyWindow(_Client); - ::DestroyWindow(_Frame); - - return msg.wParam; - } - -//======================>>> PMdiFrameProc <<<================================ - long FAR PASCAL PMdiFrameProc(HWND hwnd, UINT message, - UINT wParam, LPARAM lParam) - { - return theApp->MdiFrameProc(hwnd, message, wParam, lParam); - } - -// Following are routines to handle Windows messages - -//======================>>> vApp::OnCreate <<<============================ - int vApp::OnCreate(HWND hwnd, CREATESTRUCT FAR* lpCreateStruct) - { - - CLIENTCREATESTRUCT clientcreate; - - clientcreate.hWindowMenu = hFrameSubMenu; - clientcreate.idFirstChild = M_FIRSTCHILD; - - if (_simSDI) - { - _Client = ::CreateWindow("MDICLIENT", NULL, - WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | WS_CLIPSIBLINGS | - WS_HSCROLL | WS_VSCROLL | MDIS_ALLCHILDSTYLES, - 0, 0, 0, 0, hwnd, NULL, (HINSTANCE)_vHandle, - (LPSTR) &clientcreate); - } - else - { - _Client = ::CreateWindow("MDICLIENT", NULL, - WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | WS_CLIPSIBLINGS | - WS_HSCROLL | WS_VSCROLL, - 0, 0, 0, 0, hwnd, NULL, (HINSTANCE)_vHandle, - (LPSTR) &clientcreate); - } - - ::DragAcceptFiles(hwnd,TRUE); // we will accept DnD - - return _Client != NULL; - } - -//======================>>> vApp::OnDnD <<<============================ - void vApp::DropFile(const char* fn) - { - // do nothing by default - } - -//======================>>> vApp::OnDnD <<<============================ - void vApp::OnDnD(HWND hWnd, HDROP WParam) - { - // called for dnd - // 1. get handle to struct in SHELL.DLL. Get info on the - // files from there. - int TotalNumberOfFiles; - POINT pPoint; - BOOL inClientArea; - int ix; - char fn[maxFileNameSize+1]; - - // get handle to struct with dropped file info - HDROP Handle = WParam; - // get totan number of dropped files - -1 for index param - TotalNumberOfFiles = ::DragQueryFile( Handle , 0xFFFFFFFF, NULL, 0 ); - - for (ix = 0 ; ix < TotalNumberOfFiles ; ++ix) - { - ::DragQueryFile(Handle, ix, fn, maxFileNameSize); // fetch the file name - - // get where it was dropped - inClientArea = ::DragQueryPoint(Handle, &pPoint); - - // for now, we will just implement a drop to the app. - // evenutally we should get which window got the drop, - // and pass it to that window. But for VIDE purposes, - // this is enough for now. - DropFile(fn); // drop just to app, no points - } - - ::DragFinish(Handle); - return; - } - -//======================>>> vApp::OnClose <<<============================ - void vApp::OnClose(HWND hwnd) - { - ::DragAcceptFiles(hwnd,FALSE); - Exit(); - } - -//======================>>> vApp::OnQueryEndSession <<<============================ - int vApp::OnQueryEndSession(HWND hwnd) - { - return 1; - } - -//======================>>> vApp::OnDestroy <<<============================ - void vApp::OnDestroy(HWND hwnd) - { - - } - -//======================>>> vApp::OnSysCommand <<<======================== - void vApp::OnSysCommand(HWND hwnd, UINT cmd, int x, int y) - { - // Set focus to frame window. This causes any comboboxes - // in dialogs to be closed. - ::SetFocus(_Frame); - FORWARD_WM_SYSCOMMAND(hwnd, cmd, x, y, Frame_DefProc); - } - -//======================>>> vApp::OnSize <<<======================== - void vApp::OnSize(HWND hwnd, UINT state, int cx, int cy) - { - // Force MDI Child window to be resized. - FORWARD_vWM_ResizeMDIClient(hwnd, SendMessage); - } - -//======================>>> vApp::OnCommand <<<======================== - void vApp::OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) - { - switch (id) - { - case M_WindowsReserved1: - AppCommand((vWindow*)0,(ItemVal) M_New, (ItemVal)0, (CmdType)0); - return; - case M_WindowsReserved2: - AppCommand((vWindow*)0,(ItemVal) M_Open, (ItemVal)0, (CmdType)0); - return; - case M_WindowsReserved3: - AppCommand((vWindow*)0,(ItemVal) M_Exit, (ItemVal)0, (CmdType)0); - return; - - // Messages for arranging child MDI windows - case M_Tile: - (void)FORWARD_WM_MDITILE(_Client, WM_MDITILE, SendMessage); - return; - - case M_Cascade: - (void)FORWARD_WM_MDICASCADE(_Client,0,SendMessage); - return; - - case M_Arrange: - (void)FORWARD_WM_MDIICONARRANGE(_Client, SendMessage); - return; - - default: // Pass to active child - - HWND hwndChild = (HWND)::SendMessage(_Client, - WM_MDIGETACTIVE, 0, 0L); - - if (::IsWindow(hwndChild) && id < M_FIRSTCHILD) - { - FORWARD_WM_COMMAND(hwndChild, id, hwndCtl, codeNotify, - SendMessage); - //return; - } - } - FORWARD_WM_COMMAND(hwnd, id, hwndCtl, codeNotify, Frame_DefProc); - } - -//======================>>> vApp::Frame_DefProc <<<======================== - LRESULT vApp::Frame_DefProc (HWND hwnd, UINT uMsg, - WPARAM wParam, LPARAM lParam) - { - return ::DefFrameProc(hwnd, _Client, uMsg, wParam, lParam); - } - -//======================>>> vApp::OnResizeMDIClient <<<============================ - void vApp::OnResizeMDIClient(HWND hwnd) - { - // This is called whenever the Frame is resized, or when the state of - // a status bar or command pane changes. - RECT rc; - - vCommandPane* cp; - CmdPaneList *curCPL; - - if (!::IsWindow(_Client)) - return; - - if (!_Frame) - return; - - ::GetClientRect(_Frame, &rc); // the rect of the Frame - - int topY = 0; // Need to track space used by - int botY = rc.bottom; // cmd bars and status bars - - // Scan the cmdpane list to reposition all cmd bars and status bars - - for (curCPL = _CmdPaneList ; curCPL != 0 ; curCPL = curCPL->nextCPList) - { - cp = curCPL->commandPane; - if (cp->_isShown && cp->_isDisplayed && - ::IsWindow(cp->HwndDialog()) && ::IsWindowVisible(cp->HwndDialog())) - { - if (cp->paneType() != P_Status) // Cmd bar - { - ::MoveWindow(cp->HwndDialog(), 0,topY,rc.right, - cp->_windowH + topY,1); - topY += cp->_windowH; - cp->_windowY = topY; - } // Status bar - else - { - botY -= cp->_windowH; - ::MoveWindow(cp->HwndDialog(), 0, botY,rc.right, - cp->_windowH + botY,1); - cp->_windowY = botY; - } - } - } - - ::MoveWindow(_Client, 0, topY, rc.right, botY - topY , 1); - } - -//======================>>> vApp::MdiFrameProc <<<============================ - long vApp::MdiFrameProc(HWND hwnd, UINT uMsg, UINT wParam, LPARAM lParam) - { - switch (uMsg) - { - HANDLE_MSG(hwnd, WM_CREATE, OnCreate); - HANDLE_MSG(hwnd, WM_DROPFILES, OnDnD); - HANDLE_MSG(hwnd, WM_CLOSE, OnClose); - HANDLE_MSG(hwnd, WM_QUERYENDSESSION, OnQueryEndSession); - HANDLE_MSG(hwnd, WM_DESTROY, OnDestroy); - HANDLE_MSG(hwnd, WM_SYSCOMMAND, OnSysCommand); - HANDLE_MSG(hwnd, WM_SIZE, OnSize); - HANDLE_MSG(hwnd, WM_COMMAND, OnCommand); - HANDLE_MSG(hwnd, vWM_ResizeMDIClient, OnResizeMDIClient); - } - return(::DefFrameProc(hwnd, _Client, uMsg, wParam, lParam)); - } - -//======================>>> PMdiWindowProc <<<================================ - long FAR PASCAL PMdiWindowProc(HWND hwnd, UINT message, - WPARAM wParam, LPARAM lParam) - { - // Kludgy stuff to get things rolling. Part of hhis code is needed to - // get the first mouse click to activate the window, but not - // send a mousedown message. Windows can be UGLY... - - static vWindow* createThis = 0; - vWindow* thisWin = (vWindow*)::GetWindowLong(hwnd, 0); - - if (!thisWin && message == WM_CREATE) - { - // We need to intercept the message here to recover the vWindow - // this of the window. It is sent in the lParam of the CREATESTRUCT. - CREATESTRUCT* cs = (CREATESTRUCT*)lParam; // fetch the ptr - // now convert to MDICREATESTRUCT - MDICREATESTRUCT* mdics = (MDICREATESTRUCT*)cs->lpCreateParams; - - createThis = thisWin = (vWindow*)mdics->lParam; // remember the this! - } - else if (createThis != 0 && message == WM_MDIACTIVATE) - { - thisWin = createThis; - createThis = 0; - } - - if (!thisWin) - { - - return ::DefMDIChildProc(hwnd, message, wParam, lParam); - } - else - return thisWin->MdiWindowProc(hwnd, message, wParam, lParam); - } - - -//######################################################################### - -// The user function AppMain is accessed through a pointer. This function -// stores the user's AppMain in a pointr to function that is used inside -// the V library. This was added to enable V Win32 DLL. It works also -// with a static library. -// -V_EXPORT void vRegisterAppMain( int (*p)(int, char**) ) -{ - pAppMain = p; -} - -// Actually we should return vApp*, but VC++ complains that it -// can't find vGetApp when linking the application. -// -DWORD vGetApp() -{ - return (DWORD) theGlobalApp; -} - -//======================>>> CMain <<<====================================== - int CMain(HANDLE hInstance, HANDLE hPrevInstance, - LPSTR lpszCmdLine, int nCmdShow) - { - // CMain is a C++ style wrapper -- makes the "friend" declaration nicer - int argc = 0; - char** argv = new char*[50]; // up to 50 args - char name[200]; - - int retcode; - - // Split command line into tokens, as in usual main(argc, argv) - - int cmdLen = strlen((char *)lpszCmdLine); - char *buf = new char[cmdLen + 1]; - - strcpy(buf, (char*) lpszCmdLine); // make copy - - // Get application name - - InitCommonControls(); // for tooltips - - ::GetModuleFileName((HINSTANCE)hInstance, name, 199); - - argv[argc++] = name; - - // Now split argument string - - { - char *token; - const char *IFS = " \t\r\n"; - if ((token = strtok(buf, IFS)) != NULL) - { - do - { - if (*token != '\0' && strchr(IFS, *token) == NULL) - argv[argc++] = token; - } while ((token = strtok(NULL, IFS)) != NULL); - } - } - - argv[argc] = NULL; // argv[] is NULL terminated list! - - theApp->initialize(argc,argv, - hInstance, hPrevInstance, nCmdShow); // Create top level widget - - if ((retcode = pAppMain(argc,argv)) != 0) // call the app main program - return (retcode); - - return theApp->doEventLoop(); // And enter the event loop - } - -//######################################################################### -// Utilities -//=========================>>> vSysWarning <<<============================ - void vSysWarning(VCONST char* msg) - { - ::MessageBox(0, msg, "V", MB_ICONEXCLAMATION | MB_OK); - } - -//=========================>>> vSys <<<============================ - void vSysError(VCONST char* msg) - { - ::MessageBox(0, msg,"V", MB_ICONEXCLAMATION | MB_OK); - theApp->AppExit(99); - } - -//#########################################################################t diff --git a/v/srcwin/vawinfo.cpp b/v/srcwin/vawinfo.cpp deleted file mode 100644 index 7c1fea8..0000000 --- a/v/srcwin/vawinfo.cpp +++ /dev/null @@ -1,31 +0,0 @@ -//=============================================================== -// vawinfo.cxx - vAppWinInfo utility class for tracking windows -// -// Copyright (C) 1995.1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include -#include - -//=======================>>> vAppWinInfo::vAppWinInfo <<<=================== - vAppWinInfo::vAppWinInfo(VCONST char* name, VCONST void* ptr) - { - SysDebug1(Constructor,"vAppWinInfo::vAppWinInfo(%s) - constructor\n",name); - - _infoName = new char[strlen(name)+1]; - strcpy(_infoName, name); - _ptr = ptr; - } - -//=======================>>> vAppWinInfo::~vAppWinInfo <<<=================== - vAppWinInfo::~vAppWinInfo() - { - SysDebug(Destructor,"vAppWinInfo::~vAppWinInfo() - desstructor\n"); - delete [] _infoName; - } diff --git a/v/srcwin/vbaseitm.cpp b/v/srcwin/vbaseitm.cpp deleted file mode 100644 index 5789ef1..0000000 --- a/v/srcwin/vbaseitm.cpp +++ /dev/null @@ -1,54 +0,0 @@ -//=============================================================== -// vbaseitm.cpp - the base class that holds handle information - Windows -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include // my defines -#include - -//=====================>>> vBaseItem::vBaseItem <<<==================== - vBaseItem::vBaseItem(VCONST char* name) // constructor - { - SysDebug1(Constructor,"\nvBaseItem::vBaseItem(%s) constructor\n",name) - - _vHandle = NULL; // No widget yet - _name = new char[strlen(name)+1]; // build a copy - strcpy(_name,name); - _copied = 0; // not copied - } - -//=====================>>> vBaseItem::vBaseItem <<<==================== - vBaseItem::vBaseItem(const vBaseItem& b) // Copy constructor - { - SysDebug(Constructor,"\nvBaseItem::vBaseItem(const vBaseItem) Copy constructor\n") - - _name = b._name; // name of item - _vHandle = b._vHandle; // Windows HANDLE - _copied = 1; // This instance IS a copy - - } - -//=====================>>> vBaseItem::~vBaseItem <<<==================== - vBaseItem::~vBaseItem() // destructor - { - - if (_copied) // don't destruct if a copy - { - SysDebug1(Destructor,"vBaseItem::~vBaseItem: NOT destroying copy %s\n\n",_name) - return; - } - SysDebug1(Destructor,"vBaseItem::~vBaseItem: destroying %s\n\n",_name) - - if (_vHandle) - { - _vHandle = NULL; - } - delete [] _name; // free this space - } diff --git a/v/srcwin/vbasewin.cpp b/v/srcwin/vbasewin.cpp deleted file mode 100644 index eccf93b..0000000 --- a/v/srcwin/vbasewin.cpp +++ /dev/null @@ -1,47 +0,0 @@ -//=============================================================== -// vbasewin.cxx - vBaseWindow class functions - X11R5 -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include // our header - -//======================>>> vBaseWindow::vBaseWindow <<<======================= - vBaseWindow::vBaseWindow(VCONST char *name) : - vBaseItem(name) - { - - SysDebug1(Constructor,"vBaseWindow::vBaseWindow(%s) constructor\n", name) - - _myHwnd = 0; // null the main window - } - -//======================>>> vBaseWindow::vBaseWindow <<<======================= - vBaseWindow::vBaseWindow(const vBaseWindow& w) : - vBaseItem(w) - { - vSysError("vBaseWindow: V Semantics do not allow copy constructors."); - } - -//====================>>> vBaseWindow::~vBaseWindow <<<======================= - vBaseWindow::~vBaseWindow(void) - { - - SysDebug(Destructor,"vBaseWindow::~vBaseWindow destructor\n") - - } - -//======================>>> vWindow::closeBaseWindow <<<======================= - void vBaseWindow::closeBaseWindow(void) - { - if (_vHandle != 0) - { - _vHandle = 0; // and mark our handle null - } - } diff --git a/v/srcwin/vbglcnv.cpp b/v/srcwin/vbglcnv.cpp deleted file mode 100644 index aa20445..0000000 --- a/v/srcwin/vbglcnv.cpp +++ /dev/null @@ -1,260 +0,0 @@ -//=============================================================== -// vbaseGLCanvas - a basic GL window canvas for drawing -// -// Copyright (C) 1995-1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include -#include // our header - -#include -#include - -#include - -// OpenGL init - int vBaseGLCanvasPane::_pixelFormat = 0; - int vBaseGLCanvasPane::_doubleBuffer = 0; // if we have double buffering - unsigned int vBaseGLCanvasPane::_vGLmode = 0; - -//================>>> vBaseGLCanvasPane::vBaseGLCanvasPane <<<======================== - vBaseGLCanvasPane::vBaseGLCanvasPane(unsigned int vGLmode, - PaneType pt) : vCanvasPane(pt) - { - SysDebug(Constructor,"vBaseGLCanvasPane::vBaseGLCanvasPane() constructor\n") - - const unsigned int defGLmode = (vGL_RGB | vGL_DoubleBuffer | vGL_Depth); - - _vGLmode = ((vGLmode == vGL_Default) ? defGLmode : vGLmode); - _hDC = 0; - _hGLRC = 0; - _hPalette = 0; - - } - -//================>>> vBaseGLCanvasPane::~vBaseGLCanvasPane <<<=================== - vBaseGLCanvasPane::~vBaseGLCanvasPane() - { - SysDebug(Destructor,"vBaseGLCanvasPane::~vBaseGLCanvasPane() destructor\n") - // OpenGL: finish OpenGL rendering - - if (_hDC) - ::ReleaseDC(theApp->winHwnd(),_hDC); - if (_hGLRC) - { - wglMakeCurrent(NULL, NULL); - wglDeleteContext(_hGLRC); - } - if (_hPalette) - { - DeleteObject(_hPalette); - } - } - -//==================>>> vBaseGLCanvasPane::initialize <<<========================== - void vBaseGLCanvasPane::initialize(vWindow* pWindow, HWND pWidget) - { - vCanvasPane::initialize(pWindow, pWidget); // init std canvas - // the initialize will call CreateDC, which we override to - // create the DC we need for OpenGL - - if (!_hDC) - { - // Create the GL DC for it to use. - // Initialize OpenGL rendering - - _hDC = ::GetDC(_drawWindow); - - // Set up the rendering pixel format - _setUpPixelFormat(); - // Set up Palette - _setUpPalette(); - _hGLRC = wglCreateContext(_hDC); - } - - // initialize graphic - graphicsInit(); - } - -#ifdef USECREATEDC -//==================>>> vBaseGLCanvasPane::CreateDC <<<======================== - void vBaseGLCanvasPane::CreateDC(void) - { - // This overrides the CreateDC of vCanvasPane and creates - // an OpenGL compatible DC, and then sets up the rendering stuff - - vCanvasPane::CreateDC(); // we can have both regular DC - // and a OpenGL DC. - } -#endif - -//==================>>> vBaseGLCanvasPane::_setUpPixelFormat <<<========================== - void vBaseGLCanvasPane::_setUpPixelFormat() - { - // default pfd values - PIXELFORMATDESCRIPTOR pfd = { - sizeof(PIXELFORMATDESCRIPTOR), /* size */ - 1, /* version */ - PFD_SUPPORT_OPENGL | - PFD_DRAW_TO_WINDOW | - PFD_DOUBLEBUFFER, /* support double-buffering */ - PFD_TYPE_RGBA, /* color type */ - 16, /* prefered color depth */ - 0, 0, 0, 0, 0, 0, /* color bits (ignored) */ - 0, /* no alpha buffer */ - 0, /* alpha bits (ignored) */ - 0, /* no accumulation buffer */ - 0, 0, 0, 0, /* accum bits (ignored) */ - 24, /* depth buffer */ - 0, /* no stencil buffer */ - 0, /* no auxiliary buffers */ - PFD_MAIN_PLANE, /* main layer */ - 0, /* reserved */ - 0, 0, 0, /* no layer, visible, damage masks */ - }; - - _doubleBuffer = 1; - - // prepare the mode - if (_vGLmode & vGL_Indexed) // Indexed mode ********************* - { - pfd.iPixelType = PFD_TYPE_COLORINDEX; - - _pixelFormat = ChoosePixelFormat(_hDC, &pfd); - - // try without double buffer - if (_pixelFormat == 0 && (_vGLmode & vGL_DoubleBuffer)) - { - pfd.dwFlags = PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW; - _pixelFormat = ChoosePixelFormat(_hDC, &pfd); - _doubleBuffer = 0; - } - } - else // RGBA mode ******************** - { - _pixelFormat = ChoosePixelFormat(_hDC, &pfd); - UserDebug(WindowEvents,"vBaseGLCanvasPane::_setUpPixelFormat: OpenGL starts in RGB, Double buffering and Depth mode"); - - // try to get rid of this (i.e. try without double buffer) - // As Alpha mode is not independant on Win32 platform - // if vGL_Alpha is set, it is considered as vGL_RGB - if ( (_pixelFormat == 0) && (_vGLmode & vGL_RGB)) - { - UserDebug(WindowEvents,"without Double buffering"); - - pfd.dwFlags = PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW; - _pixelFormat = ChoosePixelFormat(_hDC, &pfd); - _doubleBuffer = 0; - } - else - UserDebug(WindowEvents,"with Double buffering"); - } - - if (_pixelFormat == 0) - { - ::MessageBox(WindowFromDC(_hDC), "ChoosePixelFormat failed.", "Error", - MB_ICONERROR | MB_OK); - exit(1); - } - - if (SetPixelFormat(_hDC, _pixelFormat, &pfd) != TRUE) - { - ::MessageBox(WindowFromDC(_hDC), "SetPixelFormat failed.", "Error", - MB_ICONERROR | MB_OK); - exit(1); - } - - UserDebug(WindowEvents,"\n"); - } - -//==================>>> vBaseGLCanvasPane::_setUpPalette <<<========================== - void vBaseGLCanvasPane::_setUpPalette() - { - // int pixelFormat = GetPixelFormat(_hDC); - PIXELFORMATDESCRIPTOR pfd; - LOGPALETTE* pPal; - int paletteSize; - - DescribePixelFormat(_hDC, _pixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd); - - if (pfd.dwFlags & PFD_NEED_PALETTE) - { - paletteSize = 1 << pfd.cColorBits; - } - else - { - return; - } - - pPal = (LOGPALETTE*) - malloc(sizeof(LOGPALETTE) + paletteSize * sizeof(PALETTEENTRY)); - pPal->palVersion = 0x300; - pPal->palNumEntries = paletteSize; - - /* build a simple RGB color palette */ - { - int redMask = (1 << pfd.cRedBits) - 1; - int greenMask = (1 << pfd.cGreenBits) - 1; - int blueMask = (1 << pfd.cBlueBits) - 1; - int i; - - for (i=0; ipalPalEntry[i].peRed = - (((i >> pfd.cRedShift) & redMask) * 255) / redMask; - pPal->palPalEntry[i].peGreen = - (((i >> pfd.cGreenShift) & greenMask) * 255) / greenMask; - pPal->palPalEntry[i].peBlue = - (((i >> pfd.cBlueShift) & blueMask) * 255) / blueMask; - pPal->palPalEntry[i].peFlags = 0; - } - } - - _hPalette = CreatePalette(pPal); - free(pPal); - - if (_hPalette) - { - SelectPalette(_hDC, _hPalette, FALSE); - RealizePalette(_hDC); - } - } - -//==================>>> vBaseGLCanvasPane::graphicsInit <<<======================== - void vBaseGLCanvasPane::graphicsInit(void) - { - // Perform only the most basic operations, including getting the context - - vglMakeCurrent(); - } - -//================>>> vBaseGLCanvasPane::vBaseGLMakeCurrent <<<=============== - void vBaseGLCanvasPane::vglMakeCurrent(void) - { - wglMakeCurrent(_hDC, _hGLRC); - } - -//==================>>> vBaseGLCanvasPane::vglFlush <<<======================== - void vBaseGLCanvasPane::vglFlush(void) - { - if (_doubleBuffer) - SwapBuffers(_hDC); - else - glFlush(); - } - -//=====================>>> vBaseGLCanvasPane::Resize <<<============================ - void vBaseGLCanvasPane::Resize(int newW, int newH) - { - // This is the routine the user will override to intercept size changes - vCanvasPane::Resize(newW,newH); - - vglMakeCurrent(); - glViewport(0,0,newW,newH); - - } diff --git a/v/srcwin/vboxlblc.cpp b/v/srcwin/vboxlblc.cpp deleted file mode 100644 index 5a6ee22..0000000 --- a/v/srcwin/vboxlblc.cpp +++ /dev/null @@ -1,192 +0,0 @@ -//=============================================================== -// vstatlbl.cxx - boxed label for stat bar - Windows -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include -#include // our definitions -#include // a command parent - -//=====================>>> vBoxedLabelCmd::vBoxedLabelCmd <<<================ - vBoxedLabelCmd::vBoxedLabelCmd(vCmdParent* dp, CommandObject* dc) : - vCmd(dp, dc) - { - initialize(); - } - -//=================>>> vBoxedLabelCmd::~vBoxedLabelCmd <<<=================== - vBoxedLabelCmd::~vBoxedLabelCmd() - { - - SysDebug(Destructor,"vBoxedLabelCmd::~vBoxedLabelCmd() destructor\n") - - } - -//=====================>>> vBoxedLabelCmd::initialize <<<===================== - void vBoxedLabelCmd::initialize(void) - { - // build a button command for use in a parent window - - - SysDebug(Constructor,"vBoxedLabelCmd::vBoxedLabelCmd() constructor\n") - - - long style = BS_OWNERDRAW | WS_GROUP; // default for a button - - CopyToLocal(); // Make local copies of CmdObject - - - if (!(dlgCmd->attrs & CA_Hidden)) // Check for Hidden - style |= WS_VISIBLE; - - int tl = strlen(_title); - - if ( tl < 80) - strcpy(_lbl,_title); - else - strcpy(_lbl,"????????"); - - if (dlgCmd->size > 0) // may reset title! - { - _w = dlgCmd->size; - } - else - _w = LabelWidth(_lbl) + 4; // set my width - - _h = 11; // default height - - _parentWin->SetPosition(_x, _y, _w, _h, dlgCmd->cFrame, dlgCmd->cRightOf, - dlgCmd->cBelow); - - - _CtrlOffset = _parentWin->AddDlgControl(_x, _y, _w, _h, _cmdId, - style, "BUTTON", _lbl, sizeof(vBoxedLabelCmd), (LPBYTE)this); - } - -//================>>> vBoxedLabelCmd::SetCmdVal <<<=========================== - void vBoxedLabelCmd::SetCmdVal(ItemVal val, ItemSetType st) - { - - SysDebug1(Misc,"vBoxedLabelCmd::SetCmdVal(val:%d)\n",val) - - HWND myHwnd = GetMyHwnd(_cmdId); - if (st == Sensitive) // used so icons won't get - { // focus -- icons use ownerdraw, - _Sensitive = val; // which behave like buttons, not - ::EnableWindow(myHwnd, val); // static labels -- this fixes that - } - else if (st == Hidden) // hide or unhide - { - if (val) - { - ::ShowWindow(myHwnd,SW_HIDE); - } - else - { - ::ShowWindow(myHwnd,SW_SHOW); - } - } - } - -//================>>> vBoxedLabelCmd::SetCmdStr <<<=========================== - void vBoxedLabelCmd::SetCmdStr(VCONST char* str) - { - - SysDebug1(Misc,"vBoxedLabelCmd::SetCmdStr(str:%s)\n",str) - - HWND myHwnd = GetMyHwnd(_cmdId); - strcpy(_lbl,str); - _title = _lbl; - ::RedrawWindow(myHwnd,NULL,NULL,RDW_INVALIDATE); - - } - - -//================>>> vBoxedLabelCmd::MEASUREITEM <<<========================= - int vBoxedLabelCmd::MEASUREITEM(int id, MEASUREITEMSTRUCT* mis) - { - mis->CtlType = ODT_BUTTON; - mis->CtlID = id; - mis->itemWidth = _w; - mis->itemHeight = _h; - - return 1; - } - -//================>>> vBoxedLabelCmd::DRAWITEM <<<============================ - int vBoxedLabelCmd::DRAWITEM(int /* id */, DRAWITEMSTRUCT* dis) - { - switch (dis->itemAction) - { - case ODA_DRAWENTIRE: // redraw entire control - { - // This gets called after the CTLCOLOR message has been - // processed in the dialog/commandpane procs. - // We are using LTGRAY_BRUSH for dialogs and command bars. - // We need to draw the icon properly on the background. - // We will use a null pen, and the same background. We have - // to use left-1, top-1, right+1, and bottom+1 to have the - // interior of the rectangle in the icon's area. We end up - // with a white line otherwise. First, fill gray background - - - HPEN oldpen = (HPEN) ::SelectObject(dis->hDC, GetStockObject(NULL_PEN)); - - HBRUSH oldbrush = static_cast(::SelectObject(dis->hDC, - theApp->_BarBrush)); - - (void)::Rectangle(dis->hDC,dis->rcItem.left, dis->rcItem.top, - dis->rcItem.right+1, dis->rcItem.bottom+1); - - if (!(dlgCmd->attrs & CA_NoBorder)) - { - ::SelectObject(dis->hDC, theApp->_ShadowPen); - ::MoveTo(dis->hDC, dis->rcItem.left+1, dis->rcItem.bottom-1); - ::LineTo(dis->hDC, dis->rcItem.left+1, dis->rcItem.top); - ::LineTo(dis->hDC, dis->rcItem.right-1, dis->rcItem.top); - - ::SelectObject(dis->hDC,theApp->_LightPen); - ::MoveTo(dis->hDC, dis->rcItem.right-1, dis->rcItem.top); - ::LineTo(dis->hDC, dis->rcItem.right-1, dis->rcItem.bottom-1); - ::LineTo(dis->hDC, dis->rcItem.left+1, dis->rcItem.bottom-1); - } - - int oldBkMode = ::GetBkMode(dis->hDC); - ::SetBkMode(dis->hDC,TRANSPARENT); - ::DrawText(dis->hDC, _lbl, strlen(_lbl), - &dis->rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE); - ::SetBkMode(dis->hDC,oldBkMode); - - - ::SelectObject(dis->hDC, oldpen); // restore hdc - ::SelectObject(dis->hDC, oldbrush); - - return 1; - } - - case ODA_SELECT: // indicated selected - { - return 1; // no op for icon Frame - } - - case ODA_FOCUS: // gets focus - { - return 1; // no op for icon Frame - } - } - return 0; - } - -//===================>>> vBoxedLabelCmd::vCmdCallback <<<======================= - void vBoxedLabelCmd::CmdCallback(int /* id */, WORD codeNotify) - { - // No Op for a label - } - diff --git a/v/srcwin/vbrush.cpp b/v/srcwin/vbrush.cpp deleted file mode 100644 index f7c94a8..0000000 --- a/v/srcwin/vbrush.cpp +++ /dev/null @@ -1,178 +0,0 @@ -//=============================================================== -// vbrush.cxx: vBrush class for drawing - Windows -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include -#include - -//=======================>>> vBrush::vBrush <<<=========================== - vBrush::vBrush(unsigned int r, unsigned int g, unsigned int b, - int style, int fillMode) - { - brushColor._r = (unsigned char) r; - brushColor._g = (unsigned char) g; - brushColor._b = (unsigned char) b; - brushColor._pixel = RGB(r,g,b); - brushStyle = style; - brushFillMode = fillMode; - _created = 0; _hbrush = 0; - } - -//=======================>>> vBrush::~vBrush <<<=========================== - vBrush::~vBrush() - { - if (_created) - ::DeleteObject(_hbrush); - } - -//=====================>>> vBrush::vBrush <<<=========================== - vBrush::vBrush(const vBrush& p) - { - // Copy constructor - needs to delete object if already - // created, and copy the values as needed - if (_created) - ::DeleteObject(_hbrush); - _created = 0; - _hbrush = 0; - brushColor = p.brushColor; - brushFillMode = p.brushFillMode; - brushStyle = p.brushStyle; - } - -//=====================>>> vBrush::operator= <<<=========================== - vBrush& vBrush::operator =(const vBrush& p) - { - if (this == &p) // assigning to self - { - return *this; - } - - // now just like a copy constructor - - if (_created) - ::DeleteObject(_hbrush); - _created = 0; - _hbrush = 0; - brushColor = p.brushColor; - brushFillMode = p.brushFillMode; - brushStyle = p.brushStyle; - - return *this; // allow r to l multiple assignment - } - -//=====================>>> vBrush::SetStyle <<<=========================== - void vBrush::SetStyle(int style) - { - if (style == brushStyle) - return; // no change - brushStyle = style; - if (_created) - { - ::DeleteObject(_hbrush); - _hbrush = 0; _created = 0; - } - } - -//=====================>>> vBrush::SetFillMode <<<=========================== - void vBrush::SetFillMode(int fm) - { - if (fm == brushFillMode) - return; // no change - brushFillMode = fm; - if (_created) - { - ::DeleteObject(_hbrush); - _hbrush = 0; _created = 0; - } - } - -//=====================>>> vBrush::SetColor <<<=========================== - void vBrush::SetColor(vColor c) - { - if (c == brushColor) - return; // no change - brushColor = c; - if (_created) - { - ::DeleteObject(_hbrush); - _hbrush = 0; _created = 0; - } - } - -//=====================>>> vBrush::SetColor <<<=========================== - void vBrush::SetColor(unsigned int r, unsigned int g, unsigned int b) - { - if (brushColor.r() == r && brushColor.g() == g && brushColor.b() == b) - return; // no change - - brushColor.Set(r,g,b); - if (_created) - { - ::DeleteObject(_hbrush); - _hbrush = 0; _created = 0; - } - } - -//=====================>>> vBrush::GetHBRUSH <<<=========================== - HBRUSH vBrush::GetHBRUSH() VCONST - { - if (! _created) - { - switch (brushStyle) - { - case vSolid: - _hbrush = ::CreateSolidBrush(brushColor._pixel); - break; - - case vTransparent: - { - LOGBRUSH lb; - lb.lbStyle = BS_NULL; - lb.lbColor = 0; - lb.lbHatch = 0; - _hbrush = ::CreateBrushIndirect(&lb); - break; - } - case vHorizontalHatch: - _hbrush = ::CreateHatchBrush(HS_HORIZONTAL,brushColor._pixel); - break; - - case vVerticleHatch: - _hbrush = ::CreateHatchBrush(HS_VERTICAL,brushColor._pixel); - break; - - case vLeftDiagonalHatch: - _hbrush = ::CreateHatchBrush(HS_FDIAGONAL,brushColor._pixel); - break; - - case vRightDiagonalHatch: - _hbrush = ::CreateHatchBrush(HS_BDIAGONAL,brushColor._pixel); - break; - - case vCrossHatch: - _hbrush = ::CreateHatchBrush(HS_CROSS,brushColor._pixel); - break; - - case vDiagonalCrossHatch: - _hbrush = ::CreateHatchBrush(HS_DIAGCROSS,brushColor._pixel); - break; - - default: - _hbrush = ::CreateSolidBrush(brushColor._pixel); - break; - - - } - - _created = 1; - } - return _hbrush; // return a created brush handle - } diff --git a/v/srcwin/vbtncmd.cpp b/v/srcwin/vbtncmd.cpp deleted file mode 100644 index b9eabf2..0000000 --- a/v/srcwin/vbtncmd.cpp +++ /dev/null @@ -1,551 +0,0 @@ -//=============================================================== -// vbtncmd.cpp - button Cmd - Windows -// -// Copyright (C) 1995-1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include // our definitions -#include // a command parent -#include -#include -#include - -//====================>>> vButtonCmd::vButtonCmd <<<======================= - vButtonCmd::vButtonCmd(vCmdParent* dp, CommandObject* dc) : - vCmd(dp, dc) - { - initialize(); - } - -//====================>>> vButtonCmd::~vButtonCmd <<<======================= - vButtonCmd::~vButtonCmd() - { - - SysDebug(Destructor,"vButtonCmd::~vButtonCmd() destructor\n") - - } - -//=====================>>> vButtonCmd::initialize <<<======================= - void vButtonCmd::initialize() - { - // build a button command for use in a parent window - - SysDebug(Constructor,"vButtonCmd::vButtonCmd() constructor\n") - - long style; - - if (_parentWin->_dialogType != aCmdBar) - style = WS_TABSTOP | WS_GROUP; // default for a button - else - style = WS_GROUP; - - CopyToLocal(); // Make local copies of CmdObject - - if (!(dlgCmd->attrs & CA_Hidden)) // Check for Hidden - style |= WS_VISIBLE; - - if ((dlgCmd->cmdType == C_IconButton || dlgCmd->cmdType == C_ToggleIconButton) - && _itemList != 0) // icon - { - initIconButton(style); // Special init if icon - return; - } - - if (dlgCmd->cmdType == C_ColorButton) // need owner draw if color - style |= BS_OWNERDRAW; - else if (dlgCmd->cmdType == C_ToggleButton) // need owner draw if toggle - style |= BS_OWNERDRAW; - else if ((dlgCmd->attrs & CA_DefaultButton)) // default button? - style |= BS_DEFPUSHBUTTON; // Only regular buttons can be default - else - style |= BS_PUSHBUTTON; // Plain old button - - _w = vLblLen(_title)*4+10; // set my width - _h = 14; // default height - - if ((dlgCmd->cmdType == C_Button || dlgCmd->cmdType == C_ToggleButton) - && dlgCmd->size > 0) // size - width - { - int w = vLblLen(_title)*4+10; - if (w < dlgCmd->size) - { - _w = dlgCmd->size; - } - } - else if (dlgCmd->size > 0) // size - square (icons, color buttons) - { - _w = _h = dlgCmd->size; - } - - _parentWin->SetPosition(_x, _y, _w, _h, dlgCmd->cFrame, dlgCmd->cRightOf, - dlgCmd->cBelow); - _CtrlOffset = _parentWin->AddDlgControl(_x, _y, _w, _h, _cmdId, - style, "BUTTON", _title, sizeof(vButtonCmd*), (LPBYTE)this); - - } - -//=====================>>> vButtonCmd::initIconButton <<<==================== - void vButtonCmd::initIconButton(long style) - { - _ip = (vIcon *) _itemList; // to access bitmap - - style |= BS_OWNERDRAW; - - _h = (_ip->height / 2) + 5; - _w = (_ip->width / 2) + 5; - - _parentWin->SetPosition(_x, _y, _w, _h, dlgCmd->cFrame, - dlgCmd->cRightOf, dlgCmd->cBelow); - - _CtrlOffset = _parentWin->AddDlgControl(_x, _y , _w, _h, _cmdId, - style, "BUTTON", "", sizeof(vButtonCmd*), (LPBYTE)this); - - } - -//==================>>> vButtonCmd::GetCmdValue <<<========================= - int vButtonCmd::GetCmdValue(ItemVal id) VCONST - { - if (id != _cmdId) - return -1; - return _retVal; - } - -//================>>> vButtonCmd::ResetItemValue <<<====================== - void vButtonCmd::ResetItemValue(void) - { - - // We have to toggle things - if (dlgCmd->cmdType != C_ToggleIconButton && - dlgCmd->cmdType != C_ToggleButton) - return; - - if (_retVal == _origVal) // No op if no change - return; - - HWND myHwnd = GetMyHwnd(_cmdId); - _retVal = _origVal; // restore - - ::ShowWindow(myHwnd,SW_HIDE); // trick into - ::ShowWindow(myHwnd,SW_SHOW); // repaint the window - - // let parent window handle now - _parentWin->ProcessCmd(_cmdId, _retVal, dlgCmd->cmdType); - } - - -//================>>> vButtonCmd::SetCmdVal <<<============================ - void vButtonCmd::SetCmdVal(ItemVal val, ItemSetType st) - { - - SysDebug1(Misc,"vButtonCmd::SetCmdVal(val:%d)\n",val) - HWND myHwnd = GetMyHwnd(_cmdId); - if (st == Sensitive) - { - _Sensitive = val; // set - ::EnableWindow(myHwnd, val); - } - else if (st == Hidden) // hide or unhide - { - if (val) - { - ::ShowWindow(myHwnd,SW_HIDE); - } - else - { - ::ShowWindow(myHwnd,SW_SHOW); - } - } - else if (st == Value || st == Checked) - { - _retVal = val; // set - ::ShowWindow(myHwnd,SW_HIDE); // this tricks it into always - ::ShowWindow(myHwnd,SW_SHOW); // repainting. - } - - } - -//================>>> vButtonCmd::SetCmdStr <<<============================ - void vButtonCmd::SetCmdStr(VCONST char* str) - { - // Set the string value of button - - SysDebug1(Misc,"vButtonCmd::SetCmdStr(str:%s)\n",str) - ::SetDlgItemText(_parentWin->getParent(),_cmdId, str); - _title = str; - - } - -//================>>> vButtonCmd::MEASUREITEM <<<============================ - int vButtonCmd::MEASUREITEM(int id, MEASUREITEMSTRUCT* mis) - { - mis->CtlType = ODT_BUTTON; - mis->CtlID = id; - mis->itemWidth = _w; - mis->itemHeight = _h; - - return 1; - } - -//================>>> vButtonCmd::DRAWITEM <<<============================ - int vButtonCmd::DRAWITEM(int /* id */, DRAWITEMSTRUCT* dis) - { - - HBITMAP hbm; - switch (dis->itemAction) - { - case ODA_DRAWENTIRE: // redraw entire control - { - DRAW_NORMAL: - if (dlgCmd->cmdType == C_IconButton || - dlgCmd->cmdType == C_ToggleIconButton) //Draw the icon - { - POINT ptSize, ptOrg; - - // Draw the button rectangle in LTGRAY with a BLACK border - - HPEN oldpen = (HPEN) ::SelectObject(dis->hDC, ::GetStockObject(BLACK_PEN)); - HBRUSH oldbrush = static_cast(::SelectObject(dis->hDC, theApp->_BarBrush)); - if (!(dlgCmd->attrs & CA_Flat)) // Check for flat - (void)::Rectangle(dis->hDC,dis->rcItem.left, dis->rcItem.top, - dis->rcItem.right, dis->rcItem.bottom); - - // Draw the shadows - WHITE left, top, GRAY right, bottom - if (dlgCmd->cmdType == C_IconButton) - ::SelectObject(dis->hDC, theApp->_LightPen); - else if (_retVal == 0) - ::SelectObject(dis->hDC, theApp->_LightPen); - else - ::SelectObject(dis->hDC,theApp->_ShadowPen); - - if (!(dlgCmd->attrs & CA_Flat)) // Check for flat - { - ::MoveTo(dis->hDC, dis->rcItem.left, dis->rcItem.bottom); - ::LineTo(dis->hDC, dis->rcItem.left, dis->rcItem.top); - ::LineTo(dis->hDC, dis->rcItem.right-1, dis->rcItem.top); - ::MoveTo(dis->hDC, dis->rcItem.left+1, dis->rcItem.bottom+1); - ::LineTo(dis->hDC, dis->rcItem.left+1, dis->rcItem.top+1); - ::LineTo(dis->hDC, dis->rcItem.right-2, dis->rcItem.top+1); - } - - if (dlgCmd->cmdType == C_IconButton || _retVal == 0) - ::SelectObject(dis->hDC,theApp->_ShadowPen); - else - ::SelectObject(dis->hDC, theApp->_LightPen); - - if (!(dlgCmd->attrs & CA_Flat)) // Check for flat - { - ::MoveTo(dis->hDC, dis->rcItem.right-1, dis->rcItem.top+1); - ::LineTo(dis->hDC, dis->rcItem.right-1, dis->rcItem.bottom-1); - ::LineTo(dis->hDC, dis->rcItem.left, dis->rcItem.bottom-1); - ::MoveTo(dis->hDC, dis->rcItem.right-2, dis->rcItem.top+1); - ::LineTo(dis->hDC, dis->rcItem.right-2, dis->rcItem.bottom-2); - ::LineTo(dis->hDC, dis->rcItem.left+1, dis->rcItem.bottom-2); - } - - // Get color to draw icon - GRAY or BLACK - HBRUSH dbrush = 0; - if (dis->itemState & ODS_DISABLED) - { - // This stuff needed to be sure it shows - if (::GetSysColor(COLOR_BTNSHADOW) == ::GetSysColor(COLOR_BTNFACE)) - { - ::SelectObject(dis->hDC, ::GetStockObject(GRAY_BRUSH)); - } - else - { - dbrush = ::CreateSolidBrush(::GetSysColor(COLOR_BTNSHADOW)); - ::SelectObject(dis->hDC, dbrush); - } - } - else // ODS_SELECTED or ODS_FOCUS - draw 2 ways! - { - if (_ip->iType == Transparent) - { - // Prepare for BitBlt with raster operation of PSDPxax, i.e. - // paint with the brush where the color of the pixel on the - // destination bitmap is zero - dbrush = ::CreateSolidBrush(::GetSysColor(COLOR_BTNFACE)); - ::SelectObject(dis->hDC, dbrush); - } - else - { - ::SelectObject(dis->hDC, ::GetStockObject(BLACK_BRUSH)); - } - } - - // Now setup coordinate to draw icon - - HDC hdcMem = ::CreateCompatibleDC(dis->hDC); - ::SetMapMode(hdcMem, GetMapMode(dis->hDC)); - hbm = _ip->GetIconHBM(dis->hDC); // get icon HBITMAP - HBITMAP oldbm = static_cast(::SelectObject(hdcMem,hbm)); - ptSize.x = _ip->width; - ptSize.y = _ip->height; - ::DPtoLP(dis->hDC, &ptSize, 1); - ptOrg.x = 0; - ptOrg.y = 0; - ::DPtoLP(hdcMem, &ptOrg, 1); - - int l = (dis->rcItem.right - _ip->width) / 2; - int t = (dis->rcItem.bottom - _ip->height) / 2; - - // Now BitBlt the icon BMP into the drawing canvas, leaving - // background untouched, and the pen color to draw 1 bits - // (that's what the E20746L does) for monochrome - - if (_ip->depth == 1) - { - ::SetBkColor(dis->hDC, RGB(255,255,255)); // white bg for icon - ::BitBlt(dis->hDC, l, t, ptSize.x, - ptSize.y, hdcMem, ptOrg.x, ptOrg.y, 0xE20746L); - } - else - { - ::BitBlt(dis->hDC, l, t, ptSize.x, - ptSize.y, hdcMem, ptOrg.x, ptOrg.y, SRCCOPY); - if (_ip->iType == Transparent) - { - // Now restore area from the button where the mask is zero - HDC hdcMemMask = ::CreateCompatibleDC( dis->hDC ); - HBITMAP hmsk = static_cast(_ip->GetIconMask( dis->hDC)); // get icon mask HBITMAP - HBITMAP oldBM = static_cast(::SelectObject( hdcMemMask, hmsk )); - ::BitBlt( dis->hDC, l, t, ptSize.x, - ptSize.y, hdcMemMask, ptOrg.x, ptOrg.y, 0xB8074A); //PSDPxax - ::SelectObject( hdcMemMask, oldBM ); - ::DeleteDC( hdcMemMask ); - } - } - ::SelectObject(hdcMem,oldbm); - ::DeleteDC(hdcMem); - ::SelectObject(dis->hDC, oldpen); // restore hdc - ::SelectObject(dis->hDC, oldbrush); - if (dbrush) ::DeleteObject(dbrush); - } - else if (dlgCmd->cmdType == C_ToggleButton) - { - // Draw a toggle button - - HPEN pen; - if (dis->itemState & ODS_DISABLED) - pen = (HPEN) ::GetStockObject(WHITE_PEN); - else - pen = (HPEN) ::GetStockObject(BLACK_PEN); - - // Set to the new brush color, remember the old one - - HPEN oldpen = (HPEN)::SelectObject(dis->hDC, pen); - - // Draw the button with a black border - - if (!(dlgCmd->attrs & CA_Flat)) // Check for flat - (void)::Rectangle(dis->hDC,dis->rcItem.left, dis->rcItem.top, - dis->rcItem.right, dis->rcItem.bottom); - - // Draw text for the Toggle button if it has it - - if (*_title ) - { - int tl = strlen(_title); // This little kludge - int tblanks = 0; // prevents drawing - for (VCONST char* tp = _title ; *tp ; ++tp) // all-blank titles - { // which can leave - if (*tp == ' ') // an ugly "pure color" - ++tblanks; // block in the middle - } // of the button. - if (tblanks != tl) - { - RECT rc = dis->rcItem; - if (_retVal) - { - rc.left += 2; rc.top += 2; // shift text - } - ::DrawText(dis->hDC, _title, strlen(_title), - &rc, DT_CENTER | DT_VCENTER | DT_SINGLELINE); - } - } - - // Now draw the shadow around the button - if (_retVal == 0) - ::SelectObject(dis->hDC, theApp->_LightPen); - else - ::SelectObject(dis->hDC,theApp->_ShadowPen); - - if (!(dlgCmd->attrs & CA_Flat)) // Check for flat - { - ::MoveTo(dis->hDC, dis->rcItem.left, dis->rcItem.bottom); - ::LineTo(dis->hDC, dis->rcItem.left, dis->rcItem.top); - ::LineTo(dis->hDC, dis->rcItem.right-1, dis->rcItem.top); - ::MoveTo(dis->hDC, dis->rcItem.left+1, dis->rcItem.bottom+1); - ::LineTo(dis->hDC, dis->rcItem.left+1, dis->rcItem.top+1); - ::LineTo(dis->hDC, dis->rcItem.right-2, dis->rcItem.top+1); - } - - - if (_retVal == 0) - ::SelectObject(dis->hDC,theApp->_ShadowPen); - else - ::SelectObject(dis->hDC, theApp->_LightPen); - - if (!(dlgCmd->attrs & CA_Flat)) // Check for flat - { - ::MoveTo(dis->hDC, dis->rcItem.right-1, dis->rcItem.top+1); - ::LineTo(dis->hDC, dis->rcItem.right-1, dis->rcItem.bottom-1); - ::LineTo(dis->hDC, dis->rcItem.left, dis->rcItem.bottom-1); - ::MoveTo(dis->hDC, dis->rcItem.right-2, dis->rcItem.top+1); - ::LineTo(dis->hDC, dis->rcItem.right-2, dis->rcItem.bottom-2); - ::LineTo(dis->hDC, dis->rcItem.left+1, dis->rcItem.bottom-2); - } - - ::SelectObject(dis->hDC, oldpen); // restore hdc - } - - return 1; - } - - case ODA_SELECT: // indicated selected - { - if (dlgCmd->cmdType == C_IconButton || - dlgCmd->cmdType == C_ToggleIconButton) - { - if (dis->itemState & ODS_SELECTED) //Draw the icon - { - POINT ptSize, ptOrg; - - // Draw the button rectangle in LTGRAY with a BLACK border - HBRUSH fbrush = ::CreateSolidBrush( - ::GetSysColor(COLOR_BTNFACE)); - HPEN oldpen = (HPEN) ::SelectObject(dis->hDC, - ::GetStockObject(BLACK_PEN)); - HBRUSH oldbrush = static_cast(::SelectObject(dis->hDC, fbrush)); - if (!(dlgCmd->attrs & CA_Flat)) // Check for flat - (void)::Rectangle(dis->hDC,dis->rcItem.left, - dis->rcItem.top, dis->rcItem.right, dis->rcItem.bottom); - - - // select pen, even if we don't draw... - ::SelectObject(dis->hDC, theApp->_ShadowPen); - if (!(dlgCmd->attrs & CA_Flat)) // Check for flat - { - // Draw the shadows - GRAY left, top, No right, bottom - ::MoveTo(dis->hDC, dis->rcItem.left, dis->rcItem.bottom); - ::LineTo(dis->hDC, dis->rcItem.left, dis->rcItem.top); - ::LineTo(dis->hDC, dis->rcItem.right, dis->rcItem.top); - ::MoveTo(dis->hDC, dis->rcItem.left+1, dis->rcItem.bottom-1); - ::LineTo(dis->hDC, dis->rcItem.left+1, dis->rcItem.top+1); - ::LineTo(dis->hDC, dis->rcItem.right-1, dis->rcItem.top+1); - } - - // Now setup coordinate to draw icon - - HDC hdcMem = ::CreateCompatibleDC(dis->hDC); - ::SetMapMode(hdcMem, GetMapMode(dis->hDC)); - hbm = _ip->GetIconHBM(hdcMem); // get icon HBITMAP - HBITMAP oldbm = static_cast(::SelectObject(hdcMem,hbm)); - ptSize.x = _ip->width; - ptSize.y = _ip->height; - DPtoLP(dis->hDC, &ptSize, 1); - ptOrg.x = 0; - ptOrg.y = 0; - DPtoLP(hdcMem, &ptOrg, 1); - ::SetBkColor(dis->hDC, RGB(255,255,255)); // white bg for icon - ::SelectObject(dis->hDC, ::GetStockObject(BLACK_BRUSH)); - - // Now BitBlt the icon BMP into the drawing canvas, leaving - // background untouched, and the pen color to draw 1 bits - // (that's what the E20746L does) (shifted 1 from normal icon) - - int l = (dis->rcItem.right - _ip->width) / 2; - int t = (dis->rcItem.bottom - _ip->height) / 2; - ::BitBlt(dis->hDC, l+1, t+1, ptSize.x, - ptSize.y, hdcMem, ptOrg.x, ptOrg.y, 0xE20746L); - ::SelectObject(hdcMem,oldbm); - ::DeleteDC(hdcMem); - ::SelectObject(dis->hDC, oldpen); // restore hdc - ::SelectObject(dis->hDC, oldbrush); - ::DeleteObject(fbrush); - return 1; - } - else - { - goto DRAW_NORMAL; - } - } - else if (dlgCmd->cmdType == C_ToggleButton) - { - // nearly the same as regular, but don't worry about - // insensitive and draw inverted shadow - - if (dis->itemState & ODS_SELECTED) //Draw the icon - { - // Draw the button rectangle in LTGRAY with a BLACK border - HBRUSH fbrush = ::CreateSolidBrush( - ::GetSysColor(COLOR_BTNFACE)); - HPEN oldpen = (HPEN) ::SelectObject(dis->hDC, - ::GetStockObject(BLACK_PEN)); - HBRUSH oldbrush = static_cast(::SelectObject(dis->hDC, fbrush)); - if (!(dlgCmd->attrs & CA_Flat)) // Check for flat - (void)::Rectangle(dis->hDC,dis->rcItem.left, - dis->rcItem.top, dis->rcItem.right, dis->rcItem.bottom); - - if (*_title) - { - RECT rc = dis->rcItem; - rc.left += 2; rc.top += 2; // shift text - ::DrawText(dis->hDC, _title, strlen(_title), - &rc, DT_CENTER | DT_VCENTER | DT_SINGLELINE); - } - - ::SelectObject(dis->hDC, theApp->_ShadowPen); - if (!(dlgCmd->attrs & CA_Flat)) // Don't draw if flat - { - ::MoveTo(dis->hDC, dis->rcItem.left, dis->rcItem.bottom); - ::LineTo(dis->hDC, dis->rcItem.left, dis->rcItem.top); - ::LineTo(dis->hDC, dis->rcItem.right, dis->rcItem.top); - ::MoveTo(dis->hDC, dis->rcItem.left+1, dis->rcItem.bottom+1); - ::LineTo(dis->hDC, dis->rcItem.left+1, dis->rcItem.top+1); - ::LineTo(dis->hDC, dis->rcItem.right-1, dis->rcItem.top+1); - } - ::SelectObject(dis->hDC, oldpen); // restore hdc - ::SelectObject(dis->hDC, oldbrush); - ::DeleteObject(fbrush); - return 1; - } - else - { - goto DRAW_NORMAL; - } - } - return 1; // no op for icon label - } - - case ODA_FOCUS: // gets focus - { - // need to draw something if CA_Flat -// ::MessageBeep(MB_OK); - return 1; // no op for icon label - } - default: - break; - } - return 0; - } - -//====================>>> vButtondCmd::CmdCallback <<<======================= - void vButtonCmd::CmdCallback(int /* id */, WORD /* codeNotify */) - { - - if (dlgCmd->cmdType == C_ToggleIconButton || // depends on state - dlgCmd->cmdType == C_ToggleButton) - { - SetCmdVal(!_retVal, Checked); - } - - // let parent window handle now - _parentWin->ProcessCmd(_cmdId, _retVal, dlgCmd->cmdType); - } diff --git a/v/srcwin/vcanvas.cpp b/v/srcwin/vcanvas.cpp deleted file mode 100644 index dd4a88f..0000000 --- a/v/srcwin/vcanvas.cpp +++ /dev/null @@ -1,594 +0,0 @@ -//=============================================================== -// vCanvas - a scrolling window canvas for drawing -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== -//#include - -#include // for Win 32 stuff -#include // our header -#include // need to use some vwindow stuff - - - VCursor vCanvasPane::_currentCursor = -1; // for cursor - -//================>>> vCanvasPane::vCanvasPane <<<======================== - vCanvasPane::vCanvasPane(PaneType pt) : vPane(pt) - { - SysDebug(Constructor,"vCanvasPane::vCanvasPane() constructor\n") - - _cpDC = 0; // no pane DC - _compressRedraw = 1; - _currentCursor = VC_Arrow; - } - -//================>>> vCanvasPane::~vCanvasPane <<<======================== - vCanvasPane::~vCanvasPane() - { - SysDebug(Destructor,"vCanvasPane::~vCanvasPane() destructor\n") - if (_cpDC != 0) - delete _cpDC; // free the DC - } - -//==================>>> vCanvasPane::initialize <<<========================== - void vCanvasPane::initialize(vWindow* pWindow, HWND pWidget) - { - - _HScrlShown = 100; - _HScrlTop = 0; - _VScrlShown = 100; - _VScrlTop = 0; - - // now, build the menu items in the widget provided - - vPane::initialize(pWindow, pWidget); // initialize base class - - pWindow->_canvasPane = this; // easy access to/from window - _drawWindow = pWindow->winHwnd(); - - _hasFocus = 0; // we don't start out with focus - - // set the height and width of our window - - if (theApp->simSDI()) - { - _height = _parentWin->_WinHeight; - _width = _parentWin->_WinWidth; - } - else - { - RECT rc; - - ::GetClientRect(_drawWindow,&rc); // area of the window - - _height = rc.bottom - rc.top; // update the local stuff - _width = rc.right - rc.left; - } - - - // After the drawing widget has been created, we can create - // the V DC for it to use. - - CreateDC(); - - _parentWin->_WinHeight = _height; - _parentWin->_WinWidth = _width; - - SetHScroll(_HScrlShown, 0); // initial values for scroll bar - SetVScroll(_VScrlShown, 0); - - _HOn = _VOn = 0; // both start out off - _parentWin->SetWinCursor(_currentCursor); - - // Now need to fake out enter focus so the first mouse - // click is ignored. - if (!_hasFocus) - { - _hasFocus = 1; - EnterFocus(); // call the virtual function - } - - if (theApp->simSDI()) - SetWidthHeight(_width, _height); - } - -//==================>>> vCanvasPane::CreateDC <<<======================== - void vCanvasPane::CreateDC(void) - { - if (!_cpDC) - _cpDC = new vCanvasPaneDC(this); // create a CanvasPaneDC - } - -//====================>>> vCanvasPane::ShowPane <<<====================== - void vCanvasPane::ShowPane(int OnOrOff) VCONST - { - if (OnOrOff) - { - ::ShowWindow(_drawWindow, SW_RESTORE); - } - else - { - ::ShowWindow(_drawWindow, SW_MINIMIZE); - } - } - -//=====================>>> vCanvasPane::SetWidthHeight <<<========================= - void vCanvasPane::SetWidthHeight(int width, int height) - { - if (height <= 0 || width <= 0) - return; - _parentWin->_WinHeight = _height = height; - _parentWin->_WinWidth = _width = width; - - RECT rect; - ::GetWindowRect(_drawWindow,&rect); // rect of canvas - - if (theApp->simSDI()) - { - RECT winRect; - int cW = rect.right - rect.left; // Width of canvas - int cH = rect.bottom - rect.top; // height of canvas - ::GetWindowRect(theApp->winHwnd(),&winRect); - - int wW = winRect.right - winRect.left - cW; - int wH = winRect.bottom - winRect.top - cH; // WH of window - - ::MoveWindow(theApp->winHwnd(),winRect.left,winRect.top, width+wW, - height + wH,1); - } - else - { - RECT ar; - ::GetWindowRect(theApp->winClientHwnd(), &ar); - int left = (rect.left >= ar.left) ? rect.left - ar.left : rect.left; - int top = (rect.top >= ar.top) ? rect.top - ar.top : rect.top; - ::MoveWindow(_drawWindow,left, top, width, height,1); - } - } - - -// ************************************************************************ - -//------------------------- cursor Stuff --------------------------------- - -// ************************************************************************ - -//==================>>> vCanvasPane::SetCursor <<<============================ - void vCanvasPane::SetCursor(VCursor id) - { - // Set to current cursor - - if (id < VC_None || id > VC_LAST) - { - SysDebug1(BadVals,"vCanvasPane::SetCursor(id=%d)\n",id) - return; - } - - if (id == VC_None) // special case - UnSetCursor(); - - SysDebug1(WindowEvents,"vCanvasPane::SetCursor(id=%d)%d\n",id) - - _currentCursor = id; - _parentWin->SetWinCursor(_currentCursor); - } - -//===================>>> vCanvasPane::UnSetCursor <<<========================= - void vCanvasPane::UnSetCursor(void) - { - _currentCursor = CA_None; - } - -// ************************************************************************ - -//----------------------- Scrolling Stuff --------------------------------- - -// ************************************************************************ - -//=======================>>> vCanvasPane::HPage <<<============================ - void vCanvasPane::HPage(int Shown, int Top) - { - // This is the main way a user app gets scrolling events, and - // will usually override this guy to handle what is actually - // drawn in the canvas window. - // This should then be called to actually change the display. - - SysDebug2(WindowEvents,"vCanvasPane::HPage(Shown: %d, Top: %d)\n",Shown, Top); - - SetHScroll(Shown,Top); - } - -//=======================>>> vCanvasPane::HScroll <<<========================== - void vCanvasPane::HScroll(int step) - { - // This is the way the user app gets step events - either page or - // single step events. The default doesn't have to do anything. - - SysDebug1(WindowEvents,"vCanvasPane::HScroll(%d)\n",step); - - if (step < 0) - { - if (_HScrlTop - 1 >= 0) - SetHScroll(_HScrlShown, --_HScrlTop); - } - else - { - if (_HScrlTop + 1 <= 100) - SetHScroll(_HScrlShown, ++_HScrlTop); - } - } - -//=====================>>> vCanvasPane::ShowHScroll <<<========================= - void vCanvasPane::ShowHScroll(int OnOff) - { - if (OnOff) // Turn on - { - if (_HOn) // Already on - return; - _HOn = 1; - ::ShowScrollBar(_drawWindow, SB_HORZ, 1); - ::SetScrollRange(_drawWindow,SB_HORZ, 0, 100, 0); // set range to 0-100 - } - else // Turn off - { - if (!_HOn) // Already off - return; - _HOn = 0; - ::ShowScrollBar(_drawWindow, SB_HORZ, 0); - } - } - -//=====================>>> vCanvasPane::ShowVScroll <<<========================= - void vCanvasPane::ShowVScroll(int OnOff) - { - if (OnOff) // Turn on - { - if (_VOn) // Already on - return; - _VOn = 1; - ::ShowScrollBar(_drawWindow, SB_VERT, 1); - ::SetScrollRange(_drawWindow,SB_VERT, 0, 100, 0); - } - else // Turn off - { - if (!_VOn) // Already off - return; - _VOn = 0; - ::ShowScrollBar(_drawWindow, SB_VERT, 0); - } - - } - -//=====================>>> vCanvasPane::SetHScroll <<<========================= - void vCanvasPane::SetHScroll(int Shown, int Top) - { - // Make sure we are setting to valid values, and are changing things! - - if (Shown < 0 || Shown > 100 || Top < 0 || Top > 100) - return; - - _HScrlShown = Shown; - _HScrlTop = Top; -#ifndef VWIN16 - SCROLLINFO si; - si.cbSize = sizeof(si); - si.fMask = SIF_POS | SIF_PAGE; - si.nPage = _HScrlShown; - si.nPos = _HScrlTop; - ::SetScrollInfo(_drawWindow, SB_HORZ, &si, 1); -#else - ::SetScrollPos(_drawWindow, SB_HORZ, _HScrlTop, 1); // Windows just has top -#endif - } - -//========================>>> vCanvasPane::VPage <<<=========================== - void vCanvasPane::VPage(int Shown, int Top) - { - - SysDebug2(WindowEvents,"vCanvasPane::VPage(Shown: %d, Top: %d)\n",Shown, Top); - - SetVScroll(Shown,Top); - - } - -//========================>>> vCanvasPane::VScroll <<<========================= - void vCanvasPane::VScroll(int step) - { - // This is the way the user app gets step events - either page or - // single step events. Default updates the display - - SysDebug1(WindowEvents,"vCanvasPane::VScroll(%d)\n",step); - if (step < 0) - { - if (_VScrlTop - 1 >= 0) - SetVScroll(_VScrlShown, --_VScrlTop); - } - else - { - if (_VScrlTop + 1 <= 100) - SetVScroll(_VScrlShown, ++_VScrlTop); - } - - } - -//=====================>>> vCanvasPane::GetVScroll <<<========================= - int vCanvasPane::GetVScroll(int& Shown, int& Top) VCONST // V:1.13 - { - Shown = _VScrlShown; Top = _VScrlTop; - return _VOn; - } - -//=====================>>> vCanvasPane::GetHScroll <<<========================= - int vCanvasPane::GetHScroll(int& Shown, int& Top) VCONST // V:1.13 - { - Shown = _HScrlShown; Top = _HScrlTop; - return _HOn; - } - -//=====================>>> vCanvasPane::SetVScroll <<<========================= - void vCanvasPane::SetVScroll(int Shown, int Top) - { - // Make sure we are setting to valid values, and are changing things! - - if (Shown < 0 || Shown > 100 || Top < 0 || Top > 100) - return; - - _VScrlShown = Shown; - _VScrlTop = Top; -#ifndef VWIN16 - SCROLLINFO si; - si.cbSize = sizeof(si); - si.fMask = SIF_POS | SIF_PAGE; - si.nPage = _VScrlShown; - si.nPos = _VScrlTop; - ::SetScrollInfo(_drawWindow, SB_VERT, &si, 1); -#else - ::SetScrollPos(_drawWindow, SB_VERT, _VScrlTop, 1); // Windows just has top -#endif - } - -//====================>>> vCanvasPane::HScrollEV <<<======================= - void vCanvasPane::HScrollEV(int code, int pos, HWND /* control */) - { - - switch (code) - { - case SB_BOTTOM: // Scroll to bottom - _HScrlTop = 100; - HPage(_HScrlShown, 100); - break; - - case SB_LINEDOWN: // Down one line - HScroll(1); - break; - - case SB_LINEUP: // Up one line - HScroll(-1); - break; - - case SB_PAGEDOWN: // Page Down - use 10 - if (_HScrlTop <= 90) - { - _HScrlTop += 10; - HPage(_HScrlShown, _HScrlTop); - } - else - { - _HScrlTop = 100; - HPage(_HScrlShown, 100); - } - break; - - case SB_PAGEUP: // Page Up - use -10 - if (_HScrlTop >= 10) - { - _HScrlTop -= 10; - HPage(_HScrlShown, _HScrlTop); - } - else - { - _HScrlTop = 0; - HPage(_HScrlShown, 0); - } - break; - - case SB_THUMBPOSITION: // move to position given - _HScrlTop = pos; - HPage(_HScrlShown, pos); - break; - - case SB_THUMBTRACK: // for continuous motion - ignore - break; - - case SB_TOP: // top of scroll - _HScrlTop = 0; - HPage(_HScrlShown, 0); - break; - } - } - -//====================>>> vCanvasPane::VScrollEV <<<======================= - void vCanvasPane::VScrollEV(int code, int pos, HWND /*control */) - { - switch (code) - { - case SB_BOTTOM: // Scroll to bottom - _VScrlTop = 100; - VPage(_VScrlShown, 100); - break; - - case SB_LINEDOWN: // Down one line - VScroll(1); - break; - - case SB_LINEUP: // Up one line - VScroll(-1); - break; - - case SB_PAGEDOWN: // Page Down - use 10 - if (_VScrlTop <= 90) - { - _VScrlTop += 10; - VPage(_VScrlShown, _VScrlTop); - } - else - { - _VScrlTop = 100; - VPage(_VScrlShown, 100); - } - break; - - case SB_PAGEUP: // Page Up - use -10 - if (_VScrlTop >= 10) - { - _VScrlTop -= 10; - VPage(_VScrlShown, _VScrlTop); - } - else - { - _VScrlTop = 0; - VPage(_VScrlShown, 0); - } - break; - - case SB_THUMBPOSITION: // move to position given - _VScrlTop = pos; - VPage(_VScrlShown, pos); - break; - - case SB_THUMBTRACK: // continuous, ignore - break; - - case SB_TOP: - _VScrlTop = 0; // top of scroll - VPage(_VScrlShown, 0); - break; - } - } - -// ************************************************************************ -// -// Redraw/resize/focus -// -// ************************************************************************ - - -//=====================>>> vCanvasPane::ExposeEV <<<========================== - void vCanvasPane::ExposeEV(void) - { - int x = 0, y = 0, height = 0, width = 0; - RECT rect; - if (::GetUpdateRect(_drawWindow, &rect, 0)) - { - x = rect.left ; y = rect.top; - height = rect.bottom - rect.top; - width = rect.right - rect.left; - _cpDC->ClearRect(x, y, width, height); - } - - Redraw(x, y , width, height); - } - -//=====================>>> vCanvasPane::EnterFocus <<<======================== - void vCanvasPane::EnterFocus(void) - { - SysDebug(WindowEvents,"vCanvasPane::EnterFocus()\n") - } - -//=====================>>> vCanvasPane::EnterEV <<<========================== - void vCanvasPane::EnterEV(void) - { - if (_hasFocus) // don't double enter focus - return; - _hasFocus = 1; - - EnterFocus(); // call the virtual function - } - -//======================>>> vCanvasPane::FontChanged <<<=========================== - void vCanvasPane::FontChanged(VCONST vFont& vf) - { - // Called when the font is changed. - - SysDebug(WindowEvents,"vCanvasPane::FontChanged()\n") - } - -//=====================>>> vCanvasPane::LeaveFocus <<<======================= - void vCanvasPane::LeaveFocus() - { - SysDebug(WindowEvents,"vCanvasPane::LeaveFocus()\n") - } - -//=====================>>> vCanvasPane::LeaveEV <<<========================== - void vCanvasPane::LeaveEV() - { - if (!_hasFocus) // don't double leave focus - return; - _hasFocus = 0; - - LeaveFocus(); // call the virtual function - } - -//=====================>>> vCanvasPane::MouseDown <<<========================== - void vCanvasPane::MouseDown(int x, int y, int button) - { - // Mouse events in vCanvasPane are no-ops. - -#ifdef vDEBUG // Don't have a SysDebug4 macro, so do it by hand - char msg[10]; - sprintf(msg,"Button = %d",button); -#endif - - SysDebug3(MouseEvents,"vCanvasPane::MouseDown(x:%d,y:%d,btn:%d)\n",x,y,button) - } - -//=====================>>> vCanvasPane::MouseUp <<<============================ - void vCanvasPane::MouseUp(int x, int y, int button) - { - // Mouse events in vCanvasPane are no-ops. - - SysDebug3(MouseEvents,"vCanvasPane::MouseUp(x:%d,y:%d,btn:%d)\n",x,y,button) - } - -//=====================>>> vCanvasPane::MouseMove <<<========================== - void vCanvasPane::MouseMove(int x, int y, int button) - { - // Mouse events in vCanvasPane are no-ops. - - SysDebug3(MouseEvents,"vCanvasPane::MouseMove(x:%d,y:%d,btn:%d)\n",x,y,button) - } - -//=======================>>> vCanvasPane::Redraw <<<========================== - void vCanvasPane::Redraw(int x, int y, int width, int height) - { - // Redraw in vCanvasPane is a no-op. - -#ifdef vDEBUG // Don't have a SysDebug4 macro, so do it by hand - if (DebugState.WindowEvents && DebugState.System) - fprintf(stderr,"vCanvasPane::Redraw(x=%d, y=%d, w=%d, h=%d)\n",x,y,width,height); -#endif - - } - -//=====================>>> vCanvasPane::Resize <<<============================ - void vCanvasPane::Resize(int newW, int newH) - { - // This is the routine the user will override to intercept size changes - - SysDebug2(WindowEvents,"vCanvasPane::Resize(newH:%d, newW:%d)\n",newH,newW) - - } - -//==================>>> vCanvasPane::ResizeEV <<<======================== - void vCanvasPane::ResizeEV(int w, int h) - { - _parentWin->_WinHeight = _height = h; - _parentWin->_WinWidth = _width = w; - - Resize((int)w, (int)h); // Call the virtual function - } diff --git a/v/srcwin/vcbtncmd.cpp b/v/srcwin/vcbtncmd.cpp deleted file mode 100644 index 62e0373..0000000 --- a/v/srcwin/vcbtncmd.cpp +++ /dev/null @@ -1,213 +0,0 @@ -//=============================================================== -// vcbtncmd.xxx - Color button Cmd - Windows -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include // our definitions -#include // a command parent - -//=================>>> vColorButtonCmd::vColorButtonCmd <<<===================== - vColorButtonCmd::vColorButtonCmd(vCmdParent* dp, CommandObject* dc) : - vButtonCmd(dp, dc) - { - initColor(); - } - -//====================>>> vColorButtonCmd::~vColorButtonCmd <<<================= - vColorButtonCmd::~vColorButtonCmd() - { - - SysDebug(Destructor,"vColorButtonCmd::~vColorButtonCmd() destructor\n") - } - -//=====================>>> vColorButtonCmd::initColor <<<======================= - void vColorButtonCmd::initColor(void) - { - // wCmd is the widget of this button - - SysDebug(Constructor,"vColorButtonCmd::vColorButtonCmd() constructor\n") - - _origColor = 0; - if (_itemList != 0) // an RGB provided - { - _origColor = (vColor*)_itemList; // point to the rgb - _color = *_origColor; - } - } - -//================>>> vColorButtonCmd::SetCmdVal <<<============================ - void vColorButtonCmd::SetCmdVal(ItemVal val, ItemSetType st) - { - - SysDebug1(Misc,"vColorButtonCmd::SetCmdVal(val:%d)\n",val) - - switch (st) - { - case ChangeColor: // changed original vColor - { - _color = *_origColor; // recopy color - HWND dH = _parentWin->getParent(); - char buff[80]; - ::GetDlgItemText(dH, _cmdId, buff, 80); // make it redraw - ::SetDlgItemText(dH, _cmdId, buff); // by "changing" text - break; - } - - case Red: - _color.SetR(val); - break; - - case Green: - _color.SetG(val); - break; - - case Blue: - { - _color.SetB(val); - // Now that the colors are set, we have to make the button - // redraw. There must be some better way, but this kludge - // is all I could figure out to force a redraw of the new color - HWND dH = _parentWin->getParent(); - char buff[80]; - ::GetDlgItemText(dH, _cmdId, buff, 80); // make it redraw - ::SetDlgItemText(dH, _cmdId, buff); // by "changing" text - break; - } - - default: - vButtonCmd::SetCmdVal(val, st); - break; - } - } - -//================>>> vColorButtonCmd::DRAWITEM <<<============================ - int vColorButtonCmd::DRAWITEM(int id, DRAWITEMSTRUCT* dis) - { - switch (dis->itemAction) - { - case ODA_DRAWENTIRE: // redraw entire control - { - DRAW_NORMAL: - - // Draw a color button - HBRUSH brush; - HPEN oldpen = static_cast(::SelectObject(dis->hDC, theApp->_ShadowPen)); - - // We will draw disabled color buttons in gray, otherwise - // in the color specified - - if (dis->itemState & ODS_DISABLED) - brush = static_cast (::GetStockObject(LTGRAY_BRUSH)); - else - brush = ::CreateSolidBrush(::GetNearestColor(dis->hDC,_color.pixel())); - - // Set to the new brush color, remember the old one - - HBRUSH oldbrush = static_cast(::SelectObject(dis->hDC, brush)); - - // Draw the button with a black border - - (void)::Rectangle(dis->hDC,dis->rcItem.left, dis->rcItem.top, - dis->rcItem.right, dis->rcItem.bottom); - - // Draw text for the color button if it has it - - if (*_title ) - { - int tl = strlen(_title); // This little kludge - int tblanks = 0; // prevents drawing - for (VCONST char* tp = _title ; *tp ; ++tp) // all-blank titles - { // which can leave - if (*tp == ' ') // an ugly "pure color" - ++tblanks; // block in the middle - } // of the button. - if (tblanks != tl) - { - ::SetBkColor(dis->hDC, ::GetNearestColor(dis->hDC,_color.pixel())); - ::DrawText(dis->hDC, _title, strlen(_title), - &dis->rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE); - } - } - - // Now draw the shadow around the button - ::SelectObject(dis->hDC, theApp->_LightPen); - ::MoveTo(dis->hDC, dis->rcItem.left, dis->rcItem.bottom); - ::LineTo(dis->hDC, dis->rcItem.left, dis->rcItem.top); - ::LineTo(dis->hDC, dis->rcItem.right-1, dis->rcItem.top); - ::MoveTo(dis->hDC, dis->rcItem.left+1, dis->rcItem.bottom+1); - ::LineTo(dis->hDC, dis->rcItem.left+1, dis->rcItem.top+1); - ::LineTo(dis->hDC, dis->rcItem.right-2, dis->rcItem.top+1); - - - ::SelectObject(dis->hDC,theApp->_ShadowPen); - ::MoveTo(dis->hDC, dis->rcItem.right-1, dis->rcItem.top+1); - ::LineTo(dis->hDC, dis->rcItem.right-1, dis->rcItem.bottom-1); - ::LineTo(dis->hDC, dis->rcItem.left, dis->rcItem.bottom-1); - ::MoveTo(dis->hDC, dis->rcItem.right-2, dis->rcItem.top+1); - ::LineTo(dis->hDC, dis->rcItem.right-2, dis->rcItem.bottom-2); - ::LineTo(dis->hDC, dis->rcItem.left+1, dis->rcItem.bottom-2); - - ::SelectObject(dis->hDC, oldpen); // restore hdc - ::SelectObject(dis->hDC, oldbrush); - if (!(dis->itemState & ODS_DISABLED)) // delete the brush if needed - ::DeleteObject(brush); - return 1; - } - - case ODA_SELECT: // indicated selected - { - // nearly the same as regular, but don't worry about insensitive - // and draw inverted shadow - - if (dis->itemState & ODS_SELECTED) //Draw the icon - { - HPEN oldpen = (HPEN)::SelectObject(dis->hDC, ::GetStockObject(BLACK_PEN)); - - HBRUSH brush = static_cast(::CreateSolidBrush(::GetNearestColor(dis->hDC,_color.pixel()))); - - HBRUSH oldbrush = static_cast(::SelectObject(dis->hDC, brush)); - - (void)::Rectangle(dis->hDC,dis->rcItem.left, dis->rcItem.top, - dis->rcItem.right, dis->rcItem.bottom); - - if (*_title) - { - RECT rc = dis->rcItem; - rc.left += 2; rc.top += 2; // shift text - ::SetBkColor(dis->hDC, ::GetNearestColor(dis->hDC,_color.pixel())); - ::DrawText(dis->hDC, _title, strlen(_title), - &rc, DT_CENTER | DT_VCENTER | DT_SINGLELINE); - } - - ::SelectObject(dis->hDC, theApp->_ShadowPen); - ::MoveTo(dis->hDC, dis->rcItem.left, dis->rcItem.bottom); - ::LineTo(dis->hDC, dis->rcItem.left, dis->rcItem.top); - ::LineTo(dis->hDC, dis->rcItem.right, dis->rcItem.top); - ::MoveTo(dis->hDC, dis->rcItem.left+1, dis->rcItem.bottom+1); - ::LineTo(dis->hDC, dis->rcItem.left+1, dis->rcItem.top+1); - ::LineTo(dis->hDC, dis->rcItem.right-1, dis->rcItem.top+1); - ::SelectObject(dis->hDC, oldpen); // restore hdc - ::SelectObject(dis->hDC, oldbrush); - ::DeleteObject(brush); // free brush - return 1; - } - else - goto DRAW_NORMAL; // other cases just like normal - } - - case ODA_FOCUS: // gets focus - { - return 1; // no op for icon label - } - default: - break; - } - return 0; - } diff --git a/v/srcwin/vchkboxc.cpp b/v/srcwin/vchkboxc.cpp deleted file mode 100644 index 9851292..0000000 --- a/v/srcwin/vchkboxc.cpp +++ /dev/null @@ -1,148 +0,0 @@ -//=============================================================== -// vchkboxc.cxx - Checkbox - Windows version -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include // our definitions -#include // a command parent -#include -#include - -//=================>>> vCheckBoxCmd::~vCheckBoxCmd <<<======================= - vCheckBoxCmd::~vCheckBoxCmd() - { - SysDebug(Destructor,"vCheckBoxCmd::~vCheckBoxCmd() destructor\n") - } - -//=================>>> vCheckBoxCmd::vCheckBoxCmd <<<======================= - vCheckBoxCmd::vCheckBoxCmd(vCmdParent* dp, CommandObject* dc) : - vCmd(dp, dc) - { - // Create bitmaps if need to - - - SysDebug(Constructor,"vCheckBoxCmd::vCheckBoxCmd() constructor\n") - - initialize(); // and initialize - } - -//=====================>>> vCheckBoxCmd::initialize <<<======================= - void vCheckBoxCmd::initialize(void) - { - - long style = WS_TABSTOP | WS_GROUP | BS_CHECKBOX; // default for a button - - CopyToLocal(); // Make local copies of CmdObject - - if (!(dlgCmd->attrs & CA_Hidden)) // Check for Hidden - style |= WS_VISIBLE; - - _w = vLblLen(_title)*4+14; // set my width - _h = 11; // default height - - - - _parentWin->SetPosition(_x, _y, _w, _h + 3, dlgCmd->cFrame, dlgCmd->cRightOf, - dlgCmd->cBelow); - - _y += 2; // center better - _CtrlOffset = _parentWin->AddDlgControl(_x, _y, _w, _h, _cmdId, - style, "BUTTON", _title, sizeof(vCmd*), (LPBYTE)this); - - } - -//================>>> vCheckBoxCmd::ResetItemValue <<<====================== - void vCheckBoxCmd::ResetItemValue(void) - { - - // We have to toggle things - - if (_retVal == _origVal) // No op if no change - return; - - _retVal = _origVal; // restore - - if (_retVal) // depends on state - { - SetCmdVal(1, Checked); - } - else - { - SetCmdVal(0, Checked); - } - - // let parent window handle now - _parentWin->ProcessCmd(_cmdId, _retVal, dlgCmd->cmdType); - } - -//==================>>> vCheckBoxCmd::GetCmdValue <<<========================= - int vCheckBoxCmd::GetCmdValue(ItemVal id) VCONST - { - if (id != _cmdId) - return -1; - return _retVal; - } - -//================>>> vCheckBoxCmd::SetCmdVal <<<============================ - void vCheckBoxCmd::SetCmdVal(ItemVal val, ItemSetType st) - { - - SysDebug1(Misc,"vCheckBoxCmd::SetCmdVal(val:%d)\n",val) - - HWND myHwnd = GetMyHwnd(_cmdId); - - if (st == Sensitive) - { - _Sensitive = val; // set - ::EnableWindow(myHwnd, val); - } - else if (st == Hidden) // hide or unhide - { - if (val) - { - ::ShowWindow(myHwnd,SW_HIDE); - } - else - { - ::ShowWindow(myHwnd,SW_SHOW); - } - } - else if (st == Value || st == Checked) - { - _retVal = val; // set - ::CheckDlgButton(_parentWin->getParent(),_cmdId, val); - } - } - -//================>>> vCheckBoxCmd::SetCmdStr <<<============================ - void vCheckBoxCmd::SetCmdStr(VCONST char* str) - { - - SysDebug1(Misc,"vCheckBoxCmd::SetCmdStr(str:%s)\n",str) - ::SetDlgItemText(_parentWin->getParent(), _cmdId, str); - _title = str; - } - -//====================>>> vCheckBoxCmd::CmdCallback <<<======================= - void vCheckBoxCmd::CmdCallback(int id, WORD codeNotify) - { - - if (_retVal) // depends on state - { - SetCmdVal(0, Checked); - } - else - { - SetCmdVal(1, Checked); - } - - // let parent window handle now - _parentWin->ProcessCmd(_cmdId, _retVal, dlgCmd->cmdType); - } diff --git a/v/srcwin/vclabelc.cpp b/v/srcwin/vclabelc.cpp deleted file mode 100644 index 60e7dbe..0000000 --- a/v/srcwin/vclabelc.cpp +++ /dev/null @@ -1,90 +0,0 @@ -//=============================================================== -// vclabelc.xxx - Color label Cmd - Windows -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include // our definitions -#include // a command parent - -//=================>>> vColorLabelCmd::vColorLabelCmd <<<======================= - vColorLabelCmd::vColorLabelCmd(vCmdParent* dp, CommandObject* dc) : - vLabelCmd(dp, dc) - { - initColor(); - } - -//====================>>> vColorLabelCmd::~vColorLabelCmd <<<=================== - vColorLabelCmd::~vColorLabelCmd() - { - - SysDebug(Destructor,"vColorLabelCmd::~vColorLabelCmd() destructor\n") - } - -//=====================>>> vColorLabelCmd::initColor <<<======================= - void vColorLabelCmd::initColor(void) - { - // wCmd is the widget of this button - - SysDebug(Constructor,"vColorLabelCmd::vColorLabelCmd() constructor\n") - - _origColor = 0; - - if (_itemList != 0) // an RGB provided - { - _origColor = (vColor*)_itemList; // point to the rgb - _color = *_origColor; - } - - } - -//================>>> vColorLabelCmd::SetCmdVal <<<============================ - void vColorLabelCmd::SetCmdVal(ItemVal val, ItemSetType st) - { - - SysDebug1(Misc,"vColorLabelCmd::SetCmdVal(val:%d)\n",val) - - switch (st) - { - case ChangeColor: // changed original vColor - { - _color = *_origColor; // recopy color - HWND dH = _parentWin->getParent(); - char buff[80]; - ::GetDlgItemText(dH, _cmdId, buff, 80); // make it redraw - ::SetDlgItemText(dH, _cmdId, buff); // by "changing" text - break; - } - - case Red: - _color.SetR(val); - break; - - case Green: - _color.SetG(val); - break; - - case Blue: - { - _color.SetB(val); - // Now that the colors are set, we have to make the button - // redraw. There must be some better way, but this kludge - // is all I could figure out to force a redraw of the new color - HWND dH = _parentWin->getParent(); - char buff[80]; - ::GetDlgItemText(dH, _cmdId, buff, 80); // make it redraw - ::SetDlgItemText(dH, _cmdId, buff); // by "changing" text - break; - } - - default: - vLabelCmd::SetCmdVal(val, st); - break; - } - } diff --git a/v/srcwin/vcmd.cpp b/v/srcwin/vcmd.cpp deleted file mode 100644 index 9651717..0000000 --- a/v/srcwin/vcmd.cpp +++ /dev/null @@ -1,88 +0,0 @@ -//=============================================================== -// vcmd.cxx - vCmd class -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include -#include -#include -#include - -//===================>>> vCmd::vCmd <<<======================= - vCmd::vCmd(vCmdParent* dp, CommandObject* co) - { - // We had to make this a non-inline to get access - // to the vcmdprnt definitons. - - _parentWin = dp; // dialog class parent - dlgCmd = co; // static data structure - wParent = 0; // parent window - _origVal = co->retVal; // save orignal state - } - -//===================>>> vCmd::CopyToLocal <<<======================= - void vCmd::CopyToLocal(void) - { - // Copy static values to local copy - _title = dlgCmd->title; - if (!_title || *_title == 0) - _title = ""; - _cmdId = dlgCmd->cmdId; - _retVal = dlgCmd->retVal; - _Sensitive = dlgCmd->Sensitive; - _itemList = dlgCmd->itemList; - - } - -//===================>>> vCmd::vCmdCallback <<<======================= - void vCmd::CmdCallback(int /* id */, WORD codeNotify) - { - - _parentWin->ProcessCmd(dlgCmd->cmdId, dlgCmd->retVal, dlgCmd->cmdType); - } - -//===================>>> vCmd::GetMyHwnd <<<======================= - HWND vCmd::GetMyHwnd(ItemVal id) VCONST - { - return ::GetDlgItem(_parentWin->getParent(), id); - } - -//===================>>> vCmd::LabelWidth <<<======================= - int vCmd::LabelWidth(VCONST char* lbl) VCONST - { - // Ok, I know this is not the right way to do this, but I tried - // other ways and just couldn't get it to work right before the - // dialog realy exists, so this kludge helps. - - // map of dialog box width units of Helv 8 characters - - // _!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ - // 22344532333423234444444444224444655555455244465555555557454 - - // [\]^_`abcdefghijklmnopqrstuvwxyz{|}~ - // 333443444442442242544443424454443235 - - int clen[] = - { - 2,2,3,4,4,5,3,2,3,3,3,4,2,3,2,3,4,4,4,4,4,4,4,4,4,4, - 2,2,4,4,4,4,6,5,5,5,5,5,4,5,5,2,4,4,4,6,5,5,5,5,5,5, - 5,5,5,7,4,5,4,3,3,3,4,4,3,4,4,4,4,4,2,4,4,2,2,4,2,5, - 4,4,4,4,3,4,2,4,4,5,4,4,4,3,2,3,5,0,0,0,0 - }; - int len = 0; - for (VCONST char* cp = lbl ; *cp ; cp++) - { - if (*cp >= ' ' && *cp <= '~') - len += clen[*cp-' ']; - else - len += 4; - } - return len; - } diff --git a/v/srcwin/vcmdpane.cpp b/v/srcwin/vcmdpane.cpp deleted file mode 100644 index 6c14a33..0000000 --- a/v/srcwin/vcmdpane.cpp +++ /dev/null @@ -1,580 +0,0 @@ -//=============================================================== -// vCommandPane - the command bar pane class used by the vWindow class -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include -#include // we are part of a window -#include // For this list -#include - -#include // for tooltips -static HWND hwndToolTip = 0; - -// Define static data of the class - static BOOL CALLBACK DlgProcCB(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); - - static vThisList _thisList; // hide this in this file - -//===================>>> vChkCmdPaneMsgs <<<======================= - int vChkCmdPaneMsgs(MSG *msg) - { - // Need this to check if a message should be processed - // by the dialog message processor instead of the general loop. - - for (vCommandPane* w = (vCommandPane*) _thisList.GetFirstThis() ; w != 0 ; - w = (vCommandPane*) _thisList.GetNextThis()) - { - if (::IsDialogMessage(w->HwndDialog(),msg)) - return 1; - } - return 0; - } - - -//===================>>> vCommandPane::vCommandPane <<<==================== - vCommandPane::vCommandPane(CommandObject* cList) : - vPane(P_Commands), vCmdParent(P_Commands) - { - - - SysDebug(Constructor,"vCommandPane::vCommandPane() constructor\n") - - _origList = cList; // handle to list of commands - _dialogType = aCmdBar; // this is a command pane - _isDisplayed = 1; // Command bars displayed by default - _isShown = 0; // but not yet shown - _cmdObj = 0; // no list - _cmdObjCount = 0; - } - -//===================>>> vCommandPane::vCommandPane <<<==================== - vCommandPane::vCommandPane(vStatus* s_bar) : - vPane(P_Status), vCmdParent(P_Status) - { - - - _dialogType = aStatBar; // this is really a command pane - _isDisplayed = 1; // Command bars displayed by default - _isShown = 0; // but not yet shown - char* cp; - - SysDebug(Constructor,"vStatusPane::vStatusPane() constructor\n") - - - for (_cmdObjCount = 1 ; s_bar[_cmdObjCount].label ; ++_cmdObjCount) - ; - - _cmdObj = new CommandObject[_cmdObjCount+1]; - - for (int ix = 0 ; ix <= _cmdObjCount ; ++ix) - { - if (!s_bar[ix].label) // end of list - { - _cmdObj[ix].cmdType = C_EndOfList; - _cmdObj[ix].title = 0; - break; - } - _cmdObj[ix].cmdType = C_BoxedLabel; - - - _cmdObj[ix].cmdId = s_bar[ix].statId; - _cmdObj[ix].Sensitive = s_bar[ix].sensitive; - _cmdObj[ix].retVal = 0; - cp = new char[strlen(s_bar[ix].label)+1]; // copy string - strcpy(cp,s_bar[ix].label); - _cmdObj[ix].title = cp; - _cmdObj[ix].itemList = 0; - _cmdObj[ix].attrs = s_bar[ix].attrs; - _cmdObj[ix].cFrame = 0; - _cmdObj[ix].cRightOf = 0; - _cmdObj[ix].cBelow = 0; - _cmdObj[ix].size = s_bar[ix].width; - _cmdObj[ix].tip = 0; - } - _origList = _cmdObj; // handle to list of commands - - } - -//===================>>> vCommandPane::~vCommandPane <<<==================== - vCommandPane::~vCommandPane() - { - - SysDebug(Destructor,"vCommandPane::~vCommandPane() destructor\n") - - theApp->unregisterCmdPane(this); - - if (_hTemplate !=0) - { - ::GlobalFree(_hTemplate); - _hTemplate = 0; - } - - if (_cmdObj != 0) - { - for (int ix = 0 ; ix < _cmdObjCount ; ++ix) - { - if (_cmdObj[ix].title) - delete [] _cmdObj[ix].title; // free strings - } - - delete [] _cmdObj; // free list - } - - _thisList.Delete((ThisId)_wDialog); // free the this ptr - } - -//==================>>> vCommandPane::ProcessCmd <<<======================= - void vCommandPane::ProcessCmd(ItemVal id, ItemVal rv, CmdType ct) - { - // simple interface between command objects and the - // inherited vCmdParent ProcessCmd to the CommandObject which does the work - - _parentWin->WindowCommand(id, rv, ct); - } - -//====================>>> vCommandPane::GetPaneValue <<<====================== - int vCommandPane::GetPaneValue(ItemVal id, int& val) VCONST - { - if (HasId(id)) // make sure the id is in the pane - { - val = GetValue(id); - return 1; // assume 0 if not found - } - else - return 0; // can't find this id - } - -//====================>>> vCommandPane::GetPaneTextIn <<<====================== - int vCommandPane::GetPaneTextIn(ItemVal id, char* str, int maxlen) VCONST - { - if (HasId(id)) // make sure the id is in the pane - { - return GetTextIn(id,str,maxlen); - } - else - return 0; // can't find this id - } - -//===================>>> vCommandPane::SetPaneValue <<<======================== - void vCommandPane::SetPaneValue(ItemVal id, int val, ItemSetType setType) - { - SetValue(id,val,setType); - } - - -//====================>>> vCommandPane::SetPaneString <<<====================== - void vCommandPane::SetPaneString(ItemVal id, VCONST char* str) - { - SetString(id,str); - } - -//====================>>> vCommandPane::ShowPane <<<====================== - void vCommandPane::ShowPane(int OnOrOff) VCONST - { - if (OnOrOff != _isDisplayed) // only need to do something if changed - { - _isDisplayed = OnOrOff; - FORWARD_vWM_ResizeMDIClient(theApp->_Frame,SendMessage); - } - } - -//====================>>> vCommandPane::initialize <<<======================= - void vCommandPane::initialize(vWindow* pWin, HWND mdiChildWin) - { - // now, build the menu items in the widget provided - - DlgCmdList* curCmd; - - - vPane::initialize(pWin, mdiChildWin); // initialize base class - - _associatedMdiWindow = mdiChildWin; - - // Now, build the initial in-memory dialog template using - // Windows HGLOBAL handle _hTemplate. - // Using 8,helv makes it ok to use constant 8 in calculating control sizes - int buildOK = CreateDlgTemplate( - WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS | DS_SETFONT, 0, 0, 1, 1, - // WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS , 0, 0, 1, 1, - "", "", "", 8, "Helv" ); - - if (!buildOK) - vSysError("vDialog - Unable to build dialog template"); - - - int ix; - // Add each control to the template via AddCmd - for (ix = 0 ; _origList && (_origList[ix].cmdType != C_EndOfList) ; ++ix) - { - curCmd = new DlgCmdList; // get a new cell - - curCmd->nextDCL = _cmdList; // add in at front - _cmdList = curCmd; - curCmd->cmdP = 0; // not added yet - curCmd->cmdP = AddCmd(&_origList[ix]); - } - - DoneAddingControls(); // All finished adding controls - - // Now ready to create the dialog - - _wDialog = 0; // Don't have the window handle yet - - // CreateDialogIndirect will create the dialog, then send a WM_INITDIALOG - // message to make it be displayed. - - const DLGTEMPLATE *ptr = (const DLGTEMPLATE*)GlobalLock(_hTemplate); - - (void) ::CreateDialogIndirectParam((HINSTANCE)theApp->vHandle(), - (DLGTEMPLATE*)ptr, - theApp->_Frame, - (DLGPROC) DlgProcCB, LPARAM(this)); - - ::GlobalUnlock(_hTemplate); // Unlock the template here - ::GlobalFree(_hTemplate); - - _hTemplate = 0; - } - -// --------------------------------------------------------------------- -//====================>>> DlgProc <<<======================= - static BOOL CALLBACK DlgProcCB(HWND hDlg, UINT uMsg, - WPARAM wParam, LPARAM lParam) - { - vCommandPane* useThis; - - if (uMsg == WM_INITDIALOG) // first time! - { - useThis = (vCommandPane*)lParam; - _thisList.Add((ThisId)hDlg, (void*)useThis); - } - else - useThis = (vCommandPane*)_thisList.GetThis((ThisId)hDlg); - if (!useThis) - return 0; - - return useThis->DynamicDlgProc(hDlg, uMsg, wParam, lParam); - } - -//====================>>> vCommandPane::OnInitDialog <<<================== - int vCommandPane::OnInitDialog(HWND hwnd, HWND /* hwndFocus*/, LPARAM lParam) - { - - // Changes here must have equivlalents in the vDialog.cpp code - //create the tooltip window - if (hwndToolTip == 0) - hwndToolTip = CreateWindowEx( 0, - TOOLTIPS_CLASS, - NULL, - WS_POPUP | TTS_ALWAYSTIP, - CW_USEDEFAULT, - CW_USEDEFAULT, - 10, - 10, - hwnd, - NULL, - (HINSTANCE)theApp->vHandle(), - NULL); - - for (DlgCmdList* cc = _cmdList ; cc != 0 ; cc = cc->nextDCL) - { - vCmd* cp = cc->cmdP; - - // BEW - V 1.17 - Shouldn't have to do this, but the dynamic - // dialog creation somehow replaces characters > 128 with _. - // This fixes that problem. - - if ((cp->dlgCmd)->cmdType == C_BoxedLabel || - (cp->dlgCmd)->cmdType == C_Button || - (cp->dlgCmd)->cmdType == C_CheckBox || - (cp->dlgCmd)->cmdType == C_Label || - (cp->dlgCmd)->cmdType == C_RadioButton || - (cp->dlgCmd)->cmdType == C_TextIn - ) - { - cp->SetCmdStr((cp->dlgCmd)->title); - } - else if ((cp->dlgCmd)->cmdType == C_Text) - { - if (!(cp->dlgCmd)->itemList || - (*(char *)(cp->dlgCmd)->itemList == 0)) - cp->SetCmdStr((cp->dlgCmd)->title); - else - cp->SetCmdStr((char*)(cp->dlgCmd)->itemList); - } - - - if ((cp->dlgCmd)->cmdType == C_CheckBox && (cp->dlgCmd)->retVal) - cp->SetCmdVal(1,Checked); - - if ((cp->dlgCmd)->cmdType == C_RadioButton && (cp->dlgCmd)->retVal) - cp->SetCmdVal(1,Checked); - - if ((cp->dlgCmd)->cmdType == C_Slider || (cp->dlgCmd)->cmdType == C_Spinner) - cp->SetCmdVal(cp->GetCmdValue((cp->dlgCmd)->cmdId),Value); - - if (!(cp->dlgCmd)->Sensitive) // Make insensitive if it was - { - cp->SetCmdVal(0,Sensitive); - } - if ((cp->dlgCmd)->attrs & CA_Hidden) // Hide it! - { - cp->SetCmdVal(1,Hidden); - } - if ((cp->dlgCmd)->cmdType == C_List - || (cp->dlgCmd)->cmdType == C_ComboBox - || (cp->dlgCmd)->cmdType == C_SComboBox - || (cp->dlgCmd)->cmdType == C_Spinner - || (cp->dlgCmd)->cmdType == C_SList ) - { - int curval = cp->GetCmdValue((cp->dlgCmd)->cmdId); - cp->SetCmdVal(curval,ChangeList); - } - // This call to fake out using OWNERDRAW for statics - if ((cp->dlgCmd)->cmdType == C_Icon || (cp->dlgCmd)->cmdType == C_Frame) - { - cp->SetCmdVal(0,Sensitive); // Trick to avoid getting focus - } - - // Now add ToolTip if it has a message - if ((cp->dlgCmd)->tip && *(cp->dlgCmd)->tip) - { - TOOLINFO ti; - // add the control to the tooltip. TTF_SUBCLASS causes the - // tooltip to automatically subclass the window and look for the - // messages it is interested in. - - char *cc = (char*) &ti; - int lim = sizeof (ti); - for (int i = 0 ; i++ < lim ; *cc++ = 0) - ; - - // ZeroMemory(&ti, sizeof(ti)); - ti.cbSize = sizeof(ti); - ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS; - ti.hwnd = hwnd; - ti.uId = (UINT)GetDlgItem(hwnd,(cp->dlgCmd)->cmdId); - ti.lpszText = (LPSTR) TEXT((cp->dlgCmd)->tip); - SendMessage(hwndToolTip, TTM_ADDTOOL, 0, (LPARAM)&ti); - } - } - _isShown = 1; // We will be shown now - theApp->registerCmdPane(this); // add our cmd pane - theApp->selectCmdPanes(_parentWin); // turn off cmd panes of other windows - RECT rc; // to get our size - - ::GetClientRect(_wDialog, &rc); // the rect of the command bar - _windowY = - _windowH = rc.bottom - rc.top; - - FORWARD_vWM_ResizeMDIClient(theApp->_Frame,SendMessage); - - return 1; - } - -//====================>>> vCommandPane::OnEnable <<<================== - void vCommandPane::OnEnable(HWND hwnd, BOOL fEnable) - { - // Make all child windows have the same status as the dialog box. - - for (HWND hwndCtl = ::GetFirstChild(hwnd) ; hwndCtl != NULL ; - hwndCtl = ::GetNextSibling(hwndCtl)) - { - ::EnableWindow(hwndCtl, fEnable); - } - } - -//====================>>> vCommandPane::OnPaint <<<================== - int vCommandPane::OnPaint(HWND /*hwnd*/) - { - - // Paint dividing lines around command/status bar - - RECT rc; - - int borderH = ::GetSystemMetrics(SM_CYBORDER); - HWND useH = _wDialog; - - ::GetClientRect(theApp->_Frame, &rc); - - HDC hdc = ::GetDC(useH); - - if (paneType() == P_Status) // Paint a status bar - { - HPEN oldpen = (HPEN)::SelectObject(hdc, theApp->_ShadowPen); - ::MoveTo(hdc, 0, 0); - ::LineTo(hdc, rc.right,0); - ::SelectObject(hdc, theApp->_LightPen); - ::MoveTo(hdc, 0, 1); - ::LineTo(hdc, rc.right, 1); - - ::MoveTo(hdc,10,_windowH - 3); - ::LineTo(hdc,rc.right - 10, _windowH - 3); - ::LineTo(hdc,rc.right - 10, 3); - - ::SelectObject(hdc,theApp->_ShadowPen); - - ::LineTo(hdc, 10, 3); - ::LineTo(hdc, 10, _windowH - 3); - ::SelectObject(hdc, oldpen); - } - else // Paint a command bar - { - HPEN oldpen = (HPEN)::SelectObject(hdc, theApp->_LightPen); - ::MoveTo(hdc, 0, 0); - ::LineTo(hdc, rc.right,0); - ::SelectObject(hdc, theApp->_ShadowPen); - ::MoveTo(hdc, 0, _windowH - borderH); - ::LineTo(hdc, rc.right, _windowH - borderH); - ::SelectObject(hdc, oldpen); - } - - ::ReleaseDC(useH, hdc); - - return 0; - } - -//====================>>> vCommandPane::OnCommand <<<================== - void vCommandPane::OnCommand (HWND /* hwnd*/, int id, HWND /*hwndCtl*/, - WORD codeNotify) - { - - vCmd* UseThis = (vCmd *) getThisFromId((ItemVal)id); - - if (UseThis) - { - // A very dangerous thing can happen here if the button causes - // vApp::Exit to be called. This can cause things to be destructed, - // which means that the command object goes away, which means - // that UseThis no longer points to something valid, which is of - // course a problem. Exit can get called in CmdCallback, so we - // will remember the command type first for the test after the call. - - CmdType ct = (UseThis->dlgCmd)->cmdType; // will be ok still - - UseThis->CmdCallback( id, codeNotify); - - // Now, the following is ugly, but... - // We need a SetFocus to get the keyborad back to the - // canvas so that menu accelerators will work, but for - // lists and combos, SetFocus breaks them, so we have - // to check for the special case. - if ((ct == C_ComboBox || ct == C_SComboBox) && - codeNotify != CBN_SELCHANGE) - return; - if ((ct == C_List || ct == C_SList) && - codeNotify != LBN_SELCHANGE && codeNotify != LBN_DBLCLK) - return; - if (ct == C_TextIn) - return; - ::SetFocus(::GetActiveWindow()); - } - } - -//====================>>> vCommandPane::DynamicDlgProc <<<================== - int vCommandPane::DynamicDlgProc(HWND hDlg, UINT uMsg, - WPARAM wParam, LPARAM lParam) - { - // This uses Microsoft Message crackers, presumably for enhanced - // portability to Win32 and Win95 - int lResult = 0; - - switch (uMsg) - { - - case WM_INITDIALOG: - // Need to do this here so we can use message crackers - _wDialog = hDlg; - (void) HANDLE_WM_INITDIALOG(hDlg, wParam, lParam, OnInitDialog); - lResult = 0; // 0 so won't highlight first control - break; - - case WM_ENABLE: - lResult = HANDLE_WM_ENABLE(hDlg, wParam, lParam, OnEnable); - break; - - case WM_PAINT: - lResult = HANDLE_WM_PAINT(hDlg, wParam, lParam, OnPaint); - break; - - case WM_COMMAND: - - switch (GET_WM_COMMAND_ID(wParam, lParam)) // Have to ignore EN messages - { - case EN_SETFOCUS: -// case EN_KILLFOCUS: - case EN_ERRSPACE: - case EN_HSCROLL: - - case EN_MAXTEXT: - case EN_UPDATE: - case EN_VSCROLL: - return 0; - - } - lResult = HANDLE_WM_COMMAND(hDlg, wParam, lParam, OnCommand); - - break; - - case WM_HSCROLL: - case WM_VSCROLL: - { - - int id = ::GetWindowID(GET_WM_HSCROLL_HWND(wParam, lParam)); - - vCmd* UseThis = (vCmd *) getThisFromId(id); - int code = GET_WM_HSCROLL_CODE(wParam,lParam); - - if (!UseThis || code == SB_ENDSCROLL) - { - return 0; - } - - UseThis->CmdCallback(code, - (WORD)GET_WM_HSCROLL_POS(wParam, lParam)); - return 1; - } - - case WM_CTLCOLORSTATIC: - case WM_CTLCOLOREDIT: - case WM_CTLCOLORBTN: - ::SetBkColor(GET_WM_CTLCOLOR_HDC(wParam, lParam, uMsg), - ::GetSysColor(COLOR_BTNFACE)); - return (int)(theApp->_BarBrush); - - case WM_CTLCOLORDLG: - return (int )(theApp->_BarBrush); - - case WM_MEASUREITEM: - { - ItemVal mid = (ItemVal)GET_WM_COMMAND_ID(wParam, lParam); - vCmd* UseThis = (vCmd *) getThisFromId(mid); - if (!UseThis) - { - lResult = 0; break; - } - return UseThis->MEASUREITEM((int)mid, (MEASUREITEMSTRUCT*)lParam); - } - - case WM_DRAWITEM: - { - ItemVal did = (ItemVal)GET_WM_COMMAND_ID(wParam, lParam); - vCmd* UseThis = (vCmd *) getThisFromId(did); - if (!UseThis) - { - lResult = 0; break; - } - return UseThis->DRAWITEM((int)did, (DRAWITEMSTRUCT*)lParam); - } - - } - return lResult; -} diff --git a/v/srcwin/vcmdprnt.cpp b/v/srcwin/vcmdprnt.cpp deleted file mode 100644 index 135992c..0000000 --- a/v/srcwin/vcmdprnt.cpp +++ /dev/null @@ -1,785 +0,0 @@ -//=============================================================== -// vcmdprnt.cxx - vCmdParent Class - Windows -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include // our include - -#include // ButtonCmd -#include // ColorButtonCmd -#include // Color label -#include // LabelCmd -#include // FrameCmd -#include // CheckBoxCmd -#include // RadioButtonCmd -#include // TextInCmd -#include // TextCmd -#include // ListCmd -#include // ComboBoxCmd -#include // SpinnerCmd -#include // SliderCmd -#include // ProgressCmd -#include // BoxedLabel - -#define NWORD DWORD - -// --------------------------------------------------------------------- -// Dynamic Dialog Building Support -// --------------------------------------------------------------------- - -#include - -#define DIALOG_CHAR WORD - - typedef struct - { - short int PointSize; // point size if DS_SETFONT - // char szTypeFace[]; // typeface name - } FONTINFO, FAR *LPFONTINFO; - - const int _CtrlSpacing = 2; - -//======================>>> vCmdParent::vCmdParent <<<=========================== - static void CopyStringToDialog (LPSTR *inp, LPCSTR src) - { - DIALOG_CHAR FAR *in = (DIALOG_CHAR FAR * )(*inp); - - do - { - *in++ = (DIALOG_CHAR) *src; - } while (*src++); - - *inp = (char *)in; - } - -//======================>>> vCmdParent::vCmdParent <<<============================ - vCmdParent::vCmdParent(PaneType pt) - { - _cmdList = 0; - maxX = 0; // minimum size for a dialog - maxY = 0; - if (pt == P_Status) - { - maxX = 4; // give some room at left for drawing box - maxY = 4; - } - - _callbackID = -1; // no call back id - - _pt = pt; - } - -//======================>>> vCmdParent::~vCmdParent <<<============================ - vCmdParent::~vCmdParent() - { - SysDebug(Destructor,"vCmdParent::~vCmdParent() destructor\n") - - // need to delete everything we added - - DlgCmdList* tmp; - - if (_hTemplate != 0) - { - ::GlobalFree(_hTemplate); - _hTemplate = 0; - } - - for (DlgCmdList* cc = _cmdList ; cc != 0 ; ) - { - delete cc->cmdP; // delete the cmd object - tmp = cc; // don't forget where we were - cc = cc->nextDCL; // for next time - delete tmp; // delete the list cell - } - } - -//======================>>> vCmdParent::AddCmd <<<============================ - vCmd* vCmdParent::AddCmd(CommandObject* cmd) - { - // Private method to add a single command to a dialog object. - - SysDebug2(Build,"vCmdParent::AddCmd() - %s(id:%d)\n",cmd->title,cmd->cmdId) - - vCmd* cmdPtr; - - switch (cmd->cmdType) // depends on type - { - case C_IconButton: // a command button Icon - case C_ToggleButton: // a toggle icon button - case C_ToggleIconButton: // a toggle icon button - case C_Button: // Button - { - cmdPtr = new vButtonCmd(this, cmd); - break; - } - - case C_ColorButton: // ColorButton - { - cmdPtr = new vColorButtonCmd(this, cmd); - break; - } - - case C_ColorLabel: // ColorButton - { - cmdPtr = new vColorLabelCmd(this, cmd); - break; - } - - case C_CheckBox: // Checked Item - { - cmdPtr = new vCheckBoxCmd(this, cmd); - break; - } - - case C_ComboBox: // Popup combo list - { - cmdPtr = new vComboBoxCmd(this, cmd); - break; - } - - case C_Frame: // General purpose frame - case C_ToggleFrame: // A toggle frame - { - cmdPtr = new vFrameCmd(this, cmd); - break; - } - - case C_Icon: // a display only Icon - case C_Blank: // to help RightOfs, Belows work - case C_Label: // Regular text label - { - cmdPtr = new vLabelCmd(this, cmd); - break; - } - - case C_List: // List of items (scrollable) - { - cmdPtr = new vListCmd(this, cmd); - break; - } - - - case C_ProgressBar: // Progress bar - { - cmdPtr = new vProgressCmd(this, cmd); - break; - } - - case C_RadioButton: // radio button - { - cmdPtr = new vRadioButtonCmd(this, cmd); - break; - } - - case C_Slider: // slider - { - cmdPtr = new vSliderCmd(this, cmd); - break; - } - - case C_BoxedLabel: - { - cmdPtr = new vBoxedLabelCmd(this, cmd); - break; - } - - case C_Text: // Text output field - { - cmdPtr = new vTextCmd(this, cmd); - break; - } - - case C_TextIn: // Text input field - { - cmdPtr = new vTextInCmd(this, cmd); - break; - } - - case C_Spinner: // Value Box list - { - cmdPtr = new vSpinnerCmd(this, cmd); - break; - } - - default: // unknown! - { - SysDebug2(BadVals,"vCmdParent::AddCmd(id:%d, title:%s) ** Unknown DialogCommand\n",cmd->cmdId,cmd->title); - cmd->title = "?? Bad CommandObject ??"; - cmdPtr = new vLabelCmd(this, cmd); - break; - } - } - - return cmdPtr; - } - -//====================>>> vCmdParent::HasId <<<========================= - int vCmdParent::HasId(ItemVal id) VCONST - { - // We need this one for panes to work correctly - - for (DlgCmdList* cc = _cmdList ; cc != 0 ; cc = cc->nextDCL) - { - if (((cc->cmdP)->dlgCmd)->cmdId == id) - { - return 1; - } - } - return 0; - } - -//====================>>> vCmdParent::GetValue <<<========================= - int vCmdParent::GetValue(ItemVal id) VCONST - { - for (DlgCmdList* cc = _cmdList ; cc != 0 ; cc = cc->nextDCL) - { - if (((cc->cmdP)->dlgCmd)->cmdId == id) - { - return (cc->cmdP)->GetCmdValue(id); // return the value - } - } - return 0; - } - -//====================>>> vCmdParent::SetFrameChildren <<<====================== - void vCmdParent::SetFrameChildren(ItemVal frameId, int frameVal) - { - // Set all children of given frame to hidden or not hidden - // Do this recursively to be sure to get them all. - - // Scan list, setting all children that use this frame - - for (DlgCmdList* cc = _cmdList ; cc != 0 ; cc = cc->nextDCL) // Find the frame - { - CommandObject* cop = (cc->cmdP)->dlgCmd; - if (cop->cFrame == frameId) // A child of ours - { - // Hide control if not turning on (frameVal is opposite of Hidden) - SetValue(cop->cmdId, !frameVal, Hidden); - if (cop->cmdType == C_Frame || cop->cmdType == C_ToggleFrame) - SetFrameChildren(cop->cmdId, frameVal); // Get other chilren - } - } - } - -//====================>>> vCmdParent::GetTextIn <<<========================= - int vCmdParent::GetTextIn(ItemVal id, char* strout, int maxlen) - { - // recover the string from TextIn id, up to maxlen - for (DlgCmdList* cc = _cmdList ; cc != 0 ; cc = cc->nextDCL) - { - if (((cc->cmdP)->dlgCmd)->cmdId == id) - { - // need to cast to a vTextInCmd so we can use getstr - vTextInCmd* tip = (vTextInCmd*) cc->cmdP; - - return tip->GetTextIn(id, strout, maxlen); // return the value - } - } - - *strout = 0; - return 0; - } - -//====================>>> vCmdParent::getParent <<<======================= - HWND vCmdParent::getParent(void) VCONST - { - // Return parent's HWND - - return _wDialog; - } - -//==================>>> vCmdParent::getThisFromId <<<======================= - vCmd* vCmdParent::getThisFromId(ItemVal find_id) - { - // search the list of cmds for id, return its this - - DlgCmdList* cc; - - // search the list - for (cc = _cmdList; cc != NULL ; cc = cc->nextDCL) - { - if (cc->cmdP == NULL || (cc->cmdP)->dlgCmd == NULL) - return 0; - if (((cc->cmdP)->dlgCmd)->cmdId == find_id) - { - return cc->cmdP; - } - } - - return 0; // failed to find it - } - -//====================>>> vCmdParent::SetPosition <<<========================= - void vCmdParent::SetPosition(int& x, int& y, int w, int h, ItemVal frame, - ItemVal rightOf, ItemVal below, int isSpinner) - { - // This method is responsible for controlling the layout of controls in - // a dialog. All positions of controls are set relative to other controls, - // which must have been previously defined (i.e., you start with the upper - // left control and work to the lower right corner). It must dynamically - // set the size of frames, and track the maximum x and y of the whole - // dialog. - - int margin = _CtrlSpacing; // spacing between controls - vCmd* frameCmd = 0; - - if (!isSpinner) // leave spinners alone - x = y = margin; // start out with standard spacing - - - if (frame != 0) // in a frame? - { - for (DlgCmdList* cc = _cmdList ; cc != 0 ; cc = cc->nextDCL) - { - if ((cc->cmdP) == 0 || (cc->cmdP)->dlgCmd == 0) // not completely added yet! - continue; - if (((cc->cmdP)->dlgCmd)->cmdId == frame) - { - frameCmd = cc->cmdP; // remember our frame - if ((frameCmd->dlgCmd)->attrs & CA_NoSpace) - margin = 0; - if (isSpinner) // just finding frame - break; - if (rightOf == 0) - { - x = (cc->cmdP)->_x + margin; // add to right of frame - if ((frameCmd->dlgCmd)->attrs & CA_NoSpace) - ++x; // adjust for right side BEW 1.21 - } - else - x = margin; - - if (below == 0) - { - y = (cc->cmdP)->_y + margin; - if ((frameCmd->dlgCmd)->attrs & CA_NoSpace) - ++y; // adjust for bottom BEW 1.21 - } - else - y = margin; - } - } - } - - if (isSpinner) - x = x; - else if (_dialogType == aCmdBar && frame == 0) - { - x = maxX + margin; - y = margin; - } - else if (_dialogType == aStatBar && frame == 0) - { - x = maxX + margin; - y = margin + 1; - } - else // dialog/frame positioning - { - for (DlgCmdList* cc = _cmdList ; cc != 0 ; cc = cc->nextDCL) - { - if ((cc->cmdP) == 0 || (cc->cmdP)->dlgCmd == 0) // not completely added yet! - continue; - - if (((cc->cmdP)->dlgCmd)->cmdId == rightOf) - { - x += ((cc->cmdP)->_x) + ((cc->cmdP)->_w); // add to right of the right of - } - if (((cc->cmdP)->dlgCmd)->cmdId == below) - { - y += ((cc->cmdP)->_y) + ((cc->cmdP)->_h); // add to below of the below of - } - } - } - - int cxr = x + w; // right x of control - int cyb = y + h; // bottom y of control - - if (maxX < cxr) // track size of the dialog - maxX = cxr; - if (maxY < cyb) - maxY = cyb; - - if (frameCmd) // need to fixup frame - { - FixFrame(cxr, cyb, margin, frameCmd); // fixup frames - } - } - -//====================>>> vCmdParent::FixFrame <<<======================= - void vCmdParent::FixFrame(int cxr, int cyb, int margin, vCmd* frameCmd) - { - - int fxr = frameCmd->_x + frameCmd->_w; // right x of frame - int fyb = frameCmd->_y + frameCmd->_h; // bottom y of frame - - if (fxr < cxr + margin) // need to make frame wider - { - frameCmd->_w = cxr - frameCmd->_x + margin; - if (margin == 0) - ++(frameCmd->_w); // make nospace look right BEW 1.21 - } - if (fyb < cyb + margin) // need to make frame taller - { - frameCmd->_h = cyb - frameCmd->_y + margin; - if (margin == 0) - ++(frameCmd->_h); // make nospace look right BEW 1.21 - } - - // Now possibly fixup the dialog size - if (maxX < frameCmd->_x + frameCmd->_w) - maxX = frameCmd->_x + frameCmd->_w; - if (maxY < frameCmd->_y + frameCmd->_h) - maxY = frameCmd->_y + frameCmd->_h; - - // Now fixup the dialog template - - if (frameCmd->_CtrlOffset != 0) - { - WORD FAR *wNumBytes; - LPDLGITEMTEMPLATE lpDlgItemTemplate; - - // wNumBytes points to beginning of memory block. - wNumBytes = (WORD FAR *) ::GlobalLock(_hTemplate); - - // lpDlgItemTemplate points to start of new DLGITEMTEMPLATE. - - lpDlgItemTemplate = (LPDLGITEMTEMPLATE) - (((LPSTR) wNumBytes) + frameCmd->_CtrlOffset); - - // Fix the width - lpDlgItemTemplate->cx = frameCmd->_w; - lpDlgItemTemplate->cy = frameCmd->_h; - ::GlobalUnlock(_hTemplate); - } - - // Now, fixup surrounding frames! - int frame = (frameCmd->dlgCmd)->cFrame; - if (frame != 0) // Have to fix frame's frame - { - for (DlgCmdList* cc = _cmdList ; cc != 0 ; cc = cc->nextDCL) - { - if ((cc->cmdP) == 0 || (cc->cmdP)->dlgCmd == 0) // not completely added yet! - continue; - if (((cc->cmdP)->dlgCmd)->cmdId == frame) - { - vCmd* fCmd = cc->cmdP; // remember frame's frame - fxr = frameCmd->_x + frameCmd->_w; // right x of frame - fyb = frameCmd->_y + frameCmd->_h; // bottom y of frame - FixFrame(fxr,fyb,_CtrlSpacing,fCmd); - break; - } - } - } - } - -//====================>>> vCmdParent::SetValue <<<======================= - void vCmdParent::SetValue(ItemVal id, ItemVal val, ItemSetType setType) - { - - SysDebug2(Misc,"vCmdParent::SetValue(id:%d, val:%d)\n",id,val) - - for (DlgCmdList* cc = _cmdList ; cc != 0 ; cc = cc->nextDCL) - { - if (((cc->cmdP)->dlgCmd)->cmdId == id) - { - (cc->cmdP)->SetCmdVal(val,setType); // return the value - return; - } - } - } - -//====================>>> vCmdParent::SetString <<<======================= - void vCmdParent::SetString(ItemVal id, VCONST char* str) - { - - SysDebug2(Misc,"vCmdParent::SetString(id:%d, str:%s)\n",id,str) - - for (DlgCmdList* cc = _cmdList ; cc != 0 ; cc = cc->nextDCL) - { - if (((cc->cmdP)->dlgCmd)->cmdId == id) - { - (cc->cmdP)->SetCmdStr(str); // return the value - return; - } - } - - } - - -//====================>>> vCmdParent::CreateDlgTemplate <<<================== - int vCmdParent::CreateDlgTemplate( - LONG dtStyle, // dialog style - int dtX, int dtY, // location, In dialog-box units - int dtCX, int dtCY, // size, in dialog-box units - LPSTR dtMenuName, // "" if no menu - LPSTR dtClassName, // "" if standard dialog box class - LPSTR dtCaption, // caption for dialog - short int PointSize, // Only used if DS_SETFONT specified - LPSTR szTypeFace) // Only used if DS_SETFONT specified - { - NWORD wBlockLen, FAR *wNumBytes; - NWORD wMenuNameLen, wClassNameLen, - wCaptionLen, wTypeFaceLen; - LPSTR szDlgTemplate, szDlgTypeFace; - LPDLGTEMPLATE lpDlgTemplate; - LPFONTINFO lpFontInfo; - - // Calculate number of bytes required by following fields: - wMenuNameLen = (1 + lstrlen(dtMenuName)) * sizeof(DIALOG_CHAR); - wClassNameLen = (1 + lstrlen(dtClassName))* sizeof(DIALOG_CHAR); - wCaptionLen = (1 + lstrlen(dtCaption)) * sizeof(DIALOG_CHAR); - - // Block must be large enough to contain the following: - wBlockLen = - sizeof(NWORD) + // Stores # of bytes used in block. - sizeof(DLGTEMPLATE) + // # bytes: fixed part DLGTEMPLATE. - wMenuNameLen + // # bytes: menu name. - wClassNameLen + // # bytes: dialog class name. - wCaptionLen; // # bytes: dialog box caption. - - /* These blocks have to be aligned on DWORD boundaries */ - wBlockLen = ((wBlockLen + 3) & ~3); - - if (dtStyle & DS_SETFONT) - { - // Dialog box uses font other that System font. - - // Calculate # of bytes required for typeface name. - wTypeFaceLen = (1 + lstrlen(szTypeFace))* sizeof (DIALOG_CHAR); - - - // Block must be large enough to include font information. - wBlockLen += - sizeof(short int) + // # bytes for font's point size. - wTypeFaceLen; // # bytes for font typeface name. - - } - else - { - // Dialog box uses the System font. - wTypeFaceLen = 0; - - // Block length does not change. - } - - // Allocate global block of memory for Dialog template. - _hTemplate = ::GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, wBlockLen); - if (_hTemplate == NULL) - return 0; - - // wNumBytes points to beginning of memory block. - wNumBytes = (NWORD FAR *) ::GlobalLock(_hTemplate); - - // Store in first two bytes the # of bytes used in the block. - *wNumBytes = (NWORD) wBlockLen; - - // lpDlgTemplate points to start of DLGTEMPLATE in block. - lpDlgTemplate = (LPDLGTEMPLATE) (wNumBytes + 1); - - // Set the members of the DLGTEMPLATE structure. - lpDlgTemplate->style = dtStyle; - lpDlgTemplate->dwExtendedStyle = 0; - lpDlgTemplate->cdit = 0; // Incremented with calls - - // to AddDlgControl. - lpDlgTemplate->x = dtX; lpDlgTemplate->y = dtY; - lpDlgTemplate->cx = dtCX; lpDlgTemplate->cy = dtCY; - - // szDlgTemplate points to start of variable, part of DLGTEMPLATE. - szDlgTemplate = (LPSTR) (lpDlgTemplate + 1); - - CopyStringToDialog(&szDlgTemplate, dtMenuName) ; - CopyStringToDialog(&szDlgTemplate, dtClassName); - CopyStringToDialog(&szDlgTemplate, dtCaption); - - if (dtStyle & DS_SETFONT) - { - // Dialog box uses font other that System font. - - // lpFontInfo points to start of FONTINFO structure. - lpFontInfo = (LPFONTINFO) szDlgTemplate; - - // Set the members of the FONTINFO structure. - lpFontInfo->PointSize = PointSize; - - // szTypeFace points to start of variable part of FONTINFO. - szDlgTypeFace = (LPSTR) (lpFontInfo + 1); - - // Append the typeface name to the block. - CopyStringToDialog(&szDlgTypeFace, szTypeFace); - } -#ifdef NEED_TO_HANDLE_NOFONT - // Since font not specified, don't need to fill this - // part in. Has a bug - overwrites memory anwway. - else - { - // lpFontInfo points to start of FONTINFO structure. - lpFontInfo = (LPFONTINFO) szDlgTemplate; - - // Set the members of the FONTINFO structure. - lpFontInfo->PointSize = 0; - - // szTypeFace points to start of variable part of FONTINFO. - szDlgTypeFace = (LPSTR) (lpFontInfo + 1); - - // Append the typeface name to the block. - CopyStringToDialog(&szDlgTypeFace, ""); - } -#endif - - ::GlobalUnlock(_hTemplate); - return 1; // success - } - -//====================>>> vCmdParent::AddDlgControl <<<===================== - int vCmdParent::AddDlgControl ( - int dtilX, int dtilY, // In dialog-box units. - int dtilCX, int dtilCY, // In dialog-box units. - int dtilID, - long dtilStyle, // WS_CHILD is automatically added. - LPSTR dtilClass, // Class name - LPCSTR dtilText, // label - BYTE dtilInfo, // Number of additional data bytes. - LPBYTE dtilData) // Value passed through lpCreateParams of CREATESTRUCT. - { - -#define NEXTRA_SIZE WORD - HGLOBAL hGlblNew; - NWORD wBlockLen, wClassLen, wTextLen, FAR *wNumBytes; - - - LPDLGTEMPLATE lpDlgTemplate; - LPDLGITEMTEMPLATE lpDlgItemTemplate; - LPSTR szDlgItemTemplate; - int CtrlOffset = 0; // Offset of this control - - // Calculate number of bytes required by following fields: - wClassLen = (1 + lstrlen(dtilClass)) * sizeof (DIALOG_CHAR); - wTextLen = (1 + lstrlen(dtilText)) * sizeof (DIALOG_CHAR); - - // Block must be increased by to contain the following: - wBlockLen = - sizeof(DLGITEMTEMPLATE) + // # bytes for fixed part of DLGITEMTEMPLATE. - wClassLen + // # bytes for control class. - wTextLen + // # bytes for control text. - sizeof(NEXTRA_SIZE) + // # bytes of dtilInfo (below). - dtilInfo; // # bytes for extra data. - - /* These blocks have to be aligned on DWORD boundaries */ - wBlockLen = ((wBlockLen + 3) & ~3); - // Guarantee that all controls have WS_CHILD style. - dtilStyle |= WS_CHILD; - - // Get number of bytes currently in the memory block. - wBlockLen += * (NWORD FAR *) ::GlobalLock(_hTemplate); - - ::GlobalUnlock(_hTemplate); - - // Increase size of memory block to include new dialog item. - hGlblNew = ::GlobalReAlloc(_hTemplate, wBlockLen, - GMEM_MOVEABLE | GMEM_ZEROINIT); - - if (hGlblNew == NULL) // Fail? - return 0; - - _hTemplate = hGlblNew; - - // wNumBytes points to beginning of memory block. - wNumBytes = (NWORD FAR *) ::GlobalLock(_hTemplate); - - // lpDlgTemplate points to start of DLGTEMPLATE in block. - lpDlgTemplate = (LPDLGTEMPLATE) (wNumBytes + 1); - - // Increment the number of controls in the template. - lpDlgTemplate->cdit++; - - // lpDlgItemTemplate points to start of new DLGITEMTEMPLATE. - // This is at the end of the memory block. - lpDlgItemTemplate = (LPDLGITEMTEMPLATE) (((LPSTR) wNumBytes) + *wNumBytes); - CtrlOffset = *wNumBytes; - - if (((int)lpDlgItemTemplate) &3) - vSysError("Can't build dialog template."); - - // Set the members of the DLGITEMTEMPLATE structure. - lpDlgItemTemplate->x = dtilX; - lpDlgItemTemplate->y = dtilY; - lpDlgItemTemplate->cx = dtilCX; - // We have to handle comboboxes specially because the - // height needed here is the combobox PLUS its list, while - // the hieght we want to use internally is the height WITHOUT the list - if (strcmp(dtilClass, "COMBOBOX") == 0) // Combo? - lpDlgItemTemplate->cy = dtilCY + 8*6; - else - lpDlgItemTemplate->cy = dtilCY; - lpDlgItemTemplate->id = dtilID; - lpDlgItemTemplate->style = dtilStyle; - - // szDlgTemplate points to start of variable part of DLGITEMTEMPLATE. - szDlgItemTemplate = (LPSTR) (lpDlgItemTemplate + 1); - - // Append the control's class name, text to the block. - - CopyStringToDialog (&szDlgItemTemplate, dtilClass); - CopyStringToDialog (&szDlgItemTemplate, dtilText); - - - // Append the control's dtilInfo member. - *(NEXTRA_SIZE FAR *)szDlgItemTemplate = dtilInfo; - szDlgItemTemplate += sizeof(NEXTRA_SIZE); - - // Append the control's dtilData member. - _fmemcpy(szDlgItemTemplate, dtilData, dtilInfo); - szDlgItemTemplate += dtilInfo; - - - // Store in the first two bytes the # of bytes used in block. - *wNumBytes = wBlockLen; - - ::GlobalUnlock(_hTemplate); - return CtrlOffset; - } - -//==================>>> vCmdParent::DoneAddingControls <<<=================== - void vCmdParent::DoneAddingControls(void) - { - NWORD FAR *wNumBytes; - LPDLGTEMPLATE lpDlgTemplate; - - // wNumBytes points to beginning of memory block. - wNumBytes = (NWORD FAR *) ::GlobalLock(_hTemplate); - - // lpDlgTemplate points to start of DLGTEMPLATE in block. - lpDlgTemplate = (LPDLGTEMPLATE) (wNumBytes + 1); - - // Fixup size - maxX = lpDlgTemplate->cx = maxX + _CtrlSpacing; -// if (_dialogType == aCmdBar) -// maxY = lpDlgTemplate->cy = maxY + 1; -// else - maxY = lpDlgTemplate->cy = maxY + _CtrlSpacing; - - // Move all of the bytes in the block down byte the NWORD. - char FAR *dst = (char FAR *)wNumBytes; - char FAR *src = (char FAR *)(wNumBytes + 1); - int len = *wNumBytes - sizeof(NWORD); - while (len) - { - *dst++ = *src++; - len --; - } - ::GlobalUnlock(_hTemplate); - - // Once this function is executed, no more items can be - // added to the dialog box template. - } - -// --------------------------------------------------------------------- diff --git a/v/srcwin/vcmdwin.cpp b/v/srcwin/vcmdwin.cpp deleted file mode 100644 index 5dc816e..0000000 --- a/v/srcwin/vcmdwin.cpp +++ /dev/null @@ -1,83 +0,0 @@ -//=============================================================== -// vCmdWin.cxx - vCmdWindow class functions - X11R5 AND Windows -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include // our header -#include // we have panes - -#include - -// Define static data of the class - - int vCmdWindow::_numCmdWindows = 0; - vCmdWindow* vCmdWindow::CmdWins = 0; // no command windows to start - -//====================>>> vCmdWindow::vCmdWindow <<<======================= - vCmdWindow::vCmdWindow(VCONST char *name, int width, int height ) : - vWindow(name, width, height, CMDWINDOW) - { - // make widgets null - - SysDebug(Constructor,"vCmdWindow::vCmdWindow() constructor\n") - - destroyed = 0; // we haven't been destroyed - - NextCmdWin = CmdWins; // link in to list of cmdwindows - CmdWins = this; // put on front of the list - ++_numCmdWindows; // bump how many windows up - } - -//====================>>> vCmdWindow::~vCmdWindow <<<======================= - vCmdWindow::~vCmdWindow() // destructor - { - - SysDebug(Destructor,"vCmdWindow::~vCmdWindow() destructor\n") - - } - -//============================>>> vCmdWindow::CloseWin <<<=================== - void vCmdWindow::CloseWin(void) - { - // close button class callback - - vCmdWindow* cw_list; - - SysDebug(Build,"vCmdWindow::CloseWin()\n"); - - --_numCmdWindows; // windows down by one - // Remove from active list - if (CmdWins == this) // first one on list - { - CmdWins = CmdWins->NextCmdWin; // point to next - } - else - { - for (cw_list = CmdWins ; cw_list != 0 ; cw_list = cw_list->NextCmdWin) - { - if (cw_list->NextCmdWin == this) - { - // remove from list - cw_list->NextCmdWin = (cw_list->NextCmdWin)->NextCmdWin; - break; - } - } - } - - vWindow::CloseWin(); // Close Stuff in parent - if (CmdWins == 0) // last one? - { - theApp->selectCmdPanes(0); // turn off all command panes - // following added 25Aug99 after input from brad@cs.unt.edu - // to force menu bar to be correctly updated. - ::DrawMenuBar(theApp->winHwnd()); - theApp->CloseLastCmdWindow(this,0); - } - } diff --git a/v/srcwin/vcolor.cpp b/v/srcwin/vcolor.cpp deleted file mode 100644 index ee67026..0000000 --- a/v/srcwin/vcolor.cpp +++ /dev/null @@ -1,133 +0,0 @@ -//=============================================================== -// vcolor.cxx: vColor class for drawing - Windows -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include -#include - - // Define 16 standard colors for use by everyone - - vColor vGlobalStdColors[16] = - { - vColor( 0, 0, 0), // vC_Black - vColor( 255, 0, 0), // vC_Red - vColor( 127, 0, 0), // vC_DimRed - vColor( 0, 255, 0), // vC_Green - vColor( 0, 127, 0), // vC_DimGreen - vColor( 0, 0, 255), // vC_Blue - vColor( 0, 0, 127), // vC_DimBlue - vColor( 255, 255, 0), // vC_Yellow - vColor( 127, 127, 0), // vC_DimYellow - vColor( 255, 0, 255), // vC_Magenta - vColor( 127, 0, 127), // vC_DimMagenta - vColor( 0, 255, 255), // vC_Cyan - vColor( 0, 127, 127), // vC_DimCyan - vColor( 63, 63, 63), // vC_DarkGray - vColor( 127, 127, 127), // vC_MedGray - vColor( 255, 255, 255) // vC_White - }; - - char* vGlobalColorNames[16] = - { - "Black", "Red", "Dim Red", "Green", "Dim Green", "Blue", - "Dim Blue", "Yellow", "Dim Yellow", "Magenta", "Dim Magenta", - "Cyan", "Dim Cyan", "Dark Gray", "Med Gray", "White" - }; - - -// Following added in 1.21 for DLL -//=======================>>> vGetStdColors <<<=========================== -vColor* vGetStdColors() -{ - return &vGlobalStdColors[0]; -} - -//=======================>>> vGetColorNames <<<=========================== -char** vGetColorNames() -{ - return &vGlobalColorNames[0]; -} - -//=======================>>> vColor::vColor <<<=========================== - vColor::vColor(unsigned int rd, unsigned int gr, unsigned int bl) - { - _r = (unsigned char) rd; - _g = (unsigned char) gr; - _b = (unsigned char) bl; - _pixel = RGB(_r,_g,_b); - } - -//=======================>>> vColor::BitsOfColor <<<=========================== - int vColor::BitsOfColor() VCONST - { - - HDC hdc = ::GetDC(theApp->winHwnd()); - int bits = ::GetDeviceCaps(hdc,BITSPIXEL); - ::ReleaseDC(theApp->winHwnd(),hdc); - return bits; - } - -//=======================>>> vColor::ResetColor <<<=========================== - void vColor::ResetColor(unsigned int rd, unsigned int gr, unsigned int bl) - { - _r = (unsigned char) rd; - _g = (unsigned char) gr; - _b = (unsigned char) bl; - _pixel = RGB(_r,_g,_b); - } - -//=======================>>> vColor::ResetColor <<<=========================== - void vColor::ResetColor(VCONST vColor& c) - { - _r = c.r(); - _g = c.g(); - _b = c.b(); - _pixel = RGB(_r,_g,_b); - } - -//=======================>>> vColor::Set <<<=========================== - void vColor::Set(unsigned int rd, unsigned int gr, unsigned int bl) - { - _r = (unsigned char) rd; - _g = (unsigned char) gr; - _b = (unsigned char) bl; - _pixel = RGB(_r,_g,_b); - } - -//=======================>>> vColor::Set <<<=========================== - void vColor::Set(VCONST vColor& c) - { - _r = c.r(); - _g = c.g(); - _b = c.b(); - _pixel = RGB(_r,_g,_b); - } - -//=======================>>> vColor::SetR <<<=========================== - void vColor::SetR(unsigned int rd) - { - _r = (unsigned char) rd; - _pixel = RGB(_r,_g,_b); - } - -//=======================>>> vColor::SetG <<<=========================== - void vColor::SetG(unsigned int gr) - { - _g = (unsigned char) gr; - _pixel = RGB(_r,_g,_b); - } - -//=======================>>> vColor::SetB <<<=========================== - void vColor::SetB(unsigned int bl) - { - _b = (unsigned char) bl; - _pixel = RGB(_r,_g,_b); - } diff --git a/v/srcwin/vcomboc.cpp b/v/srcwin/vcomboc.cpp deleted file mode 100644 index 5823113..0000000 --- a/v/srcwin/vcomboc.cpp +++ /dev/null @@ -1,204 +0,0 @@ -//=============================================================== -// vcomboc.cxx - vComboBoxCmd - Windows -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include // our definitions -#include // a command parent -#include -#include - - -//=================>>> vComboBoxCmd::vComboBoxCmd <<<======================= - vComboBoxCmd::vComboBoxCmd(vCmdParent* dp, CommandObject* dc) : - vCmd(dp, dc) - { - SysDebug(Constructor,"vComboBoxCmd::vComboBoxCmd() constructor\n") - - CopyToLocal(); // Make local copies of CmdObject - - // First, setup the list - _maxWidth = 10; - - SetupComboList(); - - _maxWidth = (dlgCmd->attrs & CA_Large) ? (_maxWidth * 3)/2 - : _maxWidth; - - long style = (_parentWin->_dialogType != aCmdBar) - ? WS_TABSTOP | WS_GROUP - : WS_GROUP; - - - if (!(dlgCmd->attrs & CA_Hidden)) // Check for Hidden - style |= WS_VISIBLE; - - style |= CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL; - - _w = _maxWidth*4+10; // set my width - - - _h = 14; // 14 is std height for combo without list - - - _parentWin->SetPosition(_x, _y, _w, _h, dlgCmd->cFrame, dlgCmd->cRightOf, - dlgCmd->cBelow); - - _CtrlOffset = _parentWin->AddDlgControl(_x, _y, _w, _h, _cmdId, - style, "COMBOBOX", _title, sizeof(vCmd*), (LPBYTE)this); - } - -//=======================>>> vComboBoxCmd::~vComboBoxCmd <<<======================= - vComboBoxCmd::~vComboBoxCmd() - { - - SysDebug(Constructor,"vComboBoxCmd::~vComboBoxCmd() Constructor\n") - - } - -//==================>>> vComboBoxCmd::GetCmdValue <<<========================= - int vComboBoxCmd::GetCmdValue(ItemVal id) VCONST - { - if (id != _cmdId) - return -1; - return _curSelection; - } - -//=====================>>> vComboBoxCmd::SetCmdVal <<<========================= - void vComboBoxCmd::SetCmdVal(ItemVal val, ItemSetType st) - { - - SysDebug2(Misc,"vComboBoxCmd::SetCmdVal(val:%d, type:%d)\n",val,st) - HWND myHwnd = GetMyHwnd(_cmdId); - - if (st == ChangeList || st == ChangeListPtr) - { - if (st == ChangeListPtr) - _itemList = dlgCmd->itemList; - // Change list is used both for initial display, - // and when user changes the list. - ::SendDlgItemMessage(_parentWin->getParent(), - _cmdId, CB_RESETCONTENT,0,0); // Clear current - - int oldMax = _maxWidth; // track current max width - - SetupComboList(); // resetup the list - if (oldMax > _maxWidth) - _maxWidth = oldMax; // don't let it get narrower - for (int ixx = 0 ; ixx < _numItems ; ++ixx) - { - // Add each item to the list - ::SendDlgItemMessage(_parentWin->getParent(),_cmdId, - CB_INSERTSTRING,ixx,(LPARAM)_fullList[ixx]); - } - // Need to set to insensitive if it is set insensitive - if (!_Sensitive) - { - ::EnableWindow(myHwnd, 0); - } - if (dlgCmd->attrs & CA_Hidden) - { - ::ShowWindow(myHwnd,SW_HIDE); - } - _curSelection = val; - ::SendDlgItemMessage(_parentWin->getParent(), - _cmdId, CB_SETCURSEL,_curSelection,0); - - return; - } - else if (st == Hidden) // hide or unhide - { - if (val) - { - ::ShowWindow(myHwnd,SW_HIDE); - } - else - { - ::ShowWindow(myHwnd,SW_SHOW); - } - } - else if (st == Value) - { - if (val >= _numItems ) - return; - - _curSelection = val; // change the current value - if (val < 0) // unselect - { - _curSelection = -1; - return; - } - // Now set appropriate _curSelection - // in windows, -1 means unselect, so this works for both - _retVal = _curSelection; - - ::SendDlgItemMessage(_parentWin->getParent(), - _cmdId, CB_SETCURSEL,_curSelection,0); - } - else if (st == Sensitive) - { - _Sensitive = val; // set - ::EnableWindow(myHwnd, val); - } - } - -//===================>>> vComboBoxCmd::CmdCallback <<<======================= - void vComboBoxCmd::CmdCallback(int /* id */, WORD codeNotify) - { - // See if we are getting a message we care about - - if (codeNotify != CBN_SELCHANGE) - return; - - // Retrieve the current selection - if ((_curSelection = ::SendDlgItemMessage(_parentWin->getParent(), - _cmdId, CB_GETCURSEL,0,0)) == LB_ERR) - { - _curSelection = -1; - return; - } - - if (_curSelection >= _numItems ) // Safety check - _curSelection = -1; - - if (!(dlgCmd->attrs & CA_NoNotify)) // Notify on each selection? - _parentWin->ProcessCmd(_cmdId, _curSelection, dlgCmd->cmdType); - } - -//====================>>> vComboBoxCmd::SetupComboList <<<======================= - void vComboBoxCmd::SetupComboList(void) - { - // Set up the list for use - - int len; - - _curSelection = -1; - - _fullList = (char**)_itemList; // private copy of list - - // Calculate widest item and number of items - for ( _numItems = 0 ; _fullList[_numItems] != 0 ; ++_numItems) - { - len = strlen(_fullList[_numItems]); // strlen - if (len > _maxWidth) - _maxWidth = len; // track largest so far - } - - _curSelection = _retVal; // the default - - if (_curSelection < 0) // make a safe default choice - _curSelection = 0; - else if (_curSelection >= _numItems) - _curSelection = _numItems - 1; - - // Note that at this point _numItems is how many items are - // in the user supplied list. - - } diff --git a/v/srcwin/vcpdc.cpp b/v/srcwin/vcpdc.cpp deleted file mode 100644 index 6a9389a..0000000 --- a/v/srcwin/vcpdc.cpp +++ /dev/null @@ -1,110 +0,0 @@ -//=============================================================== -// vCanvasPaneDC - a basic canvas for drawing -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - - -#include // for Win 32 stuff - -#include - -#include - -#include // need access to the app -#include // our own canvas widget - -//----------------------------------------------------------------------- - -//================>>> vCanvasPaneDC::vCanvasPaneDC <<<======================== - vCanvasPaneDC::vCanvasPaneDC(vCanvasPane* parentPane) : vWinDC() - { - SysDebug(Constructor,"vCanvasPaneDC::vCanvasPaneDC() constructor\n") - - _parentPane = parentPane; - - _drawWidget = _parentPane->DrawingWindow(); // drawing to this widget - - } - -//================>>> vCanvasPaneDC::~vCanvasPaneDC <<<======================== - vCanvasPaneDC::~vCanvasPaneDC() - { - - SysDebug(Destructor,"vCanvasPaneDC::~vCanvasPaneDC() destructor\n") - - } - -//=====================>>> vCanvasPaneDC::Clear <<<========================== - void vCanvasPaneDC::Clear(void) - { - GetHDC(); // Get a DC to use - ::SetBkColor(_hdc, _canvasBG); - - HBRUSH brush = ::CreateSolidBrush(_canvasBG); - RECT rect; - - ::GetClientRect(_drawWidget, &rect); - - ::FillRect(_hdc, &rect, brush); - - ::DeleteObject(brush); // need to free the resource! - - ReleaseHDC(); // Release the DC - } - -//==================>>> vCanvasPaneDC::ClearRect <<<========================== - void vCanvasPaneDC::ClearRect(int left, int top, int width, int height) - { - // Clear a rectangluar area starting at left,top of width and height - - if (height == 0 || width == 0) - return; - - GetHDC(); // Get a DC to use - ::SetBkColor(_hdc, _canvasBG); - - HBRUSH brush = ::CreateSolidBrush(_canvasBG); - RECT rect; - - rect.top = top; rect.left = left; - rect.bottom = top+height; rect.right = left + width; - - ::FillRect(_hdc, &rect, brush); - ::DeleteObject(brush); // need to free the resource! - - ReleaseHDC(); // Release the DC - } - -//================>>> vCanvasPaneDC::SetBackground <<<========================== - void vCanvasPaneDC::SetBackground(VCONST vColor& color) - { - - _canvasBG = color.pixel(); // retrieve X pixel value - - GetHDC(); - ::SetBkColor(_hdc, _canvasBG); - ReleaseHDC(); - Clear(); - _parentPane->Redraw(0,0,0,0); - - } - -//======================>>> vCanvasPaneDC::SetFont <<<=========================== - void vCanvasPaneDC::SetFont(VCONST vFont& vf) - { - // Change the font associated with this window. - - _font = vf; - - // First, make sure the font is loaded - - _parentPane->FontChanged(_font); // We have changed the font, - // so we may need to do some things - } - diff --git a/v/srcwin/vdebug.cpp b/v/srcwin/vdebug.cpp deleted file mode 100644 index 051d059..0000000 --- a/v/srcwin/vdebug.cpp +++ /dev/null @@ -1,221 +0,0 @@ -//=============================================================== -// vdebug.cxx - vDebugDialog class methods -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include // our header - -// Define static data of the class - -#define dSystem 10 -#define dUser 11 - -#define dCmdEvents 12 -#define dMouseEvents 13 -#define dWindowEvents 14 - -#define dBuild 15 -#define dMisc 16 -#define dBadVals 17 - -#define dConstructor 18 -#define dDestructor 19 -#define dText 30 - -#define dUserApp1 20 -#define dUserApp2 21 -#define dUserApp3 22 - - int SetCommandObject(const int id, const int val, CommandObject* CmdList); - int GetCommandObject(const int id, CommandObject* CmdList); - - static CommandObject DebugDialog[] = - { - {C_Label, 91, 0, "Set Debug Options", - NoList, CA_MainMsg, isSens, 0,0}, - - {C_Blank, 98, 0, " ", NoList,CA_None,isSens,NoFrame,91,0}, - {C_Label, 99, 0, V_Version, NoList,CA_None,isSens,NoFrame,98,0}, - - // A frame around the check boxes - {C_Frame, 92, 0, "", NoList, CA_None, isSens,NoFrame, 0, 91}, - - // note: the id corresponds to the #defines above - {C_CheckBox,10,0,"System Msgs ",NoList,CA_None,isSens,92,0,0}, - {C_CheckBox,11,0,"User Messages ",NoList,CA_None,isSens,92,10,0}, - - {C_CheckBox,12,0,"Command Events",NoList,CA_None,isSens,92,0,10}, - {C_CheckBox,13,0,"Mouse Events ",NoList,CA_None,isSens,92,12,10}, - {C_CheckBox,14,0,"Window Events ",NoList,CA_None,isSens,92,13,10}, - - {C_CheckBox,15,0,"Build Windows ",NoList,CA_None,isSens,92,0,12}, - {C_CheckBox,16,0,"Misc Messages ",NoList,CA_None,isSens,92,15,12}, - {C_CheckBox,17,0,"Illegal Values",NoList,CA_None,isSens,92,16,12}, - - {C_CheckBox,18,0,"Constructors ",NoList,CA_None,isSens,92,0,15}, - {C_CheckBox,19,0,"Destructors ",NoList,CA_None,isSens,92,18,15}, - {C_CheckBox,30,0,"Text ",NoList,CA_None,isSens,92,19,15}, - - {C_CheckBox,20,0,"User Debug 1 ",NoList,CA_None,isSens,92,0,18}, - {C_CheckBox,21,0,"User Debug 2 ",NoList,CA_None,isSens,92,20,18}, - {C_CheckBox,22,0,"User Debug 3 ",NoList,CA_None,isSens,92,21,18}, - - {C_Button, M_All,M_All," All On ",NoList,CA_None,isSens,NoFrame,0,92}, - {C_Button, M_None,M_None," All Off ",NoList,CA_None,isSens,NoFrame,M_All,92}, - {C_Blank, 95, 0, " ", NoList,CA_None,isSens,NoFrame,M_None,92}, - {C_Button, M_Cancel, M_Cancel, " Cancel ", NoList, - CA_None,isSens,NoFrame, 95,92}, - {C_Button, M_OK, M_OK, " OK ", NoList, - CA_DefaultButton, isSens, NoFrame, M_Cancel, 92}, - {C_EndOfList,0,0,0,0,CA_None,0,0,0} - }; - - -//=======================>>> vDebugDialog::SetDebug <<<======================= - void vDebugDialog::SetDebug() - { - // Show a message, ask user Yes/No/Cancel - // returns < 0 for cancel, 0 for No, 1 for Yes - - ItemVal val; - - // first, set with current values - - (void) SetCommandObject(dSystem, DebugState.System, DebugDialog); - (void) SetCommandObject(dUser, DebugState.User, DebugDialog); - (void) SetCommandObject(dCmdEvents, DebugState.CmdEvents, DebugDialog); - (void) SetCommandObject(dMouseEvents, DebugState.MouseEvents, DebugDialog); - (void) SetCommandObject(dWindowEvents, DebugState.WindowEvents, DebugDialog); - (void) SetCommandObject(dUserApp1, DebugState.UserApp1, DebugDialog); - (void) SetCommandObject(dUserApp2, DebugState.UserApp2 , DebugDialog); - (void) SetCommandObject(dUserApp3, DebugState.UserApp3 , DebugDialog); - (void) SetCommandObject(dBuild, DebugState.Build, DebugDialog); - (void) SetCommandObject(dMisc, DebugState.Misc, DebugDialog); - (void) SetCommandObject(dText, DebugState.Text, DebugDialog); - (void) SetCommandObject(dBadVals, DebugState.BadVals, DebugDialog); - (void) SetCommandObject(dConstructor, DebugState.Constructor, DebugDialog); - (void) SetCommandObject(dDestructor, DebugState.Destructor, DebugDialog); - - - AddDialogCmds(DebugDialog); // Set up standard dialog - (void) ShowModalDialog("Set Debug Options",val); // show and wait - switch (val) // convert to our system - { - case M_OK: - DebugState.System = GetValue(dSystem); - DebugState.User = GetValue(dUser); - DebugState.CmdEvents = GetValue(dCmdEvents); - DebugState.MouseEvents = GetValue(dMouseEvents); - DebugState.WindowEvents = GetValue(dWindowEvents); - DebugState.UserApp1 = GetValue(dUserApp1); - DebugState.UserApp2 = GetValue(dUserApp2); - DebugState.UserApp3 = GetValue(dUserApp3); - DebugState.Build = GetValue(dBuild); - DebugState.Misc = GetValue(dMisc); - DebugState.Text = GetValue(dText); - DebugState.BadVals = GetValue(dBadVals); - DebugState.Constructor = GetValue(dConstructor); - DebugState.Destructor = GetValue(dDestructor); - break; - - case M_Cancel: - break; - - default: - SysDebug1(BadVals,"vDebugDialog::SetDebug() - can't handle %d\n",val) - break; - }; - } - -//====================>>> vDebugDialog::DialogCommand <<<======================= - void vDebugDialog::DialogCommand(ItemVal id, ItemVal val, CmdType ctype) - { - - vModalDialog::DialogCommand(id,val,ctype); - - switch (id) - { - case M_OK: - CloseDialog(); - break; - - case M_All: // set all to 1 - SetValue(dSystem, 1, Value); - SetValue(dUser, 1, Value); - SetValue(dCmdEvents, 1, Value); - SetValue(dMouseEvents, 1, Value); - SetValue(dWindowEvents, 1, Value); - SetValue(dUserApp1, 1, Value); - SetValue(dUserApp2, 1, Value); - SetValue(dUserApp3, 1, Value); - SetValue(dBuild, 1, Value); - SetValue(dMisc, 1, Value); - SetValue(dText, 1, Value); - SetValue(dBadVals, 1, Value); - SetValue(dConstructor, 1, Value); - SetValue(dDestructor, 1, Value); - break; - - case M_None: // set all to 0 - SetValue(dSystem, 0, Value); - SetValue(dUser, 0, Value); - SetValue(dCmdEvents, 0, Value); - SetValue(dMouseEvents, 0, Value); - SetValue(dWindowEvents, 0, Value); - SetValue(dUserApp1, 0, Value); - SetValue(dUserApp2, 0, Value); - SetValue(dUserApp3, 0, Value); - SetValue(dBuild, 0, Value); - SetValue(dMisc, 0, Value); - SetValue(dText, 0, Value); - SetValue(dBadVals, 0, Value); - SetValue(dConstructor, 0, Value); - SetValue(dDestructor, 0, Value); - break; - } - } - -//########################################################################### -// Utilities - these may be useful for others, too. -/** -//========================>>> SetCommandObject <<<============================== - int SetCommandObject(const int id, const int val, CommandObject* CmdList) - { - for (CommandObject* cur = CmdList ; cur->cmdType != C_EndOfList ; ++cur) - { - if (cur->cmdId == id) - { - cur->retVal = val; - return 1; - } - } - - SysDebug1(BadVals,"SetCommandObject(id:%d...) - No match in list\n",id) - - return 0; - } - -//========================>>> GetCommandObject <<<============================== - int GetCommandObject(const int id, CommandObject* CmdList) - { - for (CommandObject* cur = CmdList ; cur->cmdType != C_EndOfList ; ++cur) - { - if (cur->cmdId == id) - { - return cur->retVal;; - } - } - - SysDebug1(BadVals,"GetCommandObject(id:%d...) - No match in list\n",id) - - return 0; - } -// --------------------------------------------------------------------- -**/ \ No newline at end of file diff --git a/v/srcwin/vdialog.cpp b/v/srcwin/vdialog.cpp deleted file mode 100644 index a7e8825..0000000 --- a/v/srcwin/vdialog.cpp +++ /dev/null @@ -1,628 +0,0 @@ -//=============================================================== -// vdialog.cxx - vDialog class - Windows -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include // our header -#include -#include // For this list -#include - -#define SCROLL_CRACKER - -// Define static data of the class - static BOOL CALLBACK DlgProcCB(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); - - static vThisList _thisList; // hide this in this file - - vDialog* vDialog::_curModal = 0; // V:1.13 - -#include // for tooltips - -//===================>>> vChkWinDlgMsgs <<<======================= - int vChkWinDlgMsgs(MSG *msg) - { - // Need this to check if a message should be processed - // by the dialog message processor instead of the general loop. - - for (vDialog* w = (vDialog*) _thisList.GetFirstThis() ; w != 0 ; - w = (vDialog*) _thisList.GetNextThis()) - { - if (::IsDialogMessage(w->HwndDialog(),msg)) - return 1; - } - - return 0; - } - -//===================>>> vDialog::vDialog <<<======================= - vDialog::vDialog(const vDialog& d) : vBaseWindow(d), - vCmdParent(P_Dialog) - { - vSysError("vDialog - V semantics do not support copy constructors!"); - _oldModal = 0; // V:1.13 - } - -//=================>>> vDialog::~vDialog <<<======================= - vDialog::~vDialog() - { - - SysDebug(Destructor,"vDialog::~vDialog() destructor\n") - - _IsDisplayed = 0; // The dialog is not up - - if (_hTemplate != 0) - { - ::GlobalFree(_hTemplate); - _hTemplate = 0; - } - - closeBaseWindow(); // close this window - _thisList.Delete((ThisId)_wDialog); // free the this ptr - } - -//===================>>> vDialog::vDialog <<<======================= - vDialog::vDialog(VCONST vBaseWindow* creator, int modal, VCONST char* title) : - vBaseWindow(title), vCmdParent(P_Dialog) // constructor - { - _parentHWND = creator->winHwnd(); // track parent's HWND - init(modal,title); // finish construction - } - -//===================>>> vDialog::vDialog <<<======================= - vDialog::vDialog(VCONST vApp* creator, int modal, VCONST char* title) : - vBaseWindow(title), vCmdParent(P_Dialog) // constructor - { - _parentHWND = creator->winHwnd(); // track parent's HWND - init(modal,title); // finish construction - } - -//===================>>> vDialog::vDialog <<<======================= - void vDialog::init(int modal, VCONST char* /* title */) - { - // Initialize dialog box - - _modal = modal; // settable modal - - SysDebug(Constructor,"vDialog::vDialog() constructor\n") - - _wType = DIALOG; // a dialog - - _dialogType = aDialog; // This is a dialog - - _IsDisplayed = 0; // The dialog is not up - - _wDialog = 0; // haven't created the dialog yet... - - hwndToolTip = 0; - - - // Now, build the initial in-memory dialog template using - // Windows HGLOBAL handle _hTemplate. - - int buildOK; - -#ifdef ALLOW_BOLD_FONT - HDC hdc = ::GetDC(theApp->winHwnd()); - int horRes = ::GetDeviceCaps(hdc, HORZRES); - ::ReleaseDC(theApp->winHwnd(), hdc); - char *fntname = (horRes <= 800) ? "Helv" : "HelvBold"; -#else - char *fntname = "Helv"; -#endif - - // Using 8,helv makes it ok to use 8 in calculating control sizes! - if (_modal) - buildOK = CreateDlgTemplate( - DS_MODALFRAME | WS_CAPTION | WS_VISIBLE | WS_POPUP | DS_SETFONT, - 10, 25, 1, 1, "", "", _name, 8, fntname ); - else - buildOK = CreateDlgTemplate( - WS_CAPTION | WS_VISIBLE | WS_POPUP | DS_SETFONT, - 10, 25, 1, 1, "", "", _name, 8, fntname ); - if (!buildOK) - vSysError("vDialog - Unable to build dialog template"); - - _DefaultButton = 0; // No default button described - _FirstTextIn = 0; // No text in field - } - -//===================>>> vDialog::AddDialogCmds <<<======================== - void vDialog::AddDialogCmds(CommandObject* cList) // add commands - { - // This is called to add commands from the supplied - // CommandObject list. - - vCmd* defButton = 0; - DlgCmdList* curCmd; - - // scan the entire list - - for (int ix = 0 ; cList && (cList[ix].cmdType != C_EndOfList) ; ++ix) - { - curCmd = new DlgCmdList; // get a new cell - - curCmd->nextDCL = _cmdList; // add in at front - _cmdList = curCmd; - curCmd->cmdP = 0; // not added yet - - curCmd->cmdP = AddCmd(&cList[ix]); - - // Track default button - - if (cList[ix].attrs & CA_DefaultButton) - { - defButton = curCmd->cmdP; - } - - if (cList[ix].cmdType == C_TextIn) - { - if (_FirstTextIn == 0) - _FirstTextIn = curCmd->cmdP; - } - } - - if (defButton) // we have a default - { - _DefaultButton = defButton; // Track the default button - - } - - DoneAddingControls(); // all finished with controls - } - -//===================>>> vDialog::AddDialogCmdObj <<<======================== - void vDialog::AddDialogCmdObj(CommandObject* Cmd, vCmd* CmdInstance) - { - // This is called to add an already instantiated command object to the - // CommandObject list. - - DlgCmdList* curCmd = new DlgCmdList; // get a new cell - - curCmd->nextDCL = _cmdList; // add in at front of list - - _cmdList = curCmd; - - curCmd->cmdP = CmdInstance; // point to the object - - // Track default button - - if (Cmd->attrs & CA_DefaultButton) - { - _DefaultButton = CmdInstance; // This is the default button - // This lets us use Enter to activate the default button. - } - } - -//====================>>> vDialog::CancelDialog <<<======================= - void vDialog::CancelDialog(void) - { - // Cancel selected - reset all values to original values - - - SysDebug(CmdEvents,"vDialog::CancelDialog()\n") - - for (DlgCmdList* cc = _cmdList ; cc != 0 ; cc = cc->nextDCL) - { - (cc->cmdP)->ResetItemValue(); - } - - // And close the dialog - - CloseDialog(); - } - -//====================>>> vDialog::CloseDialog <<<======================= - void vDialog::CloseDialog(void) - { - - SysDebug(Build,"vDialog::CloseDialog()\n") - - _IsDisplayed = 0; // The dialog is not up - - if (hwndToolTip != 0) - { - ::DestroyWindow(hwndToolTip); - hwndToolTip = 0; - } - - if (!_modal) // destroy if not modal - ::DestroyWindow(_wDialog); - _thisList.Delete((ThisId)_wDialog); // free the this ptr - } - -//====================>>> vDialog::DialogCommand <<<======================= - void vDialog::DialogCommand(ItemVal id, ItemVal retval, CmdType /*ctype*/) - { - // After the user has selected a command from the dialog, - // this routine is called with the value - - - SysDebug2(CmdEvents,"vDialog::DialogCommand(id:%d, val:%d)\n",id, retval) - - switch (id) // We will do some things depending on value - { - case M_Cancel: - CancelDialog(); - break; - - case M_Done: // default, close dialog - case M_OK: - { - CloseDialog(); - break; - } - } - } - -//====================>>> vDialog::DialogDisplayed <<<======================= - void vDialog::DialogDisplayed() - { - } - -//==================>>> vDialog::ProcessCmd <<<======================= - void vDialog::ProcessCmd(ItemVal id, ItemVal rv, CmdType ct) - { - // simple interface between command objects and the - // inherited vCmdParent ProcessCmd to the CommandObject which does the work - - DialogCommand(id, rv, ct); - } - -//====================>>> vDialog::SetDialogTitle <<<======================= - void vDialog::SetDialogTitle(VCONST char* title) - { - ::SetWindowText(_wDialog, title); - } - -//================>>> vDialog::GetDialogPosition <<<======================== - void vDialog::GetDialogPosition(int& left, int& top, int& width, - int& height) VCONST - { - RECT rct; - RECT ar; - - ::GetWindowRect(_wDialog, &rct); - ::GetWindowRect(theApp->winClientHwnd(), &ar); - - left = (rct.left >= ar.left) ? rct.left - ar.left : rct.left; - top = (rct.top >= ar.top) ? rct.top - ar.top : rct.top; - width = rct.right - rct.left; - height = rct.bottom - rct.top; - - } - -//====================>>> vDialog::SetDialogPosition <<<======================= - void vDialog::SetDialogPosition(int left, int top) - { - RECT ar; - - ::GetWindowRect(theApp->winClientHwnd(), &ar); - - (void)::SetWindowPos(_wDialog,HWND_TOP,left+ar.left,top+ar.top, - 0,0,SWP_NOSIZE); - } - -//====================>>> vDialog::ShowDialog <<<======================= - void vDialog::ShowDialog(VCONST char* msg) - { - // Show the dialog with the default message - - // We will control the position of the dialog box based on - // the parent's location. The user can move the dialog later. - - SysDebug1(Build,"vDialog::ShowDialog(%s)\n",msg) - - // First, get the values from our parent - - if (_IsDisplayed) - return; // make this a no-op - - // set the message field -- have to move to the dlgproc init case - - if (msg && *msg) - { - for (DlgCmdList* cc = _cmdList ; cc != 0 ; cc = cc->nextDCL) - { - if (((cc->cmdP)->dlgCmd)->attrs & CA_MainMsg) - { - ((cc->cmdP)->dlgCmd)->title = msg; // repoint to the message - } - } - } - - // Since the dialog isn't necessarily re-created each time it is - // popped up, we need to loop through now to set the original values - - for (DlgCmdList* cc = _cmdList ; cc != 0 ; cc = cc->nextDCL) - { - (cc->cmdP)->SaveItemValue(); - } - - // Now ready to popup the dialog - _IsDisplayed = 1; // The dialog is up -// const DLGTEMPLATE * ptr = (const DLGTEMPLATE *)GlobalLock(_hTemplate); - DLGTEMPLATE * ptr = (DLGTEMPLATE *)GlobalLock(_hTemplate); - if (_modal) - { - (void) ::DialogBoxIndirectParam((HINSTANCE)theApp->vHandle(), - ptr, - _parentHWND, (DLGPROC) DlgProcCB, LPARAM(this)); - _IsDisplayed = 0; - } - else - { - _wDialog = 0; - (void) ::CreateDialogIndirectParam((HINSTANCE)theApp->vHandle(), - ptr, - _parentHWND, - (DLGPROC) DlgProcCB, - LPARAM(this) - ); - } - ::GlobalUnlock(_hTemplate); // Unlock the template here - } - -// --------------------------------------------------------------------- -//====================>>> DlgProc <<<======================= -static BOOL CALLBACK DlgProcCB(HWND hwnd, UINT uMsg, - WPARAM wParam, LPARAM lParam) -{ - vDialog* useThis; - - if (uMsg == WM_INITDIALOG) // first time! - { - useThis = (vDialog*)lParam; - _thisList.Add((ThisId)hwnd, (void*)useThis); - } - else - useThis = (vDialog*)_thisList.GetThis((ThisId)hwnd); - if (!useThis) - return 0; - - - return useThis->DynamicDlgProc(hwnd, uMsg, wParam, lParam); -} - -//====================>>> vDialog::DynamicDlgProc <<<======================= - int vDialog::DynamicDlgProc(HWND hwnd, UINT uMsg, - WPARAM wParam, LPARAM lParam) - { - int fProcessed = 1; - - // This code handles nested modals, a no no.... (V:1.13) - - if (_curModal != 0 && _curModal != this) // V:1.13 - { - //::BringWindowToTop(_curModal->myHwnd()); - return 0; - } - - switch (uMsg) - { - case WM_INITDIALOG: - { - // Changes here must have equivlalents in the vcmdpane.cpp code - //create the tooltip window - if (hwndToolTip == 0 ) - { - hwndToolTip = CreateWindowEx( 0, - TOOLTIPS_CLASS, - NULL, - WS_POPUP | TTS_ALWAYSTIP, - CW_USEDEFAULT, - CW_USEDEFAULT, - 10, - 10, - hwnd, - NULL, - (HINSTANCE)theApp->vHandle(), - NULL); - } - _wDialog = hwnd; - _myHWND = hwnd; // V:1.13 - - ::SetWindowText(_wDialog, _name); - for (DlgCmdList* cc = _cmdList ; cc != 0 ; cc = cc->nextDCL) - { - vCmd* cp = cc->cmdP; - - // BEW - V 1.17 - Shouldn't have to do this, but the dynamic - // dialog creation somehow replaces characters > 128 with _. - // This fixes that problem. - - if ((cp->dlgCmd)->cmdType == C_BoxedLabel || - (cp->dlgCmd)->cmdType == C_Button || - (cp->dlgCmd)->cmdType == C_CheckBox || - (cp->dlgCmd)->cmdType == C_Label || - (cp->dlgCmd)->cmdType == C_RadioButton || - (cp->dlgCmd)->cmdType == C_TextIn - ) - { - cp->SetCmdStr((cp->dlgCmd)->title); - } - else if ((cp->dlgCmd)->cmdType == C_Text) - { - if (!(cp->dlgCmd)->itemList || - (*(char *)(cp->dlgCmd)->itemList == 0)) - cp->SetCmdStr((cp->dlgCmd)->title); - else - cp->SetCmdStr((char*)(cp->dlgCmd)->itemList); - } - - if ((cp->dlgCmd)->cmdType == C_CheckBox && (cp->dlgCmd)->retVal) - cp->SetCmdVal(1,Checked); - - if ((cp->dlgCmd)->cmdType == C_RadioButton && (cp->dlgCmd)->retVal) - cp->SetCmdVal(1,Checked); - - if ((cp->dlgCmd)->cmdType == C_Slider || (cp->dlgCmd)->cmdType == C_Spinner) - cp->SetCmdVal(cp->GetCmdValue((cp->dlgCmd)->cmdId),Value); - - if ((cp->dlgCmd)->attrs & CA_MainMsg) - { - cp->SetCmdStr((cp->dlgCmd)->title); - } - if ((cp->dlgCmd)->attrs & CA_DefaultButton) - { - ::SetFocus(GetDlgItem(_wDialog, (cp->dlgCmd)->cmdId)); // Set to default - fProcessed = 0; // return 0 if we call SetFocus - } - if ((cp->dlgCmd)->cmdType == C_TextIn) - { - ::SetFocus(GetDlgItem(_wDialog, (cp->dlgCmd)->cmdId)); // Set to default - fProcessed = 0; // return 0 if we call SetFocus - } - - if (!(cp->dlgCmd)->Sensitive) // Make insensitive if it was - { - cp->SetCmdVal(0,Sensitive); - } - if ((cp->dlgCmd)->attrs & CA_Hidden) // Hide it! - { - cp->SetCmdVal(1,Hidden); - } - if ((cp->dlgCmd)->cmdType == C_List - || (cp->dlgCmd)->cmdType == C_SList - || (cp->dlgCmd)->cmdType == C_ComboBox - || (cp->dlgCmd)->cmdType == C_SComboBox - || (cp->dlgCmd)->cmdType == C_Spinner) - { - int curval = cp->GetCmdValue((cp->dlgCmd)->cmdId); - cp->SetCmdVal(curval,ChangeList); - } - if ((cp->dlgCmd)->cmdType == C_Icon || (cp->dlgCmd)->cmdType == C_Frame - || (cp->dlgCmd)->cmdType == C_ToggleFrame) - { - cp->SetCmdVal(0,Sensitive); // Trick to avoid getting focus - } - // Now add ToolTip if it has a message - if ((cp->dlgCmd)->tip && *(cp->dlgCmd)->tip) - { - TOOLINFO ti; - // add the control to the tooltip. TTF_SUBCLASS causes the - // tooltip to automatically subclass the window and look for the - // messages it is interested in. - char *cc = (char*) &ti; - int lim = sizeof (ti); - for (int i = 0 ; i++ < lim ; *cc++ = 0) - ; - - // ZeroMemory(&ti, sizeof(ti)); - ti.cbSize = sizeof(ti); - ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS; - ti.hwnd = hwnd; - ti.uId = (UINT)GetDlgItem(hwnd,(cp->dlgCmd)->cmdId); - ti.lpszText = (LPTSTR) TEXT((cp->dlgCmd)->tip); - if (hwndToolTip != 0) - SendMessage(hwndToolTip, TTM_ADDTOOL, 0, (LPARAM)&ti); - } - } - - DialogDisplayed(); - - break; - } - - case WM_COMMAND: - { - switch (GET_WM_COMMAND_CMD(wParam, lParam)) // Have to ignore EN messages - { - case EN_ERRSPACE: - case EN_HSCROLL: -// case EN_KILLFOCUS: - case EN_MAXTEXT: - case EN_SETFOCUS: - case EN_UPDATE: - case EN_VSCROLL: - return 0; - } - - ItemVal cmdid = (ItemVal)GET_WM_COMMAND_ID(wParam, lParam); - vCmd* UseThis = (vCmd *) getThisFromId(cmdid); - - if (!UseThis && cmdid == IDCANCEL) - UseThis = (vCmd *) getThisFromId(M_Cancel); - - if (!UseThis) - { - fProcessed = 0; break; - } - - UseThis->CmdCallback(cmdid,(WORD)GET_WM_COMMAND_CMD(wParam, lParam)); - } - break; - - - case WM_HSCROLL: - case WM_VSCROLL: - { - int id = ::GetWindowID(GET_WM_HSCROLL_HWND(wParam, lParam)); - - vCmd* UseThis = (vCmd *) getThisFromId(id); - int code = GET_WM_HSCROLL_CODE(wParam,lParam); - - if (!UseThis || code == SB_ENDSCROLL) - { - fProcessed = 0; break; - } - - UseThis->CmdCallback(code, - (WORD)GET_WM_HSCROLL_POS(wParam, lParam)); - break; - } - case WM_CTLCOLORSTATIC: - { - vCmd* UseThis = (vCmd *) - getThisFromId(::GetDlgCtrlID(GET_WM_CTLCOLOR_HWND(wParam, lParam, uMsg))); - if (UseThis && (UseThis->dlgCmd)->cmdType == C_ColorLabel) - { - ::SetTextColor(GET_WM_CTLCOLOR_HDC(wParam, lParam, uMsg), - ((vColorLabelCmd*)UseThis)->_color.pixel()); - } - } - // flow into next case! - case WM_CTLCOLORBTN: - ::SetBkColor(GET_WM_CTLCOLOR_HDC(wParam, lParam, uMsg), - ::GetSysColor(COLOR_BTNFACE)); - return (int)(theApp->_BarBrush); - case WM_CTLCOLORDLG: - return (int )(theApp->_BarBrush); - - // Following two are for BS_OWNERDRAW buttons, which include - // icons, iconbuttons, and maybe others - - case WM_MEASUREITEM: - { - if (!_IsDisplayed) - return 0; - ItemVal mid = (ItemVal)GET_WM_COMMAND_ID(wParam, lParam); - vCmd* UseThis = (vCmd *) getThisFromId(mid); - if (!UseThis) - return 0; - return UseThis->MEASUREITEM((int)mid, (MEASUREITEMSTRUCT*)lParam); - } - - case WM_DRAWITEM: - { - if (!_IsDisplayed) - return 0; - ItemVal did = (ItemVal)GET_WM_COMMAND_ID(wParam, lParam); - vCmd* UseThis = (vCmd *) getThisFromId(did); - if (!UseThis) - return 0; - return UseThis->DRAWITEM((int)did, (DRAWITEMSTRUCT*)lParam); - } - - default: - fProcessed = FALSE; break; - } - return fProcessed; -} diff --git a/v/srcwin/vfilesel.cpp b/v/srcwin/vfilesel.cpp deleted file mode 100644 index a759dff..0000000 --- a/v/srcwin/vfilesel.cpp +++ /dev/null @@ -1,172 +0,0 @@ -//=============================================================== -// vfilesel.cxx - vFileSelect class functions - Windows -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include // our header -#include -#include -#ifdef __BORLANDCXX__ -#include -#endif - -// Define static data of the class - - - static char* defaultFilter = // The default filter list - "All files(*.*)|*.*|"; - - -//===================>>> vFileSelect::vFileSelect <<<======================= - vFileSelect::vFileSelect(vBaseWindow* bw, VCONST char* /* title */) // constructor - { - _parentHWND = bw->winHwnd(); // track parent's HWND - init(); - } - -//===================>>> vFileSelect::vFileSelect <<<======================= - vFileSelect::vFileSelect(vApp* aw, VCONST char* /* title */) - { - _parentHWND = aw->winHwnd(); // track parent's HWND - init(); - } - -//===================>>> vFileSelect::init <<<======================= - void vFileSelect::init() - { - memset(&ofn,0,sizeof(OPENFILENAME)); // zap entire thing - ofn.lStructSize = sizeof(OPENFILENAME); - ofn.hwndOwner = _parentHWND; - } - -//======================>>> vFileSelect::FileSelect <<<======================= - int vFileSelect::FileSelect(const char* msg, char* filename, - const int maxlen, char** filter, int& filterIndex, const char* initDir) - { - // Show the file selection dialog. - // returns 0 on cancel, 1 otherwise - - char fp[256]; - -#ifdef __BORLANDCXX__ - vReplyDialog rep(theApp); - return rep.Reply("Enter file name:", filename, maxlen); -#else - - int filterI = filterIndex; - - // filename[0] = 0; - - buildFilter(fp,filter,filterI); // build a proper filter string - - ofn.lpstrFilter = fp; - ofn.nFilterIndex = filterI; - ofn.lpstrFile = filename; - ofn.nMaxFile = maxlen; - ofn.lpstrTitle = msg; - ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | - OFN_HIDEREADONLY; - - if (::GetOpenFileName(&ofn)) // Call Windows dialog - { - strcpy(filename, (char*)ofn.lpstrFile); - filterIndex = ofn.nFilterIndex - 1; - return 1; - } - - - return 0; -#endif - } - -//======================>>> vFileSelect::FileSelectSave <<<======================= - int vFileSelect::FileSelectSave(const char* msg, char* filename, - const int maxlen, char** filter, int& filterIndex, - const int findDir, const char* initDir) - { - // Show the file selection dialog. - // returns 0 on cancel, 1 otherwise - - char fp[256]; - - int filterI = filterIndex; - - //filename[0] = 0; - - buildFilter(fp,filter,filterI); // build a proper filter string - - ofn.lpstrFilter = fp; - ofn.nFilterIndex = filterI; - ofn.lpstrFile = filename; - ofn.nMaxFile = maxlen; - ofn.lpstrTitle = msg; - ofn.lpstrInitialDir = initDir; -//1.24 ofn.Flags = OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY; - ofn.Flags = OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_CREATEPROMPT; - if (findDir) - ofn.Flags |= OFN_NOTESTFILECREATE; // cheap work around - - if (::GetSaveFileName(&ofn)) // Call Windows dialog - { - strcpy(filename, (char*)ofn.lpstrFile); - if (findDir) // strip off file name - { - int len = strlen(filename); - for (int ix = len-1 ; ix > 0 ; --ix) - { - if (filename[ix] == '\\') - { - filename[ix] = 0; // change last \\ to 0 - break; - } - } - } - filterIndex = ofn.nFilterIndex - 1; - return 1; - } - - filename[0] = 0; - return 0; - } - -//======================>>> vFileSelect::buildFilter <<<======================= - void vFileSelect::buildFilter(char* fbuff, char** filter, int& fi) - { - if (filter == 0 || *filter[0] == 0) - { - strcpy(fbuff,defaultFilter); - fi = 1; - } - else // copy the filter over - { - *fbuff = 0; - for (int ix = 0 ; filter[ix] != 0 && *filter[ix] != 0 ; ++ix) - { - if (strlen(filter[ix])*2 + strlen(fbuff) > 255) - break; // safety bailout - - // Since the V model doesn't have the description/filter - // organization, we will simply use the filter as the name - - strcat(fbuff, filter[ix]); strcat(fbuff,"|"); - strcat(fbuff, filter[ix]); strcat(fbuff,"|"); - } - fi = fi + 1; // 1 based, not 0 based - } - - // Fixup the filter now -- replacing | with 0 makes it what Windows needs - - for (char *cp = fbuff ; *cp ; ++cp) - { - if (*cp == '|') - *cp = 0; - } - - } diff --git a/v/srcwin/vfinddlg.cpp b/v/srcwin/vfinddlg.cpp deleted file mode 100644 index a76d006..0000000 --- a/v/srcwin/vfinddlg.cpp +++ /dev/null @@ -1,105 +0,0 @@ -//=============================================================== -// vFinddlg.cxx - vFindDialog class functions - Common Win/X -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // our header -#include // for icon -#include - -// Define static data of the class - - static CommandObject FindDialog[] = - { - - {C_Frame, 79, 0, "",NoList,CA_NoBorder,isSens,NoFrame,0,0}, - {C_Frame, 80, 0, "",NoList,CA_None,isSens,79,0,0}, - - {C_Label, 69, 0, " ",NoList, - CA_None,isSens,80, 0,0}, - {C_Label, 91, 0, "Text to find",NoList, - CA_None,isSens,80, 69,0}, - {C_TextIn, 92, 0, "", NoList, - CA_Large,isSens,80,91,0}, - - - {C_Frame, 81, 0, "",NoList,CA_None,isSens,79,0,80}, - {C_Label, 60, 0, "Search Range",NoList, - CA_None,isSens,81, 0,0}, - {C_RadioButton, 93, 1,"From Cursor",NoList,CA_None, - notSens,81,0,60}, - {C_RadioButton, 94, 0,"Entire File",NoList,CA_None, - notSens,81,0,93}, - - {C_Frame, 82, 0, "",NoList,CA_None,isSens,79,81,80}, - {C_Label, 61, 0, "Search Direction",NoList, - CA_None,isSens,82, 0,0}, - {C_RadioButton, 95, 1,"Forward",NoList,CA_None, - isSens,82,0,61}, - {C_RadioButton, 96, 0,"Backward",NoList,CA_None, - isSens,82,0,95}, - - {C_Frame, 83, 0, "",NoList,CA_None,isSens,79,82,80}, - {C_Label, 62, 0, "Options",NoList, - CA_None,isSens,83, 0,0}, - {C_CheckBox, 97, 0,"Case Sensitive",NoList,CA_None, - isSens,83,0,62}, - - {C_Button, M_OK, M_OK, " Find ", NoList,CA_DefaultButton, - isSens,NoFrame,79,0}, - {C_Button, M_Cancel, M_Cancel, " Cancel ", NoList,CA_None, - isSens,NoFrame,79,M_OK}, - {C_EndOfList,0,0,0,0,CA_None,0,0,0} - }; - -//======================>>> vFindDialog::AskFindPat <<<======================= - int vFindDialog::AskFindPat(char* reply, const int maxlen, int& caseSens, - int& Down, int& Wrap) - { - // Show a message, wait for a reply - // no important return - - int ans; - - if (!reply) - return 0; - - if (!added) - { - FindDialog[vGetcmdIdIndex(92,FindDialog)].title = reply; - AddDialogCmds(FindDialog); // Set up standard dialog - added = 1; - } - - if (*reply) - SetString(92,reply); - SetValue(97,caseSens,Value); - SetValue(94,Wrap,Value); - SetValue(95,Down,Value); - int rID = ShowModalDialog("", ans); // show and WAIT - - if (rID != M_Cancel) - { - (void) GetTextIn(92, reply, maxlen); - caseSens = GetValue(97); - Wrap = GetValue(94); // Entire file? - Down = GetValue(95); // Down? - } - - return rID == M_OK; - } - -//====================>>> vFindDialog::DialogCommand <<<======================= - void vFindDialog::DialogCommand(ItemVal id, ItemVal val, CmdType ctype) - { - vModalDialog::DialogCommand(id,val,ctype); -// if (id == M_OK || id == M_Cancel) -// CloseDialog(); - } -// --------------------------------------------------------------------- diff --git a/v/srcwin/vfont.cpp b/v/srcwin/vfont.cpp deleted file mode 100644 index 9083ba7..0000000 --- a/v/srcwin/vfont.cpp +++ /dev/null @@ -1,371 +0,0 @@ -//=============================================================== -// vfont.cxx - The font class - Windows -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include -#include -#include - -//=======================>>> vFont::vFont <<<============================= - vFont::vFont(vFontID fam, int size, vFontID sty, vFontID wt, int und, int ang) - { - SysDebug(Constructor,"vFont::vFont() constructor\n") - - _family = fam; _pointSize = size; _style = sty; _weight = wt; - _underlined = und; _isStockFont = 0; _hFont = 0; - _fontColor = 0; _angle = ang; - memset(&_lf, 0, sizeof(LOGFONT)); - - } - -//=====================>>> vFont::vFont <<<=========================== - vFont::vFont(const vFont& ft) - { - // Copy constructor - needs to delete object if already - // created, and copy the values as needed - - if (_hFont != 0 && !_isStockFont) - ::DeleteObject(_hFont); - _isStockFont = 0; _hFont = 0; - _family = ft._family; _style = ft._style; _weight = ft._weight; - _pointSize = ft._pointSize; _underlined = ft._underlined; - _fontColor = ft._fontColor; _angle = ft._angle; - _lf = ft._lf; - - } - -//=====================>>> vFont::= <<<=========================== - vFont& vFont::operator =(const vFont& ft) - { - if (this == &ft) // assigning to self - { - return *this; - } - - // just like the copy constructor - - if (_hFont != 0 && !_isStockFont) - ::DeleteObject(_hFont); - _isStockFont = 0; _hFont = 0; - _family = ft._family; _style = ft._style; _weight = ft._weight; - _pointSize = ft._pointSize; _underlined = ft._underlined; - _angle = ft._angle; - _fontColor = ft._fontColor; - _lf = ft._lf; - - return *this; - } - -//=====================>>> vFont::SetFontValues <<<=========================== - void vFont::SetFontValues(vFontID fam, int size, vFontID sty, vFontID wt, - int und) - { - if (_hFont != 0 && !_isStockFont) - ::DeleteObject(_hFont); - _isStockFont = 0; _hFont = 0; - _family = fam; _style = sty; _weight = wt; - _pointSize = size; _underlined = und; - _fontColor = 0; - } - -//=================>>> vFont::GetNativeFontString <<<======================== - void vFont::GetNativeFontString(char* fontStr) - { - // This will translate the native font info into a standard - // string that can be saved to a text file. The SetNativeFontString - // can be used to set the font to that string. - // fontStr should be char fontStr[120]; - - /* - * typedef struct tagLOGFONT { // lf - * LONG lfHeight; - * LONG lfWidth; - * LONG lfEscapement; - * LONG lfOrientation; - * LONG lfWeight; - * BYTE lfItalic; - * BYTE lfUnderline; - * BYTE lfStrikeOut; - * BYTE lfCharSet; - * BYTE lfOutPrecision; - * BYTE lfClipPrecision; - * BYTE lfQuality; - * BYTE lfPitchAndFamily; - * TCHAR lfFaceName[LF_FACESIZE]; LF_FACESIZE = 32 - * } LOGFONT; - * - * + COLORREF _fontColor & _pointSize * 10; - */ - char val[30]; - - LongToStr(_lf.lfHeight,val); strcpy(fontStr,val); strcat(fontStr,";"); - LongToStr(_lf.lfWidth,val); strcat(fontStr,val); strcat(fontStr,";"); - LongToStr(_lf.lfEscapement,val); strcat(fontStr,val); strcat(fontStr,";"); - LongToStr(_lf.lfOrientation,val); strcat(fontStr,val); strcat(fontStr,";"); - LongToStr(_lf.lfWeight,val); strcat(fontStr,val); strcat(fontStr,";"); - IntToStr((int)_lf.lfItalic,val); strcat(fontStr,val); strcat(fontStr,";"); - IntToStr((int)_lf.lfUnderline,val); strcat(fontStr,val); strcat(fontStr,";"); - IntToStr((int)_lf.lfStrikeOut,val); strcat(fontStr,val); strcat(fontStr,";"); - IntToStr((int)_lf.lfCharSet,val); strcat(fontStr,val); strcat(fontStr,";"); - IntToStr((int)_lf.lfOutPrecision,val); strcat(fontStr,val); strcat(fontStr,";"); - IntToStr((int)_lf.lfClipPrecision,val); strcat(fontStr,val); strcat(fontStr,";"); - IntToStr((int)_lf.lfQuality,val); strcat(fontStr,val); strcat(fontStr,";"); - IntToStr((int)_lf.lfPitchAndFamily,val); strcat(fontStr,val); strcat(fontStr,";"); - LongToStr((long)_fontColor,val); strcat(fontStr,val); strcat(fontStr,";"); - IntToStr(_pointSize*10,val); strcat(fontStr,val); strcat(fontStr,";"); - strcat(fontStr,(char*)_lf.lfFaceName); - - } - -//=================>>> vFont::SetNativeFontString <<<======================== - void vFont::SetNativeFontString(char* fontStr) - { - LOGFONT lf; - int ptSize; - long rgb; - - char* cp = fontStr; // a copy to use - char str[32]; - - // translate to native format - - cp = getSubstring(cp, str); - lf.lfHeight = StrToLong(str); - cp = getSubstring(cp, str); lf.lfWidth = StrToLong(str); - cp = getSubstring(cp, str); lf.lfEscapement = StrToLong(str); - cp = getSubstring(cp, str); lf.lfOrientation = StrToLong(str); - cp = getSubstring(cp, str); lf.lfWeight = StrToLong(str); - - cp = getSubstring(cp, str); lf.lfItalic = (BYTE) StrToLong(str); - cp = getSubstring(cp, str); lf.lfUnderline = (BYTE) StrToLong(str); - cp = getSubstring(cp, str); lf.lfStrikeOut = (BYTE) StrToLong(str); - cp = getSubstring(cp, str); lf.lfCharSet = (BYTE) StrToLong(str); - cp = getSubstring(cp, str); lf.lfOutPrecision = (BYTE) StrToLong(str); - cp = getSubstring(cp, str); lf.lfClipPrecision = (BYTE) StrToLong(str); - cp = getSubstring(cp, str); lf.lfQuality = (BYTE) StrToLong(str); - cp = getSubstring(cp, str); lf.lfPitchAndFamily = (BYTE) StrToLong(str); - - cp = getSubstring(cp, str); rgb = StrToLong(str); - cp = getSubstring(cp, str); ptSize = (int) StrToLong(str); - - strcpy(lf.lfFaceName, cp); - - SetWinFontValues(lf, ptSize, (DWORD)rgb); // and set font - } - -//=================>>> vFont::getSubstring <<<======================== - char* vFont::getSubstring(char* str, char* substr) - { - while (*str != ';' && *str != 0) // copy to ; or nul - *substr++ = *str++; - *substr = 0; // terminate - if (*str != 0) - return ++str; // skip the ; - else - return 0; - } - -//=====================>>> vFont::SetWinFontValues <<<======================== - void vFont::SetWinFontValues(VCONST LOGFONT& lf, - int iPointSize, DWORD rgbColors) - { - if (_hFont != 0 && !_isStockFont) - ::DeleteObject(_hFont); - _lf = lf; - - _isStockFont = 0; _hFont = 0; - - // Map to whatever - - // First, set what will be true no matter what - - _pointSize = iPointSize / 10; - _style = lf.lfItalic ? vfItalic : vfNormal; - _underlined = lf.lfUnderline; - _fontColor = rgbColors; - _angle = lf.lfEscapement / 10; - - // Now set things that might make it NOT a V font. - - if (lf.lfWeight == FW_NORMAL) - _weight = vfNormal; - else if (lf.lfWeight == FW_BOLD) - _weight = vfBold; - else - { - _weight = vfNormal; - goto WinNative; - } - if (lf.lfStrikeOut) - goto WinNative; - - // Now, determine if it is a V family - - if (lf.lfPitchAndFamily == (DEFAULT_PITCH | FF_ROMAN) && - strcmp(lf.lfFaceName,"Times New Roman") == 0) - { - _family = vfSerif; - return; - } - else if (lf.lfPitchAndFamily == (DEFAULT_PITCH | FF_SWISS) && - strcmp(lf.lfFaceName,"Arial") == 0) - { - _family = vfSansSerif; - return; - } - else if (lf.lfPitchAndFamily == (DEFAULT_PITCH | FF_MODERN) && - strcmp(lf.lfFaceName,"Courier New") == 0) - { - _family = vfFixed; - return; - } - else if (lf.lfPitchAndFamily == (DEFAULT_PITCH | FF_DECORATIVE) && - strcmp(lf.lfFaceName,"Wingdings") == 0 && lf.lfCharSet == SYMBOL_CHARSET) - { - _family = vfDecorative; - return; - } - - WinNative: // a Native Windows font - _family = vfOtherFont; - return; - - } - -//=======================>>> vFont::~vFont <<<============================= - vFont::~vFont() - { - SysDebug(Destructor,"vFont::~vFont() destructor\n") - if (_hFont != 0 && !_isStockFont) - ::DeleteObject(_hFont); // free the font resource - } - -//=======================>>> vFont::LoadFont <<<============================= - void vFont::LoadFont(HDC dc, int isPrinterDC) - { - // Create the stuff needed for interal font stuff - - if (_hFont != 0) - return; - - SysDebug(Misc,"Loading font\n"); - - int ff_weight = 0; - int ff_family = 0; - char *ff_face = NULL; - BYTE chrSet = ANSI_CHARSET; - - _isStockFont = 0; // assume not a stock font - - - switch (_family) - { - case vfDefaultVariable: // default font - if (isPrinterDC) - { - ff_family = FF_SWISS; - ff_face = "Arial"; - } - else - { - _isStockFont = 1; - _hFont = (HFONT) ::GetStockObject(SYSTEM_FONT); - } - break; - - // The rest of the fonts will be Windows TrueType fonts - - case vfSerif: // Serif font - ff_family = FF_ROMAN; - ff_face = "Times New Roman" ; - break; - - case vfSansSerif: // SansSerif Font - ff_family = FF_SWISS; - ff_face = "Arial"; - break; - - case vfFixed: // Fixed - ff_family = FF_MODERN; - ff_face = "Courier New"; - break; - - case vfDecorative: // Decorative - ff_family = FF_DECORATIVE; - ff_face = "Wingdings"; - chrSet = SYMBOL_CHARSET; - break; - - case vfOtherFont: // set by font picker dialog - { - if (isPrinterDC) // Need to override this to be same as - _lf.lfHeight = _pointSize*12/10; // other "V" fonts - _hFont = ::CreateFontIndirect(&_lf); - if (_hFont == NULL) // just in case - { - _hFont = (HFONT) ::GetStockObject(SYSTEM_FONT); - _isStockFont = 1; - _angle = 0; - } - return; - } - - case vfDefaultFixed: // default font - case vfDefaultSystem: - default: - if (isPrinterDC) - { - ff_family = FF_MODERN; - ff_face = "Courier New" ; - } - else - { - _isStockFont = 1; - _hFont = (HFONT) ::GetStockObject(SYSTEM_FIXED_FONT); - _angle = 0; - } - break; - } - - // Now, set the rest of the font attributes - - BYTE ff_italic = (_style == vfItalic) ? 1 : 0; - ; - if (_weight == vfNormal) - ff_weight = FW_NORMAL; - else if (_weight == vfBold) - ff_weight = FW_BOLD; - - if (!_isStockFont) // load non stock fonts - { - int nHeight; - // This is a bit of a kludge, but these values give fonts that - // are very close to the same physical print size as the PostScript - // version. It doesn't look too bad! - if (isPrinterDC) - nHeight = _pointSize*12/10; - else - nHeight = _pointSize*GetDeviceCaps(dc, LOGPIXELSY)/72; - - _hFont = ::CreateFont(nHeight, 0, _angle * 10, 0,ff_weight,ff_italic, - (BYTE)_underlined, - 0, chrSet, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, - PROOF_QUALITY, DEFAULT_PITCH | ff_family, ff_face); - } - if (_hFont == NULL) // just in case - { - _hFont = (HFONT) ::GetStockObject(SYSTEM_FONT); - _isStockFont = 1; - } - } - - -//######################################################################## diff --git a/v/srcwin/vfontsel.cpp b/v/srcwin/vfontsel.cpp deleted file mode 100644 index 6ed4510..0000000 --- a/v/srcwin/vfontsel.cpp +++ /dev/null @@ -1,105 +0,0 @@ -//=============================================================== -// vselfont.cpp - vSelectFont class functions - Windows -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include // our header -#include -#include - -//===================>>> vFontSelect::vFontSelect <<<======================= - vFontSelect::vFontSelect(vBaseWindow* bw, VCONST char* /*title*/) // constructor - { - _parentHWND = bw->winHwnd(); // track parent's HWND - init(); - } - -//===================>>> vFontSelect::vFontSelect <<<======================= - vFontSelect::vFontSelect(vApp* aw, VCONST char* /*title*/) - { - _parentHWND = aw->winHwnd(); // track parent's HWND - init(); - } - -//===================>>> vFontSelect::init <<<======================= - void vFontSelect::init() - { - memset(&_lf,0,sizeof(LOGFONT)); // zap entire thing - memset(&_cf,0,sizeof(CHOOSEFONT)); - - _cf.lStructSize = sizeof(CHOOSEFONT); - _cf.hwndOwner = _parentHWND; - } - -//======================>>> vFontSelect::SelectFont <<<======================= - int vFontSelect::FontSelect(vFont& font,const char* /*msg*/, int fixedOnly) - { - // Select a font - - - // Set to values of the supplied font - vFontID vfam = font.GetFamily(); - if (vfam == vfOtherFont) - { - _cf.rgbColors = font.GetFontColor(); - _lf = font.GetLOGFONT(); - } - else - { - switch (vfam) - { - case vfSerif: // Serif font - _lf.lfPitchAndFamily = DEFAULT_PITCH | FF_ROMAN; - strcpy(_lf.lfFaceName,"Times New Roman"); - break; - - case vfSansSerif: // SansSerif Font - _lf.lfPitchAndFamily = DEFAULT_PITCH | FF_SWISS; - strcpy(_lf.lfFaceName,"Arial"); - break; - - case vfFixed: // Fixed - _lf.lfPitchAndFamily = DEFAULT_PITCH | FF_MODERN; - strcpy(_lf.lfFaceName,"Courier New"); - break; - - case vfDecorative: // Decorative - _lf.lfPitchAndFamily = DEFAULT_PITCH | FF_DECORATIVE; - strcpy(_lf.lfFaceName,"Wingdings"); - break; - - default: - _lf.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; - strcpy(_lf.lfFaceName,"Fixedsys"); - break; - } - _lf.lfWeight = (font.GetWeight() == vfBold) ? FW_BOLD : FW_REGULAR; - _lf.lfHeight = -17; // Reasonable default - _lf.lfItalic = (font.GetStyle() == vfItalic); - _lf.lfUnderline = font.GetUnderlined(); - } - - _cf.lpLogFont = &_lf; - _cf.Flags = CF_SCREENFONTS | CF_EFFECTS | - CF_INITTOLOGFONTSTRUCT; - if (fixedOnly) - _cf.Flags |= CF_FIXEDPITCHONLY; - - _cf.nFontType = SCREEN_FONTTYPE; - - if (!::ChooseFont(&_cf)) - return 0; - - font.SetWinFontValues(_lf, _cf.iPointSize, _cf.rgbColors); - - return 1; - } - -// --------------------------------------------------------------------- diff --git a/v/srcwin/vframec.cpp b/v/srcwin/vframec.cpp deleted file mode 100644 index dadcd5c..0000000 --- a/v/srcwin/vframec.cpp +++ /dev/null @@ -1,169 +0,0 @@ -//=============================================================== -// vframec.cxx - a frame for holding commands - Windows -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include -#include // our definitions -#include // a command parent - -//=====================>>> vFrameCmd::vFrameCmd <<<======================= - vFrameCmd::vFrameCmd(vCmdParent* dp, CommandObject* dc) : - vCmd(dp, dc) - { - initialize(); - } - -//=====================>>> vFrameCmd::~vFrameCmd <<<======================= - vFrameCmd::~vFrameCmd() - { - - SysDebug(Destructor,"vFrameCmd::~vFrameCmd() destructor\n") - - } - -//=====================>>> vFrameCmd::initialize <<<======================= - void vFrameCmd::initialize(void) - { - // build a button command for use in a parent window - - - SysDebug(Constructor,"vFrameCmd::vFrameCmd() constructor\n") - - - long style = BS_OWNERDRAW | WS_GROUP; // default for a button - - CopyToLocal(); // Make local copies of CmdObject - - _title = ""; // never a label, sigh... - - // if (!(dlgCmd->attrs & CA_NoBorder)) // Check for Hidden - style |= WS_VISIBLE; - - - _w = StdMargin; // set my width - _h = StdMargin; /* +2 */ // default height - - _parentWin->SetPosition(_x, _y, _w, _h, dlgCmd->cFrame, dlgCmd->cRightOf, - dlgCmd->cBelow); - - _CtrlOffset = _parentWin->AddDlgControl(_x, _y, _w, _h, _cmdId, - style, "BUTTON", _title, sizeof(vCmd*), (LPBYTE)this); - } - -//================>>> vFrameCmd::SetCmdVal <<<============================ - void vFrameCmd::SetCmdVal(ItemVal val, ItemSetType st) - { - - SysDebug1(Misc,"vFrameCmd::SetCmdVal(val:%d)\n",val) - - HWND myHwnd = GetMyHwnd(_cmdId); - if (st == Sensitive) // used so icons won't get - { // focus -- icons use ownerdraw, - _Sensitive = val; // which behave like buttons, not - ::EnableWindow(myHwnd, val); // static labels -- this fixes that - } - else if (st == Hidden) // hide or unhide - { - if (val) - { - ::ShowWindow(myHwnd,SW_HIDE); - } - else - { - ::ShowWindow(myHwnd,SW_SHOW); - } - } - else if (st == Value && dlgCmd->cmdType == C_ToggleFrame) // Toggle? - { - if (val) // have to hide/show me first - { - ::ShowWindow(myHwnd,SW_SHOW); - } - else - { - ::ShowWindow(myHwnd,SW_HIDE); - } - _parentWin->SetFrameChildren(_cmdId,val); // and now set value of childern - } - } - -//================>>> vFrameCmd::MEASUREITEM <<<============================ - int vFrameCmd::MEASUREITEM(int id, MEASUREITEMSTRUCT* mis) - { - mis->CtlType = ODT_BUTTON; - mis->CtlID = id; - mis->itemWidth = _w; - mis->itemHeight = _h; - - return 1; - } - -//================>>> vFrameCmd::DRAWITEM <<<============================ - int vFrameCmd::DRAWITEM(int /*id */, DRAWITEMSTRUCT* dis) - { - switch (dis->itemAction) - { - case ODA_DRAWENTIRE: // redraw entire control - { - // This gets called after the CTLCOLOR message has been - // processed in the dialog/commandpane procs. - // We are using LTGRAY_BRUSH for dialogs and command bars. - // We need to draw the icon properly on the background. - // We will use a null pen, and the same background. We have - // to use left-1, top-1, right+1, and bottom+1 to have the - // interior of the rectangle in the icon's area. We end up - // with a white line otherwise. First, fill gray background - - HPEN oldpen = (HPEN) ::SelectObject(dis->hDC, GetStockObject(NULL_PEN)); - - HBRUSH oldbrush = static_cast(::SelectObject(dis->hDC, theApp->_BarBrush)); - - (void)::Rectangle(dis->hDC,dis->rcItem.left, dis->rcItem.top, - dis->rcItem.right+1, dis->rcItem.bottom+1); - - if (!(dlgCmd->attrs & CA_NoBorder)) - { - ::SelectObject(dis->hDC, theApp->_ShadowPen); - ::MoveTo(dis->hDC, dis->rcItem.left+1, dis->rcItem.bottom-1); - ::LineTo(dis->hDC, dis->rcItem.left+1, dis->rcItem.top+1); - ::LineTo(dis->hDC, dis->rcItem.right-1, dis->rcItem.top+1); - - ::SelectObject(dis->hDC,theApp->_LightPen); - ::MoveTo(dis->hDC, dis->rcItem.right-1, dis->rcItem.top+1); - ::LineTo(dis->hDC, dis->rcItem.right-1, dis->rcItem.bottom-1); - ::LineTo(dis->hDC, dis->rcItem.left+1, dis->rcItem.bottom-1); - } - - - ::SelectObject(dis->hDC, oldpen); // restore hdc - ::SelectObject(dis->hDC, oldbrush); - - return 1; - } - - case ODA_SELECT: // indicated selected - { - return 1; // no op for icon Frame - } - - case ODA_FOCUS: // gets focus - { - return 1; // no op for icon Frame - } - } - return 0; - } - -//===================>>> vFrameCmd::vCmdCallback <<<======================= - void vFrameCmd::CmdCallback(int /*id*/, WORD codeNotify) - { - // No Op for a Frame - the icon button may generate one of these! - } diff --git a/v/srcwin/vgui.vpj b/v/srcwin/vgui.vpj deleted file mode 100644 index 1127dca..0000000 --- a/v/srcwin/vgui.vpj +++ /dev/null @@ -1,117 +0,0 @@ -//======================================================================= -//@V@:Note: Project File generated by VIDE: (16:39:12 21 Feb 2000). -//CAUTION! Hand edit only if you know what you are doing! -//======================================================================= - -//% Section 1 - PROJECT OPTIONS -ctags:* -//%end-proj-opts - -//% Section 2 - MAKEFILE -Makefile.vgui - -//% Section 3 - OPTIONS -//%end-options - -//% Section 4 - HOMEV - - -//% Section 5 - TARGET FILE -libV.a - -//% Section 6 - SOURCE FILES -vapp.cpp -vawinfo.cpp -vbaseitm.cpp -vbasewin.cpp -vbglcnv.cpp -vboxlblc.cpp -vbrush.cpp -vbtncmd.cpp -vcanvas.cpp -vcbtncmd.cpp -vchkboxc.cpp -vclabelc.cpp -vcmd.cpp -vcmdpane.cpp -vcmdprnt.cpp -vcmdwin.cpp -vcolor.cpp -vcomboc.cpp -vcpdc.cpp -vdebug.cpp -vdialog.cpp -vfilesel.cpp -vfinddlg.cpp -vfont.cpp -vfontsel.cpp -vframec.cpp -vicon.cpp -vlabelc.cpp -vlistc.cpp -vmemdc.cpp -vmenu.cpp -vmodald.cpp -vnotice.cpp -vos.cpp -vpen.cpp -vpopmenu.cpp -vprogrsc.cpp -vradioc.cpp -vrepldlg.cpp -vreply.cpp -vsliderc.cpp -vslist.cpp -vspinc.cpp -vstartup.cpp -vtextc.cpp -vtextcnv.cpp -vtexted.cpp -vtextinc.cpp -vthislst.cpp -vtimer.cpp -vwindc.cpp -vutil.cpp -vwindow.cpp -vwinprdc.cpp -vwinprtr.cpp -vynreply.cpp -//%end-srcfiles - -//% Section 7 - COMPILER NAME -g++ - -//% Section 8 - INCLUDE DIRECTORIES -../includew -//%end-include-dirs - -//% Section 9 - LIBRARY DIRECTORIES -//%end-library-dirs - -//% Section 10 - DEFINITIONS -//%end-defs-pool -//%end-defs - -//% Section 11 - C FLAGS --O - -//% Section 12 - LIBRARY FLAGS - - -//% Section 13 - SRC DIRECTORY -. - -//% Section 14 - OBJ DIRECTORY -./o - -//% Section 15 - BIN DIRECTORY -./o - - -//% User targets section. Following lines will be -//% inserted into Makefile right after the generated cleanall target. -//% The Project File editor does not edit these lines - edit the .vpj -//% directly. You should know what you are doing. -//% Section 16 - USER TARGETS -//%end-user-targets - diff --git a/v/srcwin/vguibor.vpj b/v/srcwin/vguibor.vpj deleted file mode 100644 index 3fe7e3a..0000000 --- a/v/srcwin/vguibor.vpj +++ /dev/null @@ -1,117 +0,0 @@ -//======================================================================= -//@V@:Note: Project File generated by VIDE: (19:42:44 24 Feb 2000). -//CAUTION! Hand edit only if you know what you are doing! -//======================================================================= - -//% Section 1 - PROJECT OPTIONS -ctags:* -//%end-proj-opts - -//% Section 2 - MAKEFILE -Makefile.vbor - -//% Section 3 - OPTIONS -//%end-options - -//% Section 4 - HOMEV - - -//% Section 5 - TARGET FILE -vguibcc.lib - -//% Section 6 - SOURCE FILES -vapp.cpp -vawinfo.cpp -vbaseitm.cpp -vbasewin.cpp -vboxlblc.cpp -vbrush.cpp -vbtncmd.cpp -vcanvas.cpp -vcbtncmd.cpp -vchkboxc.cpp -vclabelc.cpp -vcmd.cpp -vcmdpane.cpp -vcmdprnt.cpp -vcmdwin.cpp -vcolor.cpp -vcomboc.cpp -vcpdc.cpp -vdebug.cpp -vdialog.cpp -vfilesel.cpp -vfinddlg.cpp -vfont.cpp -vfontsel.cpp -vframec.cpp -vicon.cpp -vlabelc.cpp -vlistc.cpp -vmemdc.cpp -vmenu.cpp -vmodald.cpp -vnotice.cpp -vos.cpp -vpen.cpp -vpopmenu.cpp -vprogrsc.cpp -vradioc.cpp -vrepldlg.cpp -vreply.cpp -vsliderc.cpp -vslist.cpp -vspinc.cpp -vstartup.cpp -vtextc.cpp -vtextcnv.cpp -vtexted.cpp -vtextinc.cpp -vthislst.cpp -vtimer.cpp -vwindc.cpp -vutil.cpp -vwindow.cpp -vwinprdc.cpp -vwinprtr.cpp -vynreply.cpp -//%end-srcfiles - -//% Section 7 - COMPILER NAME -bcc32 - -//% Section 8 - INCLUDE DIRECTORIES -$(BCCROOT)\include -..\includew -//%end-include-dirs - -//% Section 9 - LIBRARY DIRECTORIES -//%end-library-dirs - -//% Section 10 - DEFINITIONS -//%end-defs-pool -//%end-defs - -//% Section 11 - C FLAGS --P- -w -O1 -v- - -//% Section 12 - LIBRARY FLAGS - - -//% Section 13 - SRC DIRECTORY -. - -//% Section 14 - OBJ DIRECTORY -..\obj - -//% Section 15 - BIN DIRECTORY -..\lib - - -//% User targets section. Following lines will be -//% inserted into Makefile right after the generated cleanall target. -//% The Project File editor does not edit these lines - edit the .vpj -//% directly. You should know what you are doing. -//% Section 16 - USER TARGETS -//%end-user-targets - diff --git a/v/srcwin/vguidll.vpj b/v/srcwin/vguidll.vpj deleted file mode 100644 index a36da6e..0000000 --- a/v/srcwin/vguidll.vpj +++ /dev/null @@ -1,136 +0,0 @@ -//======================================================================= -//@V@:Note: Project File generated by VIDE: (12:46:47 18 Sep 2000). -//CAUTION! Hand edit only if you know what you are doing! -//======================================================================= - -//% Section 1 - PROJECT OPTIONS -ctags:* -//%end-proj-opts - -//% Section 2 - MAKEFILE -Makefile.vdll - -//% Section 3 - OPTIONS -VVERS = 125 -//%end-options - -//% Section 4 - HOMEV - - -//% Section 5 - TARGET FILE -vgui125.dll - -//% Section 6 - SOURCE FILES -vapp.cpp -vawinfo.cpp -vbaseitm.cpp -vbasewin.cpp -vboxlblc.cpp -vbrush.cpp -vbtncmd.cpp -vcanvas.cpp -vcbtncmd.cpp -vchkboxc.cpp -vclabelc.cpp -vcmd.cpp -vcmdpane.cpp -vcmdprnt.cpp -vcmdwin.cpp -vcolor.cpp -vcomboc.cpp -vcpdc.cpp -vdebug.cpp -vdialog.cpp -vfilesel.cpp -vfinddlg.cpp -vfont.cpp -vfontsel.cpp -vframec.cpp -vicon.cpp -vlabelc.cpp -vlistc.cpp -vmemdc.cpp -vmenu.cpp -vmodald.cpp -vnotice.cpp -vos.cpp -vpen.cpp -vpopmenu.cpp -vprogrsc.cpp -vradioc.cpp -vrepldlg.cpp -vreply.cpp -vsliderc.cpp -vslist.cpp -vspinc.cpp -vtextc.cpp -vtextcnv.cpp -vtexted.cpp -vtextinc.cpp -vthislst.cpp -vtimer.cpp -vwindc.cpp -vutil.cpp -vwindow.cpp -vwinprdc.cpp -vwinprtr.cpp -vynreply.cpp -//%end-srcfiles - -//% Section 7 - COMPILER NAME -g++ - -//% Section 8 - INCLUDE DIRECTORIES -../includew -//%end-include-dirs - -//% Section 9 - LIBRARY DIRECTORIES -//%end-library-dirs - -//% Section 10 - DEFINITIONS --DBUILD_V_DLL -//%end-defs-pool --DBUILD_V_DLL -//%end-defs - -//% Section 11 - C FLAGS --O - -//% Section 12 - LIBRARY FLAGS - - -//% Section 13 - SRC DIRECTORY -. - -//% Section 14 - OBJ DIRECTORY -../objdll - -//% Section 15 - BIN DIRECTORY -../lib - - -//% User targets section. Following lines will be -//% inserted into Makefile right after the generated cleanall target. -//% The Project File editor does not edit these lines - edit the .vpj -//% directly. You should know what you are doing. -//% Section 16 - USER TARGETS -#all - override 'all' target -# following contributed by franzo bez -$(Bin)/vgui$(VVERS).dll: $(EXOBJS) $(oDir)/vstartup.o $(oDir)/vbglcnv.o -\trm -f $(Bin)/vgui$(VVERS).dll -\trm -f $(Bin)/libVDLL.a -\tdllwrap --export-all --output-lib=$(Bin)/libVDLL.a --dllname=vgui$(VVERS).dll \ -\t-o$(Bin)/vgui$(VVERS).dll --driver-name=$(CC) \ -\t$(EXOBJS) -lopengl32 -lglu32 -lcomctl32 -lgdi32 -lshell32 -lcomdlg32 -\tstrip $(Bin)/vgui$(VVERS).dll -\tar q $(Bin)/libVDLL.a $(oDir)/vstartup.o $(oDir)/vbglcnv.o -\tranlib $(Bin)/libVDLL.a -# -# added target to split out vstart from rest of source -$(oDir)/vstartup.o: vstartup.cpp -\t$(CC) $(C_FLAGS) $(incDirs) -c -o $@ $< - -$(oDir)/vbglcnv.o: vbglcnv.cpp -\t$(CC) $(C_FLAGS) -DUSE_V_DLL $(incDirs) -c -o $@ $< -//%end-user-targets - diff --git a/v/srcwin/vguiglbor.vpj b/v/srcwin/vguiglbor.vpj deleted file mode 100644 index 82284b2..0000000 --- a/v/srcwin/vguiglbor.vpj +++ /dev/null @@ -1,69 +0,0 @@ -//======================================================================= -//@V@:Note: Project File generated by VIDE: (10:38:15 15 Mar 2000). -//CAUTION! Hand edit only if you know what you are doing! -//======================================================================= - -//% Section 1 - PROJECT OPTIONS -ctags:* -//%end-proj-opts - -//% Section 2 - MAKEFILE -Makefile.vborgl - -//% Section 3 - OPTIONS -//%end-options - -//% Section 4 - HOMEV - - -//% Section 5 - TARGET FILE -vglbcc.lib - -//% Section 6 - SOURCE FILES -vbglcnv.cpp -//%end-srcfiles - -//% Section 7 - COMPILER NAME -BCC32 - -//% Section 8 - INCLUDE DIRECTORIES -$(BCCROOT)\include -..\includew -//%end-include-dirs - -//% Section 9 - LIBRARY DIRECTORIES -$(BCCROOT)\lib -$(BCCROOT)\lib\psdk -//%end-library-dirs - -//% Section 10 - DEFINITIONS --D_RTLDLL -//%end-defs-pool -//%end-defs - -//% Section 11 - C FLAGS - -O1 -v- -a2 - -//% Section 12 - LIBRARY FLAGS --v- - -//% Section 13 - SRC DIRECTORY -. - -//% Section 14 - OBJ DIRECTORY -..\obj - -//% Section 15 - BIN DIRECTORY -..\lib - - -//% User targets section. Following lines will be -//% inserted into Makefile right after the generated cleanall target. -//% The Project File editor does not edit these lines - edit the .vpj -//% directly. You should know what you are doing. -//% Section 16 - USER TARGETS -# BCC32 RT lib: cw32.lib static -BCC32RTLIB = cw32 -# BCC32 Startup: c0x32.obj-console, c0w32.obj-winapi -//%end-user-targets - diff --git a/v/srcwin/vicon.cpp b/v/srcwin/vicon.cpp deleted file mode 100644 index 37c157e..0000000 --- a/v/srcwin/vicon.cpp +++ /dev/null @@ -1,233 +0,0 @@ -//=============================================================== -// vicon.cpp - icon class -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include - -//=============================>>> vIcon::vIcon <<<===================== - vIcon::vIcon() - { - _hbm = _hmsk = 0; - } - -//=============================>>> vIcon::vIcon <<<===================== - vIcon::vIcon(unsigned char* ic, int h, int w, int d, IconType it) - { - icon = ic; height = h; width = w; depth = d; iType = it; - _hbm = 0; - } - -//=============================>>> vIcon::~vIcon <<<===================== - vIcon::~vIcon() - { - if (_hbm != 0) ::DeleteObject(_hbm); - if (_hmsk != 0) ::DeleteObject(_hmsk); - } - -//=============================>>> vIcon::NeedBMPBytes <<<================== - int vIcon::NeedBMPBytes() VCONST - { - // calculate how many bytes of storage a BMP will take - - int needwords = width / 16; - if ((width - ((width/16)*16)) != 0) // need one more word if remainder > 0 - ++needwords; - return (needwords * 2) * height; // convert to bytes - } - -//=============================>>> vIcon::vIconToBMP <<<===================== - void vIcon::vIconToBMP(HDC iDC) VCONST - { - static unsigned char Xmask[] = {0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80}; - static unsigned char Wmask[] = {0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01}; - - - //@@ This needs to be completely redone using DIBs instead of BMPS. - //@@ Everyone that counts on this needs to switch, too. - //@@ For now, we will draw with the wrong color map! - - if (depth == 8) // 8 bit icons - { - unsigned char* vbytes = icon; - BYTE red[256], green[256], blue[256]; - - unsigned int numColors = (unsigned int) *vbytes++ + 1; // how many colors to map - - for (unsigned int ix = 0 ; ix < numColors ; ++ix) // map the colors - { - red[ix] = *vbytes++; green[ix] = *vbytes++; blue[ix] = *vbytes++; - } - - // Colors mapped, vbytes now points to beginning of data - - HDC bmDC = ::CreateCompatibleDC(iDC); // A memory DC to draw into - - // First, create a blank bitmap compatible with the - // current context that is size of bitmap. - - _hbm = ::CreateCompatibleBitmap(iDC, width, height); - - HBITMAP oldBM = static_cast(::SelectObject(bmDC,_hbm)); // Select bm into dc - // I don't know why, but this seems to need to be inverted! - // ::SetROP2(bmDC, R2_NOTCOPYPEN); // notcopy pen - - COLORREF wcolor; - int bmIndex; - - // The lower left hand pixel of the bitmap is reserved for the - // transparent color. Any pixel in the bitmap which matches that - // lower left hand pixel will be transparent (for Transparent icons) - - int trIndex = vbytes[ ( height - 1 ) * width ]; - HDC mskDC = 0; - HBITMAP saveBM = 0; - - // For Transparent icons, - // create second bitmap with same dimensions for the mask - if (iType == Transparent) - { - mskDC = ::CreateCompatibleDC( iDC ); - _hmsk = ::CreateCompatibleBitmap( iDC, width, height ); - saveBM = static_cast(::SelectObject( mskDC, _hmsk)); - } - - for (int r8 = 0 ; r8 < height ; ++r8) - for (int c8 = 0 ; c8 < width ; c8++) - { - bmIndex = vbytes[(r8*width)+c8]; // Index to colors - // Now map that color to a COLORREF - - wcolor = RGB(red[bmIndex],green[bmIndex],blue[bmIndex]); - (void)::SetPixel(bmDC,c8,r8,wcolor); // Draw into it - if (iType == Transparent) - { - // Set/clear the pixel at the current pos in the bitmask - wcolor = ( bmIndex == trIndex ) - ? RGB( 0, 0, 0 ) : RGB( 255, 255, 255 ); - ::SetPixel( mskDC, c8, r8, wcolor ); - } - } - - ::SelectObject(bmDC,oldBM); - ::DeleteDC(bmDC); - if (iType == Transparent) - { - // Done with the DC - ::SelectObject( mskDC, saveBM ); - ::DeleteDC( mskDC ); - } - } - else if (depth > 8) // 24 bit icons - { - unsigned char R, G, B; - unsigned char* vbytes = icon; - HDC bmDC = ::CreateCompatibleDC(iDC); - - // First, create a blank bitmap compatible with the - // current context that is size of bitmap. - - _hbm = ::CreateCompatibleBitmap(iDC, width, height); - - HBITMAP oldBM = static_cast(::SelectObject(bmDC,_hbm)); // Select bm into dc - HDC mskDC = 0; - HBITMAP saveBM = 0; - - COLORREF wcolor; - - if (iType == Transparent) - { - // Create second bitmap with same dimensions for the mask - mskDC = ::CreateCompatibleDC( iDC ); - _hmsk = ::CreateCompatibleBitmap( iDC, width, height ); - saveBM = static_cast(::SelectObject( mskDC, _hmsk )); - } - - // The lower left hand pixel of the bitmap is reserved for the - // transparent color. Any pixel in the bitmap which matches that - // lower left hand pixel will be transparent - COLORREF trColor = RGB( vbytes[ ( height - 1 ) * width * 3 ], - vbytes[ ( height - 1 ) * width * 3 + 1], - vbytes[ ( height - 1 ) * width * 3 + 2] ); - - for (int r8 = 0 ; r8 < height ; ++r8) - { - for (int c8 = 0 ; c8 < width ; c8++) - { - R = *vbytes++; G = *vbytes++; B = *vbytes++; - // Now map that color to a COLORREF - wcolor = RGB(R,G,B); - (void)::SetPixel(bmDC,c8,r8,wcolor); // Draw into it - if (iType == Transparent) - { - // Set/clear the pixel at the current pos in the bitmask - wcolor = ( wcolor == trColor ) - ? RGB( 0, 0, 0 ) : RGB( 255, 255, 255 ); - ::SetPixel( mskDC, c8, r8, wcolor ); - } - } - } - - - ::SelectObject(bmDC,oldBM); - ::DeleteDC(bmDC); - if (iType == Transparent) - { - // Done with the DC - ::SelectObject( mskDC, saveBM ); - ::DeleteDC( mskDC ); - } - } - else if (depth == 1) - { - // We will use depth == 1 as the default case since if the - // depth isn't legal, we will at least get some kind of picture - // of the right size. - - unsigned char* bmbits = new unsigned char[NeedBMPBytes()]; // allocate space - - // Now need to copy bytes over, padding to even (words) - - unsigned char X,W; - unsigned char* from = icon; - unsigned char* to = bmbits; - - int rowbytes = width / 8; // number of bytes - if ((width & 7) != 0) - ++rowbytes; // bytes padded, need to bump - - int rowwords = rowbytes / 2; - if ((rowbytes & 1) != 0) - ++rowwords; - - for (int row = 0 ; row < height ; ++row) // copy by row - { - for (int col = 0 ; col < rowbytes ; ++col) - { - X = *from++; // copy of X byte - W = 0; - for (int ix = 0 ; ix < 8 ; ++ix) // reverse bits - { - if (X & Xmask[ix]) - W |= Wmask[ix]; - } - *to++ = W; - } - // Finished a row, need to pad to even bytes - if ((rowbytes & 1) != 0) - *to++ = 0xff; // pad with 0's - } - - // Now, create the bitmap - _hbm = ::CreateBitmap(width, height, 1, 1, bmbits); - delete [] bmbits; - } - - } diff --git a/v/srcwin/vlabelc.cpp b/v/srcwin/vlabelc.cpp deleted file mode 100644 index 0139e2a..0000000 --- a/v/srcwin/vlabelc.cpp +++ /dev/null @@ -1,254 +0,0 @@ -//=============================================================== -// vlabelc.cxx - label Cmd - Windows -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include // our definitions -#include // a command parent -#include // utility -#include // icons - -//=====================>>> vLabelCmd::vLabelCmd <<<======================= - vLabelCmd::vLabelCmd(vCmdParent* dp, CommandObject* dc): - vCmd(dp, dc) - { - initialize(); - } - -//=====================>>> vLabelCmd::~vLabelCmd <<<======================= - vLabelCmd::~vLabelCmd() - { - - SysDebug(Destructor,"vLabelCmd::~vLabelCmd() destructor\n") - - } - -//=====================>>> vLabelCmd::initialize <<<======================= - void vLabelCmd::initialize(void) - { - // build a button command for use in a parent window - - CopyToLocal(); // Make local copies of CmdObject - - SysDebug(Constructor,"vLabelCmd::vLabelCmd() constructor\n") - - if (dlgCmd->cmdType == C_Icon && _itemList != 0) // icon - { - initIcon(); - return; - } - - long style = SS_LEFTNOWORDWRAP; // default for a label - - - if (!(dlgCmd->attrs & CA_Hidden)) // Check for Hidden - style |= WS_VISIBLE; - - if (dlgCmd->size > 0) // may reset title! - { - _w = dlgCmd->size; - } - else if (dlgCmd->attrs & CA_MainMsg && vLblLen(_title) < 20) - { - _w = 88; - } - else - _w = LabelWidth(_title) + 8; // set my width - - if (_parentWin->paneType() == P_Status - || dlgCmd->cmdType == C_Blank) // icon - { - _h = 9; - _parentWin->SetPosition(_x, _y, _w, _h + 2, dlgCmd->cFrame, - dlgCmd->cRightOf, dlgCmd->cBelow); - _y += 2; // make look more centered - } - else - { - _h = 11; // default height - _parentWin->SetPosition(_x, _y, _w, _h + 3, dlgCmd->cFrame, - dlgCmd->cRightOf, dlgCmd->cBelow); - _y += 3; // make look more centered - - } - - _CtrlOffset = _parentWin->AddDlgControl(_x, _y , _w, _h, _cmdId, - style, "STATIC", _title, sizeof(vLabelCmd*), (LPBYTE)this); - } - - -//=====================>>> vLabelCmd::initIcon <<<======================= - void vLabelCmd::initIcon(void) - { - _ip = (vIcon *) _itemList; // to access bitmap - long style = BS_OWNERDRAW; - - if (!(dlgCmd->attrs & CA_Hidden)) // Check for Hidden - style |= WS_VISIBLE; - - _h = _ip->height / 2 + 6; -#ifdef _WIN32 - _w = _ip->width / 2 + 14; -#else - _w = _ip->width / 2 + 6; -#endif - - _parentWin->SetPosition(_x, _y, _w, _h, dlgCmd->cFrame, - dlgCmd->cRightOf, dlgCmd->cBelow); - - _CtrlOffset = _parentWin->AddDlgControl(_x, _y , _w, _h, _cmdId, - style, "BUTTON", "", sizeof(vLabelCmd*), (LPBYTE)this); - - } - -//================>>> vLabelCmd::SetCmdVal <<<============================ - void vLabelCmd::SetCmdVal(ItemVal val, ItemSetType st) - { - SysDebug1(Misc,"vLabelCmd::SetCmdVal(val:%d)\n",val) - - HWND myHwnd = GetMyHwnd(_cmdId); - if (st == Sensitive) // used so icons won't get - { // focus -- icons use ownerdraw, - _Sensitive = val; // which behave like buttons, not - ::EnableWindow(myHwnd, val); // static labels -- this fixes that - } - else if (st == Hidden) // hide or unhide - { - if (val) - { - ::ShowWindow(myHwnd,SW_HIDE); - } - else - { - ::ShowWindow(myHwnd,SW_SHOW); - } - } - - } - -//================>>> vLabelCmd::SetCmdStr <<<============================ - void vLabelCmd::SetCmdStr(VCONST char* str) - { - - SysDebug1(Misc,"vLabelCmd::SetCmdStr(str:%s)\n",str) - - ::SetDlgItemText(_parentWin->getParent(),_cmdId, str); - _title = str; - } - -//================>>> vLabelCmd::MEASUREITEM <<<============================ - int vLabelCmd::MEASUREITEM(int id, MEASUREITEMSTRUCT* mis) - { - mis->CtlType = ODT_BUTTON; - mis->CtlID = id; - mis->itemWidth = _w; - mis->itemHeight = _h; - - return 1; - } - -//================>>> vLabelCmd::DRAWITEM <<<============================ - int vLabelCmd::DRAWITEM(int /* id */, DRAWITEMSTRUCT* dis) - { - switch (dis->itemAction) - { - case ODA_DRAWENTIRE: // redraw entire control - { - - POINT ptSize, ptOrg; - - // Draw the button rectangle in LTGRAY with a BLACK border - - HPEN oldpen = (HPEN) ::SelectObject(dis->hDC, ::GetStockObject(BLACK_PEN)); - HBRUSH oldbrush = static_cast(::SelectObject(dis->hDC, ::GetStockObject(BLACK_BRUSH))); - - - // Now setup coordinate to draw icon - - HDC hdcMem = ::CreateCompatibleDC(dis->hDC); - ::SetMapMode(hdcMem, GetMapMode(dis->hDC)); - HBITMAP hbm = _ip->GetIconHBM(dis->hDC); // get icon HBITMAP - HBITMAP oldbm = static_cast(::SelectObject(hdcMem,hbm)); - ptSize.x = _ip->width; - ptSize.y = _ip->height; - ::DPtoLP(dis->hDC, &ptSize, 1); - ptOrg.x = 0; - ptOrg.y = 0; - ::DPtoLP(hdcMem, &ptOrg, 1); - - int l = 0; // looks strange, but left over from icon button - int t = 0; - - // Now BitBlt the icon BMP into the drawing canvas, leaving - // background untouched, and the pen color to draw 1 bits - // (that's what the E20746L does) for monochrome - - if (_ip->depth == 1) - { - ::SetBkColor(dis->hDC, RGB(255,255,255)); // white bg for icon - ::BitBlt(dis->hDC, l, t, ptSize.x, - ptSize.y, hdcMem, ptOrg.x, ptOrg.y, 0xE20746L); - } - else - { - ::BitBlt(dis->hDC, l, t, ptSize.x, - ptSize.y, hdcMem, ptOrg.x, ptOrg.y, SRCCOPY); - if (_ip->iType == Transparent) - { - HBRUSH dbrush, oldbrush; - - // Prepare for BitBlt with raster operation of PSDPxax, i.e. - // paint with the brush where the color of the pixel on the - // destination bitmap is zero - dbrush = ::CreateSolidBrush(::GetSysColor(COLOR_BTNFACE)); - oldbrush = static_cast(::SelectObject(dis->hDC, dbrush)); - - // Now restore area from the button where the mask is zero - HDC hdcMemMask = ::CreateCompatibleDC( dis->hDC ); - HBITMAP hmsk = _ip->GetIconMask( dis->hDC); // get icon mask HBITMAP - HBITMAP oldBM = static_cast(::SelectObject( hdcMemMask, hmsk)); - - ::BitBlt( dis->hDC, l, t, ptSize.x, - ptSize.y, hdcMemMask, ptOrg.x, - ptOrg.y, 0xB8074A); //PSDPxax - - // Clean up - ::SelectObject( hdcMemMask, oldBM ); - ::DeleteDC( hdcMemMask ); - ::SelectObject( dis->hDC, oldbrush); - ::DeleteObject( dbrush ); - } - } - ::SelectObject(hdcMem,oldbm); - ::DeleteDC(hdcMem); - ::SelectObject(dis->hDC, oldpen); // restore hdc - ::SelectObject(dis->hDC, oldbrush); - - return 1; - } - - case ODA_SELECT: // indicated selected - { - return 1; // no op for icon label - } - - case ODA_FOCUS: // gets focus - { - return 1; // no op for icon label - } - } - return 0; - } - -//===================>>> vLabelCmd::vCmdCallback <<<======================= - void vLabelCmd::CmdCallback(int /*id*/, WORD codeNotify) - { - // No Op for a label - the icon button may generate one of these! - } diff --git a/v/srcwin/vlayoutp.cpp b/v/srcwin/vlayoutp.cpp deleted file mode 100644 index bd5b4a6..0000000 --- a/v/srcwin/vlayoutp.cpp +++ /dev/null @@ -1,265 +0,0 @@ -//=============================================================== -// vLayoutPane - a layout window pane for canvases -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== -//#include - -#include // for Win 32 stuff -#include // our header -#include // need to use some vwindow stuff - - - VCursor vLayoutPane::_currentCursor = -1; // for cursor - -//================>>> vLayoutPane::vLayoutPane <<<======================== - vLayoutPane::vLayoutPane(PaneType pt) : vPane(pt) - { - SysDebug(Constructor,"vLayoutPane::vLayoutPane() constructor\n") - - _cpDC = 0; // no pane DC - _compressRedraw = 1; - _currentCursor = VC_Arrow; - } - -//================>>> vLayoutPane::~vLayoutPane <<<======================== - vLayoutPane::~vLayoutPane() - { - SysDebug(Destructor,"vLayoutPane::~vLayoutPane() destructor\n") - if (_cpDC != 0) - delete _cpDC; // free the DC - } - -//==================>>> vLayoutPane::initialize <<<========================== - void vLayoutPane::initialize(vWindow* pWindow, HWND pWidget) - { - - _HScrlShown = 100; - _HScrlTop = 0; - _VScrlShown = 100; - _VScrlTop = 0; - - // now, build the menu items in the widget provided - - vPane::initialize(pWindow, pWidget); // initialize base class - - pWindow->_canvasPane = this; // easy access to/from window - _drawWindow = pWindow->winHwnd(); - - _hasFocus = 0; // we don't start out with focus - - // set the height and width of our window - - if (theApp->simSDI()) - { - _height = _parentWin->_WinHeight; - _width = _parentWin->_WinWidth; - } - else - { - RECT rc; - - ::GetClientRect(_drawWindow,&rc); // area of the window - - _height = rc.bottom - rc.top; // update the local stuff - _width = rc.right - rc.left; - } - - - // After the drawing widget has been created, we can create - // the V DC for it to use. - - - _parentWin->_WinHeight = _height; - _parentWin->_WinWidth = _width; - - - // Now need to fake out enter focus so the first mouse - // click is ignored. - if (!_hasFocus) - { - _hasFocus = 1; - EnterFocus(); // call the virtual function - } - - if (theApp->simSDI()) - SetWidthHeight(_width, _height); - } - - -//====================>>> vLayoutPane::ShowPane <<<====================== - void vLayoutPane::ShowPane(int OnOrOff) - { - if (OnOrOff) - { - ::ShowWindow(_drawWindow, SW_RESTORE); - } - else - { - ::ShowWindow(_drawWindow, SW_MINIMIZE); - } - } - -//=====================>>> vLayoutPane::SetWidthHeight <<<========================= - void vLayoutPane::SetWidthHeight(int width, int height) - { - if (height <= 0 || width <= 0) - return; - _parentWin->_WinHeight = _height = height; - _parentWin->_WinWidth = _width = width; - - RECT rect; - ::GetWindowRect(_drawWindow,&rect); // rect of canvas - - if (theApp->simSDI()) - { - RECT winRect; - int cW = rect.right - rect.left; // Width of canvas - int cH = rect.bottom - rect.top; // height of canvas - ::GetWindowRect(theApp->winHwnd(),&winRect); - - int wW = winRect.right - winRect.left - cW; - int wH = winRect.bottom - winRect.top - cH; // WH of window - - ::MoveWindow(theApp->winHwnd(),winRect.left,winRect.top, width+wW, - height + wH,1); - } - else - { - RECT ar; - ::GetWindowRect(theApp->winClientHwnd(), &ar); - int left = (rect.left >= ar.left) ? rect.left - ar.left : rect.left; - int top = (rect.top >= ar.top) ? rect.top - ar.top : rect.top; - ::MoveWindow(_drawWindow,left, top, width, height,1); - } - } - - -// ************************************************************************ - -//------------------------- cursor Stuff --------------------------------- - -// ************************************************************************ - -//==================>>> vLayoutPane::SetCursor <<<============================ - void vLayoutPane::SetCursor(VCursor id) - { - // Set to current cursor - - if (id < VC_None || id > VC_LAST) - { - SysDebug1(BadVals,"vLayoutPane::SetCursor(id=%d)\n",id) - return; - } - - if (id == VC_None) // special case - UnSetCursor(); - - SysDebug1(WindowEvents,"vLayoutPane::SetCursor(id=%d)%d\n",id) - - _currentCursor = id; - _parentWin->SetWinCursor(_currentCursor); - } - -//===================>>> vLayoutPane::UnSetCursor <<<========================= - void vLayoutPane::UnSetCursor(void) - { - _currentCursor = CA_None; - } - -// ************************************************************************ - -//----------------------- Scrolling Stuff --------------------------------- - -// ************************************************************************ - -// ************************************************************************ -// -// Redraw/resize/focus -// -// ************************************************************************ - - -//=====================>>> vLayoutPane::ExposeEV <<<========================== - void vLayoutPane::ExposeEV(void) - { - int x = 0, y = 0, height = 0, width = 0; - RECT rect; - if (::GetUpdateRect(_drawWindow, &rect, 0)) - { - x = rect.left ; y = rect.top; - height = rect.bottom - rect.top; - width = rect.right - rect.left; - _cpDC->ClearRect(x, y, width, height); - } - - Redraw(x, y , width, height); - } - -//=====================>>> vLayoutPane::EnterFocus <<<======================== - void vLayoutPane::EnterFocus(void) - { - SysDebug(WindowEvents,"vLayoutPane::EnterFocus()\n") - } - -//=====================>>> vLayoutPane::EnterEV <<<========================== - void vLayoutPane::EnterEV(void) - { - if (_hasFocus) // don't double enter focus - return; - _hasFocus = 1; - - EnterFocus(); // call the virtual function - } - -//=====================>>> vLayoutPane::LeaveFocus <<<======================= - void vLayoutPane::LeaveFocus() - { - SysDebug(WindowEvents,"vLayoutPane::LeaveFocus()\n") - } - -//=====================>>> vLayoutPane::LeaveEV <<<========================== - void vLayoutPane::LeaveEV() - { - if (!_hasFocus) // don't double leave focus - return; - _hasFocus = 0; - - LeaveFocus(); // call the virtual function - } - - -//=======================>>> vLayoutPane::Redraw <<<========================== - void vLayoutPane::Redraw(int x, int y, int width, int height) - { - // Redraw in vLayoutPane is a no-op. - -#ifdef vDEBUG // Don't have a SysDebug4 macro, so do it by hand - if (DebugState.WindowEvents && DebugState.System) - fprintf(stderr,"vLayoutPane::Redraw(x=%d, y=%d, w=%d, h=%d)\n",x,y,width,height); -#endif - - } - -//=====================>>> vLayoutPane::Resize <<<============================ - void vLayoutPane::Resize(int newW, int newH) - { - // This is the routine the user will override to intercept size changes - - SysDebug2(WindowEvents,"vLayoutPane::Resize(newH:%d, newW:%d)\n",newH,newW) - - } - -//==================>>> vLayoutPane::ResizeEV <<<======================== - void vLayoutPane::ResizeEV(int w, int h) - { - _parentWin->_WinHeight = _height = h; - _parentWin->_WinWidth = _width = w; - - Resize((int)w, (int)h); // Call the virtual function - } diff --git a/v/srcwin/vlistc.cpp b/v/srcwin/vlistc.cpp deleted file mode 100644 index 584a90a..0000000 --- a/v/srcwin/vlistc.cpp +++ /dev/null @@ -1,208 +0,0 @@ -//=============================================================== -// vlistc.cxx - ListCmd - Windows -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include // our definitions -#include // a command parent -#include - -//=================>>> vListCmd::vListCmd <<<======================= - vListCmd::vListCmd(vCmdParent* dp, CommandObject* dc) : - vCmd(dp, dc) - { - _maxWidth = 10; - - SysDebug(Constructor,"vListCmd::vListCmd() constructor\n") - - CopyToLocal(); // Make local copies of CmdObject - - // First, setup the list - - _listRows = 8; - if (dlgCmd->attrs & CA_Size) // Size specified - { - if (dlgCmd->size > 0 && dlgCmd->size <= 32) - _listRows = dlgCmd->size; - } - - SetupList(); - - _maxWidth = (dlgCmd->attrs & CA_Large) ? (_maxWidth * 3)/2 - : _maxWidth; - long style = (_parentWin->_dialogType != aCmdBar) - ? WS_TABSTOP | WS_GROUP - : WS_GROUP; - - if (!(dlgCmd->attrs & CA_Hidden)) // Check for Hidden - style |= WS_VISIBLE; - - style |= LBS_STANDARD | LBS_NOINTEGRALHEIGHT; - - _w = _maxWidth*4+10; // set my width - - if ((dlgCmd->attrs & CA_ListWidth) && dlgCmd->retVal > _w) - _w = dlgCmd->retVal; // CA_ListWidth V 1.18 BEW - - _h = (8 * _listRows) + 4; // default height (listRows * 8 hi each) - - _parentWin->SetPosition(_x, _y, _w, _h, dlgCmd->cFrame, dlgCmd->cRightOf, - dlgCmd->cBelow); - _CtrlOffset = _parentWin->AddDlgControl(_x, _y, _w, _h, _cmdId, - style, "LISTBOX", _title, sizeof(vListCmd*), (LPBYTE)this); - } - -//=======================>>> vListCmd::~vListCmd <<<======================= - vListCmd::~vListCmd() - { - - SysDebug(Constructor,"vListCmd::~vListCmd() Destructor\n") - - } - -//==================>>> vListCmd::GetCmdValue <<<========================= - int vListCmd::GetCmdValue(ItemVal id) VCONST - { - if (id != _cmdId) - return -1; - return _curSelection; // return currently selected item - } - -//=====================>>> vListCmd::SetCmdVal <<<========================= - void vListCmd::SetCmdVal(ItemVal val, ItemSetType st) - { - - SysDebug2(Misc,"vListCmd::SetCmdVal(val:%d, type:%d)\n",val,st) - HWND myHwnd = GetMyHwnd(_cmdId); - - if (st == ChangeList || st == ChangeListPtr) - { - if (st == ChangeListPtr) - _itemList = dlgCmd->itemList; - - // Change list is used both for initial display, - // and when user changes the list. - ::SendDlgItemMessage(_parentWin->getParent(), - _cmdId, LB_RESETCONTENT,0,0); // Clear current - - int oldMax = _maxWidth; // track current max width - - SetupList(); // resetup the list - if (oldMax > _maxWidth) - _maxWidth = oldMax; // don't let it get narrower - - for (int ixx = 0 ; ixx < _numItems ; ++ixx) - { - // Add each item to the list - ::SendDlgItemMessage(_parentWin->getParent(), _cmdId, - LB_INSERTSTRING,ixx,(LPARAM)_fullList[ixx]); - } - // Need to set to insensitive if it is set insensitive - if (!_Sensitive) - { - ::EnableWindow(myHwnd, 0); - } - if (dlgCmd->attrs & CA_Hidden) - { - ::ShowWindow(myHwnd,SW_HIDE); - } - _curSelection = val; - ::SendDlgItemMessage(_parentWin->getParent(), - _cmdId, LB_SETCURSEL,_curSelection,0); - return; - } - else if (st == Hidden) // hide or unhide - { - if (val) - { - ::ShowWindow(myHwnd,SW_HIDE); - } - else - { - ::ShowWindow(myHwnd,SW_SHOW); - } - } - else if (st == Value) // select a given item - { - if (val >= _numItems ) - return; - - _curSelection = val; // change the current value - if (val < 0) // unselect - { - _curSelection = -1; - } - - // Now set appropriate _curSelection - // in windows, -1 means unselect, so this works for both - - ::SendDlgItemMessage(_parentWin->getParent(), - _cmdId, LB_SETCURSEL,_curSelection,0); - - } - else if (st == Sensitive) - { - _Sensitive = val; // set - ::EnableWindow(myHwnd, val); - } - } - - -//====================>>> vListCmd::SetupList <<<======================= - void vListCmd::SetupList(void) - { - // Set up the list for use - - int len; - - _curSelection = -1; - - _fullList = (char**)_itemList; // private copy of list - - // Calculate widest item and number of items - for ( _numItems = 0 ; _fullList && _fullList[_numItems] != 0 ; ++_numItems) - { - len = strlen(_fullList[_numItems]); // strlen - if (len > _maxWidth) - _maxWidth = len; // track largest so far - } - - if (_curSelection < 0) // make a safe default choice - _curSelection = 0; - else if (_curSelection >= _numItems) - _curSelection = _numItems - 1; - - // Note that at this point _numItems is how many items are - // in the user supplied list. - - } - -//===================>>> vListCmd::CmdCallback <<<======================= - void vListCmd::CmdCallback(int /* id */, WORD codeNotify) - { - // See if we are getting a message we care about - - if (codeNotify != LBN_SELCHANGE && codeNotify != LBN_DBLCLK) - return; - - // Retrieve the current selection - if ((_curSelection = ::SendDlgItemMessage(_parentWin->getParent(), - _cmdId, LB_GETCURSEL,0,0)) == LB_ERR) - { - _curSelection = -1; - return; - } - - if (_curSelection >= _numItems ) // Safety check - _curSelection = -1; - - if (!(dlgCmd->attrs & CA_NoNotify)) // Notify on each selection? - _parentWin->ProcessCmd(_cmdId, _curSelection, dlgCmd->cmdType); - } diff --git a/v/srcwin/vmemdc.cpp b/v/srcwin/vmemdc.cpp deleted file mode 100644 index 6905df9..0000000 --- a/v/srcwin/vmemdc.cpp +++ /dev/null @@ -1,145 +0,0 @@ -//=============================================================== -// vMemoryDC - a memory drawing canvas - Windows -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include -#include -#include - -//================>>> vMemoryDC::vMemoryDC <<<======================== - vMemoryDC::vMemoryDC(int width, int height) - { - - // Mem canvases are implemented with bitmaps. Most of the - // windows books I've seen don't seem to explain bitmaps - // very well. The idea is this. You create a bitmap (_memBM) that - // is compatible with some DC - like the app's frame DC for our - // purposes. This gives the bitmap a nice color map. Then, the - // tricky part. To use a bitmap, you have to select it into - // a DC. So, you create a new DC (_hdc) , also compatible with - // the app frame DC. Then you select the bitmap into the new - // DC. Now you can draw into the new DC. When done drawing, - // you can release/delete the memory DC until you draw again. - // When you are ALL done, finally free the bitmap. Now isn't - // that all kind of a wierd way of doing things? - - _physHeight = height; // V 1.15a - _physWidth = width; - - SysDebug(Constructor,"vMemoryDC::vMemoryDC() constructor\n") - - if (_physWidth == 0) - _physWidth = theApp->DefaultWidth(); - if (_physHeight == 0) - _physHeight = theApp->DefaultHeight(); - - _memBM = 0; // Not created yet - _hdc = 0; - _oldBM = 0; - } - -//================>>> vMemoryDC::~vMemoryDC <<<======================== - vMemoryDC::~vMemoryDC() - { - SysDebug(Destructor,"vMemoryDC::~vMemoryDC() destructor\n") - - if (!_memBM) - return; - - ::DeleteObject(_memBM); - _memBM = 0; - - } - -//====================>>> vMemoryDC::GetHDC <<<======================== - void vMemoryDC::GetHDC() VCONST - { - // Create the DC to draw into - - HDC appDC = ::GetDC(theApp->winHwnd()); // DC of the app - - if (_memBM == 0) // Need to create a bitmap - { - // Now create a bitmap - _memBM = ::CreateCompatibleBitmap(appDC,_physWidth,_physHeight); - } - - if (_memBM == 0) - { - ::ReleaseDC(theApp->winHwnd(),appDC); - return; - } - - // Now, create an HDC for the bitmap, compatible with the app DC - - _hdc = ::CreateCompatibleDC(appDC); - ::ReleaseDC(theApp->winHwnd(),appDC); // Done with app's dc - - _oldBM = static_cast(::SelectObject(_hdc,_memBM)); // Select into _hdc - - // We are now ready to use _hdc! - } - -//================>>> vMemoryDC::ReleaseHDC <<<======================== - void vMemoryDC::ReleaseHDC() VCONST - { - if (_hdc == 0) - return; - ::SelectObject(_hdc,_oldBM); // reselect old bm - ::DeleteDC(_hdc); // free the DC - } - -//=====================>>> vMemoryDC::Clear <<<========================== - void vMemoryDC::Clear(void) - { - ClearRect(0,0,_physWidth, _physHeight); - } - -//==================>>> vMemoryDC::ClearRect <<<========================== - void vMemoryDC::ClearRect(int left, int top, int width, int height) - { - // Clear a rectangluar area starting at left,top of width and height - - if (height == 0 || width == 0) - return; - - GetHDC(); // Get a DC to use - ::SetBkColor(_hdc, _canvasBG); - - HBRUSH brush = ::CreateSolidBrush(_canvasBG); - RECT rect; - - rect.top = top; rect.left = left; - rect.bottom = top+height; rect.right = left + width; - - ::FillRect(_hdc, &rect, brush); - ::DeleteObject(brush); // need to free the resource! - - ReleaseHDC(); // Release the DC - } - -//================>>> vMemoryDC::SetBackground <<<========================== - void vMemoryDC::SetBackground(VCONST vColor& color) - { - - _canvasBG = color.pixel(); // retrieve X pixel value - - GetHDC(); - ::SetBkColor(_hdc, _canvasBG); - ReleaseHDC(); - } - -//======================>>> vMemoryDC::SetFont <<<=========================== - void vMemoryDC::SetFont(VCONST vFont& vf) - { - // Change the font associated with this window. - - _font = vf; - } diff --git a/v/srcwin/vmenu.cpp b/v/srcwin/vmenu.cpp deleted file mode 100644 index be5ae1c..0000000 --- a/v/srcwin/vmenu.cpp +++ /dev/null @@ -1,369 +0,0 @@ -//=============================================================== -// vMenu.cxx - vMenuPane class functions - X11R5 -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include // our header -#include // we need access to vcmdwin - -#include - -// Define static data of the class - - static vMenu WindowMenu[] = // Items for File menu - { - {"&Cascade",M_Cascade,isSens,notChk,noKeyLbl,noKey,noSub}, - {"&Tile",M_Tile,isSens,notChk,noKeyLbl,noKey,noSub}, - {"&Arrange icons",M_Arrange,isSens,notChk,noKeyLbl,noKey,noSub}, - {NULL} - }; - - static char curLbl[100]; // for fixed labels - -//==================>>> vMenuPane::vMenuPane <<<=========================== - vMenuPane::vMenuPane(VCONST vMenu* menu) : vPane(P_Menu) - { - int i; - - // set up menus ----------------------------------------------- - - SysDebug(Constructor,"vMenuPane::vMenuPane() constructor\n") - - _nextMenuButton = 0; // no menus defined so far - - for (i = 0 ; i < MAX_MENU_BUTTONS ; ++i) - { - _mb[i].label = 0; // null out menu button array - _mb[i].hPullDown = 0; - _mb[i].SubMenu = 0; - } - - // copy the menus as defined to our array - - for (i = 0 ; i < MAX_MENU_BUTTONS && &menu[i] != 0 && menu[i].label; ++i) - { - _mb[i].label = menu[i].label; - _mb[i].SubMenu = menu[i].SubMenu; - } - if (i < MAX_MENU_BUTTONS && !theApp->simSDI()) - { - _mb[i].label = "&Window"; - _mb[i].SubMenu = &WindowMenu[0]; // Automatically add window menu - ++i; // fixup i - } - _nextSubMenu = // we will start submenus here - _nextMenuButton = i; // this many menus defined - _topLevelMenu = 0; - - } - -//==================>>> vMenuPane::vMenuPane <<<=========================== - vMenuPane::vMenuPane(const vMenuPane& m) : vPane(m) - { - - vSysError("V Semantics do not allow copy constructors."); - } - -//====================>>> vMenuPane::~vMenuPane <<<======================= - vMenuPane::~vMenuPane() // destructor - { - - SysDebug(Destructor,"vMenuPane::~vMenuPane() destructor\n") - - if (::IsMenu(_topLevelMenu)) // v1.22 - from Hilinski - ::DestroyMenu(_topLevelMenu); // Start with the top - - for (int i = _nextSubMenu - 1 ; i >= 0 ; --i) // all menus - { - if (::IsMenu(_mb[i].hPullDown)) - ::DestroyMenu(_mb[i].hPullDown); - delete _mb[i].mInfo; // free the space - } - } - -//======================>>> vMenuPane::initialize <<<======================= - void vMenuPane::initialize(vWindow* pWin, HWND hMenu) - { - vPane::initialize(pWin, hMenu); // initialize these - - _topLevelMenu = (HMENU)hMenu; // handle to menu bar - - // Now we have to add our menus - - for (int i = 0 ; i < _nextMenuButton ; ++i) - { - doAddMenu(i, _topLevelMenu); - } - pWin->_WindowMenuIndex = _nextMenuButton - 1; // Window menu - } - -//======================>>> vMenuPane::fixLabel <<<======================== - void vMenuPane::fixLabel(VCONST char* lbl, VCONST char* key) VCONST - { - // copy label to global curLbl - - VCONST char* cp; - int ix = 0; - - for (cp = lbl ; *cp && ix < 99 ; ++cp) // Scan label - { - curLbl[ix++] = *cp; - } - - if (key && *key) - { - curLbl[ix++] = ' '; curLbl[ix++] = ' '; curLbl[ix++] = '\t'; - for (cp = key ; *cp && ix < 99 ; ++cp) - { - curLbl[ix++] = *cp; - } - } - - curLbl[ix] = 0; // finish off - } - - -//======================>>> vMenuPane::doAddMenu <<<======================== - void vMenuPane::doAddMenu(int id, HMENU parent) - { - // create a button on the menu button bar - - _mb[id].hPullDown = ::CreateMenu(); // create submenu - - // loop through the list - - _mb[id].mInfo = 0; // empty list so far - - vMenu* item = _mb[id].SubMenu; // The first item in list - - MenuInfo* info; // for current info - for (int ix = 0 ; item[ix].label != 0 ; ++ix) - { - info = new MenuInfo; // new space or current tem - info->NxtInfo = _mb[id].mInfo; // add to front of list - _mb[id].mInfo = info; // fix front pointer - info->ItemIndex = ix; // index to item list - info->SubMenuIndex = 0; // no submenu normally - - if (item[ix].menuId == M_Line) - { - ::AppendMenu(_mb[id].hPullDown,MF_SEPARATOR,0,0); - } - else if (item[ix].SubMenu != 0) // a submenu - { - if(_nextSubMenu >= MAX_MENU_BUTTONS) - { - SysDebug(BadVals,"Too many submenus!\n"); - continue; - } - - // we will create a submenu - // copy the definitions, track the new index - - int sub = _nextSubMenu++; // get our index, bump for next time - - _mb[sub].label = item[ix].label; - _mb[sub].SubMenu = item[ix].SubMenu; - info->SubMenuIndex = sub; // no submenu normally - - // We create a dangling menu handle here. Windows seems - // to delete submenus of a menu, so we need to remember - // the parent menu, not the submenu. The recursive call - // replaces the parent menu handle with the submenu. - - HMENU subParent = ::CreateMenu(); // a submenu - - // Now, recursively call doAddMenu with the submenu - doAddMenu(sub, subParent); - - ::AppendMenu(_mb[id].hPullDown,MF_POPUP,(UINT)_mb[sub].hPullDown, - item[ix].label); - _mb[sub].hPullDown = subParent; - } - else - { - // create the item - - fixLabel(item[ix].label,item[ix].keyLabel); - ::AppendMenu(_mb[id].hPullDown,MF_STRING,(UINT)item[ix].menuId, - curLbl); - // item[ix].label); - if (item[ix].checked) // was it checked? - { - ::CheckMenuItem(_mb[id].hPullDown, - item[ix].menuId, MF_BYCOMMAND | MF_CHECKED); - } - if (!item[ix].sensitive) - { - ::EnableMenuItem(_mb[id].hPullDown, - item[ix].menuId, MF_BYCOMMAND | MF_GRAYED); - } - } - } - ::AppendMenu(parent,MF_POPUP,(int) (UINT)_mb[id].hPullDown, _mb[id].label); - } - -//====================>>> vMenuPane::CheckAccel <<<====================== - int vMenuPane::CheckAccel(vKey vkey, unsigned int shift, ItemVal& id) VCONST - { - // scan all menus in this window to see if this keystroke - // matches an accelerator key - - vMenu* item; - - // Search all menus in this list - for (int ix = 0 ; ix < _nextSubMenu ; ++ix) - { - MenuInfo* info; // for current info - - // scan the list of info for each menu entry - - for (info = _mb[ix].mInfo ; info != 0 ; info = info->NxtInfo) - { - item = _mb[ix].SubMenu; // The current item in list - // see if its menuId is the same as the one we are setting - if (item[info->ItemIndex].accel == vkey && - item[info->ItemIndex].kShift == shift && - item[info->ItemIndex].sensitive) // V 1.25, 6/1/00 - { - id = item[info->ItemIndex].menuId; - return 1; - } - } - } - - id = 0; - return 0; // assume 0 if not found - } - -//====================>>> vMenuPane::GetPaneValue <<<====================== - int vMenuPane::GetPaneValue(ItemVal id, int& val) VCONST - { - // scan all menus in this window to retrieve the what value - // then scan button bar if not found - - vMenu* item; - - // Search all menus in this list - for (int ix = 0 ; ix < _nextSubMenu ; ++ix) - { - MenuInfo* info; // for current info - - // scan the list of info for each menu entry - - for (info = _mb[ix].mInfo ; info != 0 ; info = info->NxtInfo) - { - item = _mb[ix].SubMenu; // The current item in list - // see if its menuId is the same as the one we are setting - if (item[info->ItemIndex].menuId == id) - { - // Ah Ha! We found the value we want - val = item[info->ItemIndex].checked; - return 1; - } - } - } - - val = 0; - return 0; // assume 0 if not found - } - -//==================>>> vMenuPane::SetPaneValue <<<======================== - void vMenuPane::SetPaneValue(ItemVal id, int val, ItemSetType setType) - { - // Set the given item on or off - - vMenu* item; - - // Search all menus in this list - for (int ix = 0 ; ix < _nextSubMenu ; ++ix) - { - MenuInfo* info; // for current info - - // scan the list of info for each menu entry - for (info = _mb[ix].mInfo ; info != 0 ; info = info->NxtInfo) - { - item = _mb[ix].SubMenu; // The current item in list - // see if its menuId is the same as the one we are setting - if (item[info->ItemIndex].menuId == id) - { - // Ah Ha! We found the value we want - switch (setType) - { - case Value: // check box - case Checked: // check box - { - item[info->ItemIndex].checked = val; - UINT action = val ? MF_BYCOMMAND | MF_CHECKED : - MF_BYCOMMAND | MF_UNCHECKED; - ::CheckMenuItem(_mb[ix].hPullDown, - item[info->ItemIndex].menuId,action); - break; - } - - case Sensitive: // sensitive - { - item[info->ItemIndex].sensitive = val; - UINT action = val ? MF_BYCOMMAND | MF_ENABLED : - MF_BYCOMMAND | MF_GRAYED; - ::EnableMenuItem(_mb[ix].hPullDown, - item[info->ItemIndex].menuId,action); - break; - } - } // end switch - } - } - } - } - -//================>>> vMenuPane::SetPaneString <<<======================== - void vMenuPane::SetPaneString(ItemVal id, VCONST char* str) - { - // Set the given item on or off - - vMenu* item; - - // Search all menus in this window - for (int ix = 0 ; ix < _nextSubMenu ; ++ix) - { - MenuInfo* info; // for current info - - // scan the list of info for each menu entry - for (info = _mb[ix].mInfo ; info != 0 ; info = info->NxtInfo) - { - item = _mb[ix].SubMenu; // The current item in list - - if (item[info->ItemIndex].menuId == id) - { - // Ah Ha! We found the value we want - - item[info->ItemIndex].label = str; - ::ModifyMenu(_mb[ix].hPullDown, // the menu - item[info->ItemIndex].menuId, // the id - MF_BYCOMMAND | MF_STRING, // change string - item[info->ItemIndex].menuId, // same id - item[info->ItemIndex].label); // new label - - if (item[info->ItemIndex].checked) // Changing string wipes out - { // checked and sensitive state - ::CheckMenuItem(_mb[ix].hPullDown, - item[info->ItemIndex].menuId,MF_BYCOMMAND | MF_CHECKED); - } - if (!item[info->ItemIndex].sensitive) - { - ::EnableMenuItem(_mb[ix].hPullDown, - item[info->ItemIndex].menuId,MF_BYCOMMAND | MF_GRAYED); - } - - ::DrawMenuBar(theApp->_Frame); - } - } - } - } diff --git a/v/srcwin/vmodald.cpp b/v/srcwin/vmodald.cpp deleted file mode 100644 index 26ca936..0000000 --- a/v/srcwin/vmodald.cpp +++ /dev/null @@ -1,81 +0,0 @@ -//=============================================================== -// vdialog.cxx - vdialog class functions - X11R5 -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include // our header -#include - -// Define static data of the class -// ... none ... - -//=================>>> vModalDialog::vModalDialog <<<===================== - vModalDialog::vModalDialog(VCONST vBaseWindow* creator, VCONST char* title) : - vDialog(creator, 1, title) // constructor - { - SysDebug(Constructor,"vModalDialog::vModalDialog(vBaseWindow) constructor\n") - } - -//=================>>> vModalDialog::vModalDialog <<<===================== - vModalDialog::vModalDialog(VCONST vApp* creator, VCONST char* title) : - vDialog(creator, 1, title) // constructor - { - - SysDebug(Constructor,"vModalDialog::vModalDialog(vApp) constructor\n") - - } - -//===============>>> vModalDialog::~vModalDialog <<<======================= - vModalDialog::~vModalDialog() - { - - SysDebug(Destructor,"vModalDialog::~vModalDialog() destructor\n") - - } - -//==================>>> vModalDialog::CloseDialog <<<======================= - void vModalDialog::CloseDialog(void) - { - vDialog::CloseDialog(); - _curModal = _oldModal; // V:1.13 - ::EndDialog(_wDialog,1); - } - -//=================>>> vModalDialog::DialogCommand <<<====================== - void vModalDialog::DialogCommand(ItemVal id, ItemVal retval, CmdType ctype) - { - // After the user has selected a command from the dialog, - // this routine is called with the value - - vDialog::DialogCommand(id, retval, ctype); - - _mdItemVal = retval; // for full modal return - _mdItemID = id; // must go after above call - _mdCmdType = ctype; - } - -//================>>> vModalDialog::ShowModalDialog <<<====================== - ItemVal vModalDialog::ShowModalDialog(VCONST char* msg, ItemVal& retval) - { - // This is a fully modal version that will allow the user a simple - // wait for an answer without needing the DialogCommand method - - // V:1.13 - Windows doesn't seem to handle nested modals very well... - // I don't know why. So I've added the logic with _oldModal and _curModal - // to handle nested modals correctly, I hope... - - _oldModal = _curModal; // V:1.13 - _curModal = this; - ShowDialog(msg); // Display the dialog - - retval = _mdItemVal; - return _mdItemID; // return the value - } - diff --git a/v/srcwin/vnotice.cpp b/v/srcwin/vnotice.cpp deleted file mode 100644 index 31d4fa6..0000000 --- a/v/srcwin/vnotice.cpp +++ /dev/null @@ -1,103 +0,0 @@ -//=============================================================== -// vnotice.cxx - vNoticeDialog class functions - Windows -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include // our header -#include -#include // for calc. of dialog position - TEH Dec97 - -// Define static data of the class - -#define bang_width 40 -#define bang_height 32 -static unsigned char bang_bits[] = { - 0x55, 0x55, 0x3d, 0x55, 0x55, 0xaa, 0xaa, 0x7e, 0xaa, 0xaa, 0x55, 0x55, - 0x7e, 0x55, 0x55, 0xaa, 0x2a, 0xe7, 0xaa, 0xaa, 0x55, 0x55, 0xc3, 0x54, - 0x55, 0xaa, 0xaa, 0xc3, 0xa9, 0xaa, 0x55, 0xd5, 0x99, 0x53, 0x55, 0xaa, - 0xca, 0x34, 0xab, 0xaa, 0x55, 0xe5, 0x6a, 0x57, 0x55, 0xaa, 0x72, 0x76, - 0xae, 0xaa, 0x55, 0x75, 0x6a, 0x4e, 0x55, 0xaa, 0x3a, 0x76, 0x9c, 0xaa, - 0x55, 0x19, 0x6a, 0x58, 0x55, 0xaa, 0x1c, 0x76, 0xb8, 0xaa, 0x55, 0x0e, - 0x6a, 0x70, 0x55, 0xaa, 0x06, 0x76, 0x60, 0xaa, 0x55, 0x07, 0x6a, 0xe0, - 0x54, 0xaa, 0x03, 0x76, 0xc0, 0xa9, 0x95, 0x03, 0x6a, 0xc0, 0x55, 0xca, - 0x01, 0x76, 0x80, 0xab, 0xd5, 0x00, 0x6a, 0x00, 0x53, 0xea, 0x00, 0x34, - 0x00, 0xa7, 0x75, 0x00, 0x18, 0x00, 0x4e, 0x72, 0x00, 0x00, 0x00, 0xae, - 0x39, 0x00, 0x3c, 0x00, 0x5c, 0x1c, 0x00, 0x76, 0x00, 0xb8, 0x1d, 0x00, - 0x6a, 0x00, 0x38, 0x0e, 0x00, 0x76, 0x00, 0xf0, 0x0f, 0x00, 0x3c, 0x00, - 0x70, 0x1e, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xfc, - 0xff, 0xff, 0xff, 0xbf}; - static vIcon bang((unsigned char*)&bang_bits[0], bang_height, bang_width); - - // Modified: TEH Jan98 - // Put icon + text in a frame so button is below frame. - // With many-line text displays, the button will always be below text. - static CommandObject NoticeDialog[] = - { - {C_Frame, 93, 0, "", - NoList, CA_NoSpace | CA_NoBorder, isSens, NoFrame, 0, 0}, - {C_Icon, 91, 0, "Notice", (void*)&bang, CA_None,isSens,93, 0, 0}, - {C_Text, 92, 0, "", - NoList, CA_MainMsg | CA_NoBorder, isSens, 93, 91, 0}, - {C_Button, M_OK, M_OK, " OK ", NoList, CA_DefaultButton, isSens, - NoFrame, 0, 93}, - {C_EndOfList,0,0,0,0,CA_None,0,0,0} - }; - -//======================>>> vNoticeDialog::Notice <<<======================= - void vNoticeDialog::Notice(VCONST char* msg) - { - // Show a message, and OK - // no important return - - int dummy; - - // TEH jan98; move before "if" as it is in vYNReplyDialog - NoticeDialog[2].title = msg; // BEW: V:1.13 - if (!_cmdsAdded) // Only once - { - AddDialogCmds(NoticeDialog); // Set up standard dialog - _cmdsAdded = 1; - } - (void) ShowModalDialog(msg,dummy); // show and wait - } - -//====================>>> vNoticeDialog::DialogCommand <<<======================= - void vNoticeDialog::DialogCommand(ItemVal id, ItemVal val, CmdType ctype) - { - vModalDialog::DialogCommand(id,val,ctype); - } - -// TEH Dec97 -// Added DialogDisplayed to handle the centering of the dialog in the app. -//==================>>> vNoticeDialog::DialogDisplayed <<<===================== - void vNoticeDialog::DialogDisplayed() - { - // center the dialog in the app window - RECT rctApp, rctDlg; // app and dialog corners - ::GetWindowRect(theApp->winHwnd(), &rctApp); - ::GetWindowRect(_wDialog, &rctDlg); - int widApp, htApp, widDlg, htDlg; // app and dialog dimensions - widApp = rctApp.right - rctApp.left; - htApp = rctApp.bottom - rctApp.top; - widDlg = rctDlg.right - rctDlg.left; - htDlg = rctDlg.bottom - rctDlg.top; - int left, top; // new dialog upper-left corner - if ( widApp > widDlg ) - left = (widApp - widDlg)/2; // don't add to left - SetDialogPosition does - else - left = rctApp.left; - if ( htApp > htDlg ) - top = (htApp - htDlg)/2; - else - top = rctApp.top; - SetDialogPosition (left , top); // set the position, in V coords - } - -// --------------------------------------------------------------------- diff --git a/v/srcwin/vos.cpp b/v/srcwin/vos.cpp deleted file mode 100644 index b8fee74..0000000 --- a/v/srcwin/vos.cpp +++ /dev/null @@ -1,260 +0,0 @@ -//=============================================================== -// -// vos.cpp - Interface to OS dependent stuff (For Windows) -// -// Copyright (C) 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== -#include -#include -#include -#include -//#include - -const int MaxCompNameLen = 256; - -//=========================>>> vOS::vOS <<<========================== - vOS::vOS() - { - // Constructor - // This will be used to determing which OS we are running - // under: e.g., NT vs 95 - } - -//=========================>>> vOS::~vOS <<<========================== - vOS::~vOS() - { - // Destructor - } - -//=========================>>> vOS::vDeleteFile <<<========================== - int vOS::vDeleteFile(const char* filename) - { - return ::DeleteFile(filename) == TRUE; - } - -//=========================>>> vOS::vRenameFile <<<========================== - int vOS::vRenameFile(const char* oldFilename, const char* newFilename) - { - return ::MoveFile((LPCTSTR)oldFilename,(LPCTSTR)newFilename) == TRUE; - } - -//=========================>>> vOS::vChDrive <<<========================== - int vOS::vChDrive(int drive) - { - char temp [3] = "-:"; - temp[0] = drive + 'A'; - return ::SetCurrentDirectory(temp); - } - -//=========================>>> vOS::vGetUserName <<<========================== - int vOS::vGetEnvVal(char* name, char* val, int maxlen) - { - return ::GetEnvironmentVariable(name,val,maxlen); - } - -//=========================>>> vOS::vGetUserName <<<========================== - int vOS::vGetUserName( char* s, int len) - { - // Set s to user name - - char UserName[MaxCompNameLen+1]; - DWORD cch = sizeof UserName; - - if (::GetUserName(UserName, &cch)) - { - if (strlen(UserName) > (unsigned int)len) - UserName[len-1] = 0; - strcpy(s, UserName); - return 1; - } - s[0] = 0; - return 0; - } - - -//=========================>>> vOS::vGetHostName <<<========================== - void vOS::vGetHostName(char* s, int len) - { - // Get host name - - char HostName[MaxCompNameLen+1]; - DWORD cch = MaxCompNameLen; - - if (::GetComputerName(HostName, &cch)) - { - strcpy(s,HostName); - } - else - strcpy(s, "PC_Win32"); - } - -//=========================>>> vOS::vGetPid <<<========================== - long vOS::vGetPid() - { - // return process ID - - return (long) ::GetCurrentProcessId(); - } - - -//=========================>>> vOS::vGetCWD <<<========================== - int vOS::vGetCWD(char* buf, int len) - { - // Get name of current directory - - int rv = ::GetCurrentDirectory(len, buf); - - return rv; - } - -//=========================>>> vOS::vChDir <<<========================== - int vOS::vChDir(const char *path) - { - if (path[0] == 0) /* just checking... */ - return 0; - - if (*path == 0) /* drive name only */ - return 0; - - return ::SetCurrentDirectory(path); /* let the normal chdir() do the rest */ - } - -//=========================>>> vOS::vSleep <<<========================== - void vOS::vSleep(long MSec) - { - ::Sleep(MSec); - } - -//=========================>>> vOS::vRunProcess <<<========================== - int vOS::vRunProcess(const char* cmd, const char* StdOut, const char* StdErr, - const int Wait, const int minimize) - { - STARTUPINFO si; - PROCESS_INFORMATION pi; - DWORD ret = 0; - -// ::AllocConsole(); - - si.cb = sizeof(si); - si.lpReserved = 0; - si.lpDesktop = 0; - si.lpTitle = 0; - si.dwFlags = 0; - si.cbReserved2 = 0; - si.lpReserved2 = 0; - si.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES ; - if (minimize) - si.wShowWindow = SW_MINIMIZE; - else - si.wShowWindow = SW_SHOWNORMAL; - - HANDLE hNewStderr = INVALID_HANDLE_VALUE; - HANDLE hNewStdout = INVALID_HANDLE_VALUE; - - - if (StdErr && *StdErr) // they specified a stderr out - { - hNewStderr = ::CreateFile( - StdErr, // address of name of the file - GENERIC_WRITE , // access (read-write) mode - (DWORD) 0, // share mode - (LPSECURITY_ATTRIBUTES) 0, // address of security descriptor - CREATE_ALWAYS , // how to create - FILE_ATTRIBUTE_NORMAL, // file attributes - (HANDLE) 0 // handle of file with attributes to copy - ); - } - - if (StdOut && *StdOut) // they specified a stderr out - { - hNewStdout = ::CreateFile( - StdOut, // address of name of the file - GENERIC_WRITE , // access (read-write) mode - (DWORD) 0, // share mode - (LPSECURITY_ATTRIBUTES) 0, // address of security descriptor - CREATE_ALWAYS , // how to create - FILE_ATTRIBUTE_NORMAL, // file attributes - (HANDLE) 0 // handle of file with attributes to copy - ); - } - - HANDLE myself = ::GetCurrentProcess(); //my own process handle - HANDLE dupStdout = INVALID_HANDLE_VALUE; - HANDLE dupStderr = INVALID_HANDLE_VALUE; - - - si.hStdInput = ::GetStdHandle(STD_INPUT_HANDLE); - - if (hNewStdout != INVALID_HANDLE_VALUE) // specified out file - { - ::DuplicateHandle(myself, hNewStdout , - myself,&dupStdout,0, TRUE, DUPLICATE_SAME_ACCESS); - si.hStdOutput = dupStdout; - } - else - { - si.hStdOutput = ::GetStdHandle(STD_OUTPUT_HANDLE); - } - - if (hNewStderr != INVALID_HANDLE_VALUE) // specified err file - { - ::DuplicateHandle(myself, hNewStderr , - myself,&dupStderr,0, TRUE, DUPLICATE_SAME_ACCESS); - si.hStdError = dupStderr; - } - else - { - si.hStdError = ::GetStdHandle(STD_ERROR_HANDLE); - } - -// CREATE_NEW_CONSOLE, /* Creation flags */ - // Now, run the command - if (!::CreateProcess (0, /* Executable name */ - (char *)cmd, /* Command to execute */ - 0, /* Process security attributes */ - 0, /* Thread security attributes */ - TRUE, /* Inherit handles */ - 0, // create flags - 0, /* Environment */ - 0, /* Current directory */ - &si, /* Startup information */ - &pi)) /* Process information */ - { - if (dupStdout != INVALID_HANDLE_VALUE) - ::CloseHandle(dupStdout); - if (dupStderr != INVALID_HANDLE_VALUE) - ::CloseHandle(dupStderr); - return 99; - } - - if (dupStdout != INVALID_HANDLE_VALUE) - ::CloseHandle(dupStdout); - if (dupStderr != INVALID_HANDLE_VALUE) - ::CloseHandle(dupStderr); - -// ::FreeConsole(); - if (!Wait) - return 0; - - - /* Wait for the command to terminate before continuing */ - ::WaitForSingleObject(pi.hProcess, INFINITE); - - /* Get the command exit code */ - ::GetExitCodeProcess(pi.hProcess, &ret); - - /* Close the handles to the subprocess, so that it goes away */ - ::CloseHandle(pi.hThread); - ::CloseHandle(pi.hProcess); - if (hNewStdout != INVALID_HANDLE_VALUE) - ::CloseHandle(hNewStdout); - if (hNewStderr != INVALID_HANDLE_VALUE) - ::CloseHandle(hNewStderr); - - return ret; - } diff --git a/v/srcwin/vpen.cpp b/v/srcwin/vpen.cpp deleted file mode 100644 index 0b30a21..0000000 --- a/v/srcwin/vpen.cpp +++ /dev/null @@ -1,139 +0,0 @@ -//=============================================================== -// vpen.cxx: vColor class for drawing - Windows -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include -#include - -//=======================>>> vPen::vPen <<<=========================== - vPen::vPen(unsigned int r, unsigned int g, unsigned int b, - int width, int style) - { - penColor._r = r, penColor._g = g; penColor._b = b; - penColor._pixel = RGB(r,g,b); - penWidth = width; penStyle = style; _created = 0; _hpen = 0; - } - -//=======================>>> vPen::~vPen <<<=========================== - vPen::~vPen() - { - ReleaseHpen(); - } - -//=====================>>> vPen::vPen <<<=========================== - vPen::vPen(const vPen& p) - { - _created = 0; - _hpen = 0; - penColor = p.penColor; - penWidth = p.penWidth; - penStyle = p.penStyle; - } - -//=====================>>> vPen::operator= <<<=========================== - vPen & vPen::operator =(const vPen& p) - { - if (this == &p) // assigning to self - { - return *this; - } - - ReleaseHpen(); - // now just like a copy constructor - penColor = p.penColor; - penWidth = p.penWidth; - penStyle = p.penStyle; - - return *this; // allow r to l multiple assignment - } - -//=====================>>> vPen::SetStyle <<<=========================== - void vPen::SetStyle(int style) - { - if (style == penStyle) - return; // no change - penStyle = style; - ReleaseHpen(); - } - -//=====================>>> vPen::SetWidth <<<=========================== - void vPen::SetWidth(int width) - { - if (width == penWidth) - return; // no change - penWidth = width; - ReleaseHpen(); - } - - -//=====================>>> vPen::SetColor <<<=========================== - void vPen::SetColor(const vColor& c) - { - if (c == penColor) - return; // no change - penColor = c; - ReleaseHpen(); - } - -//=====================>>> vPen::SetColor <<<=========================== - void vPen::SetColor(unsigned int r, unsigned int g, unsigned int b) - { - if (penColor.r() == r && penColor.g() == g && penColor.b() == b) - return; // no change - - penColor.Set(r,g,b); - ReleaseHpen(); - } - - -//=====================>>> vPen::GetHPEN <<<=========================== - HPEN vPen::GetHPEN() VCONST - { - if (!_created) - { - int ps; - int pw = penWidth; - - switch (penStyle) - { - case vSolid: - ps = PS_SOLID; - break; - - case vTransparent: - ps = PS_NULL; - break; - - case vDash: - ps = PS_DASH; - pw = 1; // $#$% Windows only allows width of 1 - break; - - case vDot: - ps = PS_DOT; - pw = 1; - break; - - case vDashDot: - ps = PS_DASHDOT; - pw = 1; - break; - - default: - ps = PS_SOLID; - break; - } - - _hpen = ::CreatePen(ps, pw, penColor._pixel); - _created = 1; - } - return _hpen; // return a created pen handle - } diff --git a/v/srcwin/vpopmenu.cpp b/v/srcwin/vpopmenu.cpp deleted file mode 100644 index eb96863..0000000 --- a/v/srcwin/vpopmenu.cpp +++ /dev/null @@ -1,332 +0,0 @@ -//=============================================================== -// vPopMenu.cpp - vPopupMenu class functions - Windows -// -// Copyright (C) 1995-1999 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include // our header -#include // we need access to vcmdwin - -#include - -// Define static data of the class - - static char curLbl[100]; // for fixed labels - - -//==================>>> vPopupMenu::vPopupMenu <<<=========================== - vPopupMenu::vPopupMenu(VCONST vMenu* menu, VCONST vWindow* pWin) - { - int i; - - // set up menus ----------------------------------------------- - - SysDebug(Constructor,"vPopupMenu::vPopupMenu() constructor\n") - - _pWin = const_cast(pWin); - - _nextMenuButton = 0; // no menus defined so far - - for (i = 0 ; i < MAX_PMENU_BUTTONS ; ++i) - { - _mb[i].label = 0; // null out menu button array - _mb[i].hPullDown = 0; - _mb[i].SubMenu = 0; - _mb[i].mInfo = 0; - } - - _mb[0].label = ""; - _mb[0].SubMenu = const_cast(menu); - _nextSubMenu = // we will start submenus here - _nextMenuButton = 1; // this many menus defined - _topLevelMenu = 0; - - } - -//==================>>> vPopupMenu::vPopupMenu <<<=========================== - vPopupMenu::vPopupMenu(const vPopupMenu& /* m */) - { - - vSysError("V Semantics do not allow copy constructors."); - } - -//====================>>> vPopupMenu::~vPopupMenu <<<======================= - vPopupMenu::~vPopupMenu() // destructor - { - - SysDebug(Destructor,"vPopupMenu::~vPopupMenu() destructor\n") - - for (int i = _nextSubMenu - 1 ; i >= 0 ; --i) // all menus - { - ::DestroyMenu(_mb[i].hPullDown); - if (_mb[i].mInfo != 0) - delete _mb[i].mInfo; // free the space - } - } - -//======================>>> vPopupMenu::initialize <<<======================= - void vPopupMenu::initialize() - { - - if (_topLevelMenu != 0) // already initialized? - return; - _topLevelMenu = (HMENU)::CreatePopupMenu(); // Create a popup menu - - // Now we have to add our menus - - doAddMenu(0, _topLevelMenu); - } - -//======================>>> vPopupMenu::fixLabel <<<======================== - void vPopupMenu::fixLabel(VCONST char* lbl, VCONST char* key) VCONST - { - // copy label to global curLbl - - VCONST char* cp; - int ix = 0; - - for (cp = lbl ; *cp && ix < 99 ; ++cp) // Scan label - { - curLbl[ix++] = *cp; - } - - if (key && *key) - { - curLbl[ix++] = ' '; curLbl[ix++] = ' '; curLbl[ix++] = '\t'; - for (cp = key ; *cp && ix < 99 ; ++cp) - { - curLbl[ix++] = *cp; - } - } - - curLbl[ix] = 0; // finish off - } - - -//======================>>> vPopupMenu::doAddMenu <<<======================== - void vPopupMenu::doAddMenu(int id, HMENU parent) - { - // create a button on the menu button bar - - _mb[id].hPullDown = parent; - - // loop through the list - - _mb[id].mInfo = 0; // empty list so far - - vMenu* item = _mb[id].SubMenu; // The first item in list - - PMenuInfo* info; // for current info - for (int ix = 0 ; item[ix].label != 0 ; ++ix) - { - info = new PMenuInfo; // new space or current tem - info->NxtInfo = _mb[id].mInfo; // add to front of list - _mb[id].mInfo = info; // fix front pointer - info->ItemIndex = ix; // index to item list - info->SubMenuIndex = 0; // no submenu normally - - if (item[ix].menuId == M_Line) - { - ::AppendMenu(_mb[id].hPullDown,MF_SEPARATOR,0,0); - } - else if (item[ix].SubMenu != 0) // a submenu - { - if(_nextSubMenu >= MAX_PMENU_BUTTONS) - { - SysDebug(BadVals,"Too many submenus!\n"); - continue; - } - - // we will create a submenu - // copy the definitions, track the new index - - int sub = _nextSubMenu++; // get our index, bump for next time - - _mb[sub].label = item[ix].label; - _mb[sub].SubMenu = item[ix].SubMenu; - info->SubMenuIndex = sub; // no submenu normally - - // We create a dangling menu handle here. Windows seems - // to delete submenus of a menu, so we need to remember - // the parent menu, not the submenu. The recursive call - // replaces the parent menu handle with the submenu. - - HMENU subParent = ::CreateMenu(); // a submenu - - // Now, recursively call doAddMenu with the submenu - doAddMenu(sub, subParent); - - ::AppendMenu(_mb[id].hPullDown,MF_POPUP,(UINT)_mb[sub].hPullDown, - item[ix].label); - _mb[sub].hPullDown = subParent; - } - else - { - // create the item - - fixLabel(item[ix].label,item[ix].keyLabel); - ::AppendMenu(_mb[id].hPullDown,MF_STRING,(UINT)item[ix].menuId, - curLbl); - // item[ix].label); - if (item[ix].checked) // was it checked? - { - ::CheckMenuItem(_mb[id].hPullDown, - item[ix].menuId, MF_BYCOMMAND | MF_CHECKED); - } - if (!item[ix].sensitive) - { - ::EnableMenuItem(_mb[id].hPullDown, - item[ix].menuId, MF_BYCOMMAND | MF_GRAYED); - } - } - } - } - -//====================>>> vPopupMenu::ShowMenu <<<====================== - void vPopupMenu::ShowMenu(int x, int y) - { - HWND parent = _pWin->winHwnd(); - - POINT pt; - - initialize(); // initialize (if not already) - - pt.x = x; pt.y = y; - ::ClientToScreen(parent ,&pt); - - ::TrackPopupMenu(_topLevelMenu, - TPM_LEFTALIGN|TPM_RIGHTBUTTON|TPM_LEFTBUTTON, - pt.x, pt.y, - 0, - parent, - NULL); - - } - -//====================>>> vPopupMenu::GetValue <<<====================== - int vPopupMenu::GetValue(ItemVal id) VCONST - { - // scan all menus in this window to retrieve the what value - // then scan button bar if not found - - vMenu* item; - - // Search all menus in this list - for (int ix = 0 ; ix < _nextSubMenu ; ++ix) - { - PMenuInfo* info; // for current info - - // scan the list of info for each menu entry - - for (info = _mb[ix].mInfo ; info != 0 ; info = info->NxtInfo) - { - item = _mb[ix].SubMenu; // The current item in list - // see if menuId is the same as the one we are setting - if (item[info->ItemIndex].menuId == id) - { - // Ah Ha! We found the value we want - return item[info->ItemIndex].checked; - } - } - } - - return 0; // assume 0 if not found - } - -//==================>>> vPopupMenu::SetValue <<<======================== - void vPopupMenu::SetValue(ItemVal id, int val, ItemSetType setType) - { - // Set the given item on or off - - vMenu* item; - - // Search all menus in this list - for (int ix = 0 ; ix < _nextSubMenu ; ++ix) - { - PMenuInfo* info; // for current info - - // scan the list of info for each menu entry - for (info = _mb[ix].mInfo ; info != 0 ; info = info->NxtInfo) - { - item = _mb[ix].SubMenu; // The current item in list - // see if its menuId is the same as the one we are setting - if (item[info->ItemIndex].menuId == id) - { - // Ah Ha! We found the value we want - switch (setType) - { - case Value: // check box - case Checked: // check box - { - item[info->ItemIndex].checked = val; - UINT action = val ? MF_BYCOMMAND | MF_CHECKED : - MF_BYCOMMAND | MF_UNCHECKED; - ::CheckMenuItem(_mb[ix].hPullDown, - item[info->ItemIndex].menuId,action); - break; - } - - case Sensitive: // sensitive - { - item[info->ItemIndex].sensitive = val; - UINT action = val ? MF_BYCOMMAND | MF_ENABLED : - MF_BYCOMMAND | MF_GRAYED; - ::EnableMenuItem(_mb[ix].hPullDown, - item[info->ItemIndex].menuId,action); - break; - } - } // end switch - } - } - } - } - -//================>>> vPopupMenu::SetString <<<======================== - void vPopupMenu::SetString(ItemVal id, VCONST char* str) - { - // Set the given item on or off - - vMenu* item; - - // Search all menus in this window - for (int ix = 0 ; ix < _nextSubMenu ; ++ix) - { - PMenuInfo* info; // for current info - - // scan the list of info for each menu entry - for (info = _mb[ix].mInfo ; info != 0 ; info = info->NxtInfo) - { - item = _mb[ix].SubMenu; // The current item in list - - if (item[info->ItemIndex].menuId == id) - { - // Ah Ha! We found the value we want - - item[info->ItemIndex].label = str; - ::ModifyMenu(_mb[ix].hPullDown, // the menu - item[info->ItemIndex].menuId, // the id - MF_BYCOMMAND | MF_STRING, // change string - item[info->ItemIndex].menuId, // same id - item[info->ItemIndex].label); // new label - - if (item[info->ItemIndex].checked) // Changing string wipes out - { // checked and sensitive state - ::CheckMenuItem(_mb[ix].hPullDown, - item[info->ItemIndex].menuId,MF_BYCOMMAND | MF_CHECKED); - } - if (!item[info->ItemIndex].sensitive) - { - ::EnableMenuItem(_mb[ix].hPullDown, - item[info->ItemIndex].menuId,MF_BYCOMMAND | MF_GRAYED); - } - - } - } - } - } diff --git a/v/srcwin/vprogrsc.cpp b/v/srcwin/vprogrsc.cpp deleted file mode 100644 index 7d591a6..0000000 --- a/v/srcwin/vprogrsc.cpp +++ /dev/null @@ -1,246 +0,0 @@ -//=============================================================== -// vprogrsc.cxx - Progress Bar - Windows -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include // our definitions -#include // a command parent -#include -#include - - -//=================>>> vProgressCmd::vProgressCmd <<<======================= - vProgressCmd::vProgressCmd(vCmdParent* dp, CommandObject* dc) : - vCmd(dp, dc) - { - initialize(); // and initialize - } - -//=======================>>> vProgressCmd::~vProgressCmd <<<=================== - vProgressCmd::~vProgressCmd() - { - - SysDebug(Constructor,"vProgressCmd::~vProgressCmd() Destructor\n") - - } - -//=====================>>> vProgressCmd::initialize <<<======================= - void vProgressCmd::initialize() - { - - SysDebug(Constructor,"vProgressCmd::vProgressCmd() constructor\n") - - CopyToLocal(); - - long style; - - style = WS_GROUP; // Make local copies of CmdObject - - if (!(dlgCmd->attrs & CA_Hidden)) // Check for Hidden - style |= WS_VISIBLE; - - style |= BS_OWNERDRAW; // We are drawing this - - _isVert = (dlgCmd->attrs & CA_Vertical); - - int ProgressHeight = (dlgCmd->attrs & CA_Large) ? 150 : 100; - if ((dlgCmd->attrs) & CA_Small) - ProgressHeight = 50; - if (dlgCmd->size > 0) - ProgressHeight = dlgCmd->size; // they gave size - - int* minMax = (int *)_itemList; // giving range? - _minVal = 0; _maxVal = 100; // default min/max - if (minMax != 0) // They gave a range list - { - _minVal = minMax[0]; - _maxVal = minMax[1]; - } - if (_minVal > _maxVal) - { - SysDebug2(BadVals,"vProgressCmd:vProgressCmd - bad range %d to %d\n",_minVal,_maxVal) - _minVal = 0; _maxVal = 100; // make some sense! - } - - if (_retVal < _minVal) // set a legal value for the top - _curVal = _minVal; - else if (_retVal > _maxVal) - _curVal = _maxVal; - else - _curVal = _retVal; - - if (_isVert) // set sizes for V or H - { - _h = ProgressHeight; - _w = 10; - } - else - { - _h = 14; - _w = ProgressHeight; - } - - _parentWin->SetPosition(_x, _y, _w, _h, dlgCmd->cFrame, dlgCmd->cRightOf, - dlgCmd->cBelow); - _CtrlOffset = _parentWin->AddDlgControl(_x, _y, _w, _h, _cmdId, - style, "BUTTON", _title, sizeof(vProgressCmd*), (LPBYTE)this); - } - -//==================>>> vProgressCmd::GetCmdValue <<<========================= - int vProgressCmd::GetCmdValue(ItemVal id) VCONST - { - if (id != _cmdId) - return -1; - return _curVal; - } - -//=====================>>> vProgressCmd::SetCmdVal <<<========================= - void vProgressCmd::SetCmdVal(ItemVal val, ItemSetType st) - { - - SysDebug2(Misc,"vProgressCmd::SetCmdVal(val:%d, type:%d)\n",val,st) - HWND myHwnd = GetMyHwnd(_cmdId); - if (st == Value) - { - if (val > _maxVal || val < _minVal ) - return; - _curVal = val; - // Let Windows force the redraw - ::RedrawWindow(myHwnd,NULL,NULL,RDW_INVALIDATE); - } - else if (st == Hidden) // hide or unhide - { - if (val) - { - ::ShowWindow(myHwnd,SW_HIDE); - } - else - { - ::ShowWindow(myHwnd,SW_SHOW); - } - } - } - -//================>>> vProgressCmd::MEASUREITEM <<<============================ - int vProgressCmd::MEASUREITEM(int id, MEASUREITEMSTRUCT* mis) - { - mis->CtlType = ODT_BUTTON; - mis->CtlID = id; - mis->itemWidth = _w; - mis->itemHeight = _h; - - return 1; - } - -//================>>> vProgressCmd::DRAWITEM <<<============================ - int vProgressCmd::DRAWITEM(int /*id*/, DRAWITEMSTRUCT* dis) - { - switch (dis->itemAction) - { - case ODA_DRAWENTIRE: // redraw entire control - { - HBRUSH pBrush; - if (::GetSysColor(COLOR_SCROLLBAR) == ::GetSysColor(COLOR_BTNFACE)) - pBrush = ::CreateSolidBrush(RGB(128,128,128)); - else - pBrush = ::CreateSolidBrush(::GetSysColor(COLOR_SCROLLBAR)); - - HPEN oldpen = (HPEN) ::SelectObject(dis->hDC, GetStockObject(NULL_PEN)); - - HBRUSH oldbrush = static_cast(::SelectObject(dis->hDC, pBrush)); - - (void)::Rectangle(dis->hDC,dis->rcItem.left, dis->rcItem.top, - dis->rcItem.right, dis->rcItem.bottom); - - ::SelectObject(dis->hDC, theApp->_ShadowPen); - ::MoveTo(dis->hDC, dis->rcItem.left+1, dis->rcItem.bottom-1); - ::LineTo(dis->hDC, dis->rcItem.left+1, dis->rcItem.top+1); - ::LineTo(dis->hDC, dis->rcItem.right-1, dis->rcItem.top+1); - - ::SelectObject(dis->hDC,theApp->_LightPen); - - ::LineTo(dis->hDC, dis->rcItem.right-1, dis->rcItem.bottom-1); - ::LineTo(dis->hDC, dis->rcItem.left+1, dis->rcItem.bottom-1); - - // Now Draw the Progress part inside - ::SelectObject(dis->hDC, theApp->_LightPen); - - ::SelectObject(dis->hDC, theApp->_BarBrush); - - long screensize = (_isVert) ? - dis->rcItem.bottom - dis->rcItem.top - 2 : - dis->rcItem.right - dis->rcItem.left - 2; - long ctrlsize = _maxVal - _minVal; - int delta = (int) (screensize - ((screensize * (_curVal-_minVal)) / ctrlsize)); - - if (_curVal == _minVal) - delta = screensize; - else if (_curVal == _maxVal) - delta = 0; - - RECT pr; - if (_isVert) - { - pr.top = dis->rcItem.top + delta + 2; - pr.right = dis->rcItem.right - 2; - pr.bottom = dis->rcItem.bottom - 2; - pr.left = dis->rcItem.left + 2; - } - else - { - pr.top = dis->rcItem.top + 2; - pr.right = dis->rcItem.right - 2 - delta; - pr.bottom = dis->rcItem.bottom - 2; - pr.left = dis->rcItem.left + 2; - } - - - if (delta != screensize) // clean look for 0 - { - (void)::Rectangle(dis->hDC,pr.left, pr.top, - pr.right, pr.bottom); - ::MoveTo(dis->hDC, pr.left+1, pr.bottom-1); - ::LineTo(dis->hDC, pr.left+1, pr.top+1); - ::LineTo(dis->hDC, pr.right-1, pr.top+1); - - ::SelectObject(dis->hDC, theApp->_ShadowPen); - if (_isVert) - ::LineTo(dis->hDC, pr.right-1, pr.bottom-1); - else - ::MoveTo(dis->hDC, pr.right-1, pr.bottom-1); - ::LineTo(dis->hDC, pr.left+1, pr.bottom-1); - } - - // Draw a Label now? - if (!(dlgCmd->attrs & CA_NoLabel)) - { - char buff[20]; - IntToStr(_curVal,buff); // string representation - if (dlgCmd->attrs & CA_Percent) - strcat(buff,"%"); - - //::SetBkColor(dis->hDC, _color.pixel()); - int oldBkMode = ::GetBkMode(dis->hDC); - ::SetBkMode(dis->hDC,TRANSPARENT); - ::DrawText(dis->hDC, buff, strlen(buff), - &dis->rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE); - ::SetBkMode(dis->hDC,oldBkMode); - } - - ::SelectObject(dis->hDC, oldpen); // restore hdc - ::SelectObject(dis->hDC, oldbrush); - ::DeleteObject(pBrush); - } - - default: - break; - } - return 0; - } diff --git a/v/srcwin/vradioc.cpp b/v/srcwin/vradioc.cpp deleted file mode 100644 index 32cf55c..0000000 --- a/v/srcwin/vradioc.cpp +++ /dev/null @@ -1,215 +0,0 @@ -//=============================================================== -// vradiocc.cxx - RadioButtons - Windows -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include // our definitions -#include // a command parent -#include -#include - - vRadioButtonCmd* vRadioButtonCmd::_RBList = 0; // empty list to start - -//================>>> vRadioButtonCmd::vRadioButtonCmd <<<===================== - vRadioButtonCmd::vRadioButtonCmd(vCmdParent* dp, CommandObject* dc) : - vCmd(dp, dc) - { - // Create bitmaps if need to - - - SysDebug(Constructor,"vRadioButtonCmd::vRadioButtonCmd() constructor\n") - - initialize(); // and initialize - } - -//================>>> vRadioButtonCmd::vRadioButtonCmd <<<===================== - vRadioButtonCmd::vRadioButtonCmd(const vRadioButtonCmd& r) : - vCmd(r) - { - vSysError("vRadioButtonCmd - V semantics do not support copy constructors!"); - } - -//===========>>> vRadioButtonCmd::~vRadioButtonCmd <<<====================== - vRadioButtonCmd::~vRadioButtonCmd() - { - // We have to remove ourself from the list of all RBs - - - SysDebug(Destructor,"vRadioButtonCmd::~vRadioButtonCmd() destructor\n") - - if (_RBList == this) // first one special - { - _RBList = _nextRB; - } - else - { - for (vRadioButtonCmd* rbl = _RBList ; rbl != 0 ; rbl = rbl->_nextRB) - { - if (rbl->_nextRB == this) // we found ourself! - { - rbl->_nextRB = _nextRB; // unlink us - break; - } - } - } - } - -//=====================>>> vRadioButtonCmd::initialize <<<======================= - void vRadioButtonCmd::initialize(void) - { - // build a button command for use in a parent window - - - _nextRB = _RBList; // add us in to front of list - _RBList = this; - - long style = WS_TABSTOP | WS_GROUP | BS_RADIOBUTTON; // default for a button - - CopyToLocal(); // Make local copies of CmdObject - - if (!(dlgCmd->attrs & CA_Hidden)) // Check for Hidden - style |= WS_VISIBLE; - - - _w = vLblLen(_title)*4+14; // set my width - _h = 11; - - - _parentWin->SetPosition(_x, _y, _w, _h+3, dlgCmd->cFrame, dlgCmd->cRightOf, - dlgCmd->cBelow); - _y += 2; // Center better - _CtrlOffset = _parentWin->AddDlgControl(_x, _y, _w, _h, _cmdId, - style, "BUTTON", _title, sizeof(vCmd*), (LPBYTE)this); - } - -//================>>> vRadioButtonCmd::ResetItemValue <<<====================== - void vRadioButtonCmd::ResetItemValue(void) - { - - // We have to toggle things - - if (_retVal == _origVal) // No op if no change - return; - - _retVal = _origVal; // restore - ::CheckDlgButton(_parentWin->getParent(), _cmdId, _retVal); - - // let parent window handle now - _parentWin->ProcessCmd(_cmdId, _retVal, dlgCmd->cmdType); - } - -//==================>>> vRadioButtonCmd::GetCmdValue <<<========================= - int vRadioButtonCmd::GetCmdValue(ItemVal id) VCONST - { - if (id != _cmdId) - return -1; - return _retVal; - } - -//================>>> vRadioButtonCmd::SetCmdVal <<<======================== - void vRadioButtonCmd::SetCmdVal(ItemVal val, ItemSetType st) - { - - SysDebug1(Misc,"vRadioButtonCmd::SetCmdVal(val:%d)\n",val) - - HWND myHwnd = GetMyHwnd(_cmdId); - - if (st == Sensitive) - { - _Sensitive = val; // set - EnableWindow(myHwnd, val); - } - else if (st == Hidden) // hide or unhide - { - if (val) - { - ::ShowWindow(myHwnd,SW_HIDE); - } - else - { - ::ShowWindow(myHwnd,SW_SHOW); - } - } - else if (st == Value || st == Checked) - { - _retVal = val; // set - if (_retVal) // Need to turn off other - { - // We have to toggle things, so scan the list of all radio buttons, - // searching for other buttons in the same frame - - ItemVal ourFrame = dlgCmd->cFrame; // remember our frame - - for (vRadioButtonCmd* rbl = _RBList ; rbl != 0 ; rbl = rbl->_nextRB) - { - CommandObject* dc = rbl->dlgCmd; // shorthand - - if (dc->cFrame == ourFrame) // Radio Button in same frame - { - if (rbl->_retVal && rbl->_cmdId != _cmdId) // This one was ON, turn off - { - rbl->_retVal = 0; // toggle - ::CheckDlgButton(_parentWin->getParent(),rbl->_cmdId, 0); - break; - } - } - } - } - - ::CheckDlgButton(_parentWin->getParent(), _cmdId, val); - } - } - -//================>>> vRadioButtonCmd::SetCmdStr <<<========================= - void vRadioButtonCmd::SetCmdStr(VCONST char *str) - { - - SysDebug1(Misc,"vRadioButtonCmd::SetCmdStr(str:%s)\n",str) - SetDlgItemText(_parentWin->getParent(), _cmdId, str); - _title = str; - } - -//====================>>> vRadioButtonCmd::CmdCallback <<<======================= - void vRadioButtonCmd::CmdCallback(int /* id */, WORD /*codeNotify*/) - { - - // We have to toggle things, so scan the list of all radio buttons, - // searching for other buttons in the same frame - - ItemVal ourFrame = dlgCmd->cFrame; // remember our frame - - for (vRadioButtonCmd* rbl = _RBList ; rbl != 0 ; rbl = rbl->_nextRB) - { - CommandObject* dc = rbl->dlgCmd; // shorthand - - if (dc->cFrame == ourFrame) // Radio Button in same frame - { - if (rbl->_retVal && rbl->_cmdId != _cmdId) // This one was ON, turn off - { - rbl->_retVal = 0; // toggle - ::CheckDlgButton(_parentWin->getParent(),rbl->_cmdId, 0); - - // inform parent of change - _parentWin->ProcessCmd(rbl->_cmdId, rbl->_retVal, dc->cmdType); - break; - } - } - } - - // Now, we need to turn this RadioButton ON - if (!_retVal) - { - _retVal = 1; // toggle - SetCmdVal(1,Checked); - - // and let the parent window know about the change - _parentWin->ProcessCmd(_cmdId, _retVal, dlgCmd->cmdType); - } - } diff --git a/v/srcwin/vrepldlg.cpp b/v/srcwin/vrepldlg.cpp deleted file mode 100644 index 43f1039..0000000 --- a/v/srcwin/vrepldlg.cpp +++ /dev/null @@ -1,126 +0,0 @@ -//=============================================================== -// vrepldlg.cxx - vReplaceDialog class functions - common win/x -// -// Copyright (C) 1995-1999 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // our header -#include // for icon -#include - -// Define static data of the class - - static CommandObject ReplDialog[] = - { - - {C_Frame, 79, 0, "",NoList,CA_NoBorder,isSens,NoFrame,0,0}, - {C_Frame, 80, 0, "",NoList,CA_None,isSens,79,0,0}, - - {C_Label, 69, 0, " ",NoList, - CA_None,isSens,80, 0,0}, - {C_Label, 91, 0, "Text to find",NoList, - CA_None,isSens,80, 69,0}, - {C_TextIn, 92, 0, "", NoList, - CA_Large,isSens,80,91,0}, - {C_Label, 98, 0, " New Text",NoList, - CA_None,isSens,80, 69,92}, - {C_TextIn, 99, 0, "", NoList, - CA_Large,isSens,80,91,92}, - - - {C_Frame, 81, 0, "",NoList,CA_None,isSens,79,0,80}, - {C_Label, 60, 0, "Search Range",NoList, - CA_None,isSens,81, 0,0}, - {C_RadioButton, 93, 1,"From Cursor",NoList,CA_None, - notSens,81,0,60}, - {C_RadioButton, 94, 0,"Entire File",NoList,CA_None, - notSens,81,0,93}, - - {C_Frame, 82, 0, "",NoList,CA_None,isSens,79,81,80}, - {C_Label, 61, 0, "Search Direction",NoList, - CA_None,isSens,82, 0,0}, - {C_RadioButton, 95, 1,"Forward",NoList,CA_None, - notSens,82,0,61}, - {C_RadioButton, 96, 0,"Backward",NoList,CA_None, - notSens,82,0,95}, - - {C_Frame, 83, 0, "",NoList,CA_None,isSens,79,82,80}, - {C_Label, 62, 0, "Options",NoList, - CA_None,isSens,83, 0,0}, - {C_CheckBox, 97, 0,"Case Sensitive",NoList,CA_None, - isSens,83,0,62}, - {C_CheckBox, 100, 0,"Confirm replace",NoList,CA_None, - isSens,83,0,97}, - - {C_Button, M_OK, 0, "Replace Next", NoList,CA_DefaultButton, - isSens,NoFrame,79,0}, - {C_Button, M_Replace, 0, "Replace All ", NoList,CA_DefaultButton, - isSens,NoFrame,79,M_OK}, - {C_Button, M_Cancel, 0, " Cancel ", NoList,CA_None, - isSens,NoFrame,79,M_Replace}, - {C_EndOfList,0,0,0,0,CA_None,0,0,0} - }; - -//======================>>> vReplaceDialog::AskReplacePat <<<======================= - int vReplaceDialog::AskReplacePat(char* findpat, const int maxlen, - char* replpat, const int maxrlen, - int& caseSens, int& Down, int& Wrap, - int& Prompt, int& All) - { - // Show a message, wait for a reply - // no important return - - int ans; - - if (!findpat || !replpat) - return 0; - - if (!added) - { - ReplDialog[vGetcmdIdIndex(92, ReplDialog)].title = findpat; - ReplDialog[vGetcmdIdIndex(99, ReplDialog)].title = replpat; - AddDialogCmds(ReplDialog); // Set up standard dialog - added = 1; - } - - if (*findpat) - SetString(92,findpat); - if (*replpat) - SetString(99,replpat); - SetValue(97,caseSens,Value); - SetValue(94,Wrap,Value); - SetValue(95,Down,Value); - - int rv = ShowModalDialog("", ans); // show and WAIT - - if (rv != M_Cancel) - { - (void) GetTextIn(92, findpat, maxlen); - (void) GetTextIn(99, replpat, maxrlen); - caseSens = GetValue(97); // Case sensitive - Wrap = GetValue(94); // Entire file? - Down = GetValue(95); // Down? - Prompt = GetValue(100); - if (rv == M_Replace) - All = 1; - else - All = 0; - return 1; - } - - return 0; - } - -//====================>>> vReplaceDialog::DialogCommand <<<======================= - void vReplaceDialog::DialogCommand(ItemVal id, ItemVal val, CmdType ctype) - { - vModalDialog::DialogCommand(id,val,ctype); - if (id == M_Replace) - CloseDialog(); - } -// --------------------------------------------------------------------- diff --git a/v/srcwin/vreply.cpp b/v/srcwin/vreply.cpp deleted file mode 100644 index 2952c27..0000000 --- a/v/srcwin/vreply.cpp +++ /dev/null @@ -1,123 +0,0 @@ -//=============================================================== -// vreply.cxx - vReplyDialog class functions - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include // our header -#include // icons -#include // for calc. of dialog position - TEH Dec97 - -// Define static data of the class - -#define prompt_depth 1 -#define prompt_width 32 -#define prompt_height 32 -static unsigned char prompt_bits[] = { - 0x01, 0x00, 0x00, 0x40, 0xf8, 0xff, 0xff, 0x9f, 0x05, 0x00, 0x00, 0x20, - 0xe4, 0xff, 0xff, 0xa7, 0x15, 0x00, 0x00, 0x28, 0x14, 0xc0, 0x01, 0xa8, - 0x15, 0xe0, 0x03, 0x28, 0x14, 0x30, 0x06, 0xa8, 0x15, 0x30, 0x06, 0x28, - 0x14, 0x00, 0x03, 0xa8, 0x15, 0x80, 0x01, 0x28, 0x14, 0xc0, 0x00, 0xa8, - 0x15, 0xc0, 0x00, 0x28, 0x14, 0xc0, 0x00, 0xa8, 0x15, 0xc0, 0x00, 0x28, - 0x14, 0x00, 0x00, 0xa8, 0x15, 0xc0, 0x00, 0x28, 0x14, 0x00, 0x00, 0xa8, - 0xe5, 0xff, 0xff, 0x27, 0x04, 0x00, 0x00, 0xa0, 0xf9, 0xff, 0xff, 0x1f, - 0xfe, 0xff, 0xff, 0x7f, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, - 0x02, 0x00, 0xe0, 0x47, 0x02, 0x00, 0x00, 0x40, 0xfa, 0xff, 0xff, 0x5f, - 0xae, 0xaa, 0xaa, 0x6a, 0x56, 0x55, 0x55, 0x55, 0xab, 0xaa, 0xaa, 0xea, - 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00}; - - static vIcon prompt((unsigned char*)&prompt_bits[0],prompt_height, - prompt_width,prompt_depth); - - static CommandObject ReplyDialog[] = - { - // Modified: TEH Jan98 - // Put icon + text in a frame so button is below frame. - // With many-line text displays, the button will always be below text. - // Also remove "Blanks" around buttons; not consistant with V look! - // Put OK button to left, and Cancel to right for proper style. - {C_Frame, 30, 0, "", - NoList, CA_NoSpace | CA_NoBorder, isSens, NoFrame, 0, 0}, - {C_Icon, 10, 0, "Reply?", (void*)&prompt, CA_None, isSens, 30, 0, 0}, - {C_Text, 91, 91, "", NoList, - CA_MainMsg | CA_NoBorder ,isSens, 30, 10,0}, - {C_TextIn, 92, 92, "", NoList, - CA_Large, isSens, NoFrame, 0, 30}, - {C_Button, M_OK, M_OK, " OK ", - NoList, CA_DefaultButton, isSens, NoFrame, 0, 92}, - {C_Button, M_Cancel, M_Cancel, " Cancel ", - NoList, CA_None, isSens, NoFrame, M_OK, 92}, - {C_EndOfList,0,0,0,0,CA_None,0,0,0} - }; - -//======================>>> vReplyDialog::Reply <<<======================= - int vReplyDialog::Reply(VCONST char* msg, char* reply, int maxlen, - VCONST char* dflt) - { - // Show a message, wait for a reply - // no important return - - int ans; - - // TEH jan98; move before "if" as it is in vYNReplyDialog - ReplyDialog[2].title = (char *)msg; - // TEH jan98; added ability to have a "default" reply to display - ReplyDialog[3].title = dflt; - if (!added) - { - AddDialogCmds(ReplyDialog); // Set up standard dialog - added = 1; - } - - int rv = ShowModalDialog((char*)msg, ans); // show and wait - - reply[0] = 0; - - if (rv != M_Cancel) - (void) GetTextIn(92, reply, maxlen); - - return rv; - } - -//====================>>> vReplyDialog::DialogCommand <<<======================= - void vReplyDialog::DialogCommand(ItemVal id, ItemVal val, CmdType ctype) - { - // vModalDialog::DialogCommand(id,val,ctype); - // if (id == M_OK || id == M_Cancel) - // CloseDialog(); - vModalDialog::DialogCommand(id, val, ctype); - } - -// TEH Dec97 -// Added DialogDisplayed to handle the centering of the dialog in the app. -//====================>>> vReplyDialog::DialogDisplayed <<<======================= - void vReplyDialog::DialogDisplayed() - { - // center the dialog in the app window - RECT rctApp, rctDlg; // app and dialog corners - ::GetWindowRect(theApp->winHwnd(), &rctApp); - ::GetWindowRect(_wDialog, &rctDlg); - int widApp, htApp, widDlg, htDlg; // app and dialog dimensions - widApp = rctApp.right - rctApp.left; - htApp = rctApp.bottom - rctApp.top; - widDlg = rctDlg.right - rctDlg.left; - htDlg = rctDlg.bottom - rctDlg.top; - int left, top; // new dialog upper-left corner - if ( widApp > widDlg ) - left = /* rctApp.left + */(widApp - widDlg)/2; - else - left = rctApp.left; - if ( htApp > htDlg ) - top = /* rctApp.top + */ (htApp - htDlg)/2; - else - top = rctApp.top; - SetDialogPosition (left , top); // set the position - } - -// --------------------------------------------------------------------- diff --git a/v/srcwin/vsliderc.cpp b/v/srcwin/vsliderc.cpp deleted file mode 100644 index bcf2604..0000000 --- a/v/srcwin/vsliderc.cpp +++ /dev/null @@ -1,196 +0,0 @@ -//=============================================================== -// vsliderc.cxx - SliderCmd - Windows -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include // our definitions -#include // a command parent -#include - -//=================>>> vSliderCmd::vSliderCmd <<<======================= - vSliderCmd::vSliderCmd(vCmdParent* dp, CommandObject* dc) : - vCmd(dp, dc) - { - initialize(); // and initialize - } - -//=======================>>> vSliderCmd::~vSliderCmd <<<======================= - vSliderCmd::~vSliderCmd() - { - - SysDebug(Constructor,"vSliderCmd::~vSliderCmd() Destructor\n") - - } - -//=====================>>> vSliderCmd::initialize <<<======================= - void vSliderCmd::initialize() - { - - SysDebug(Constructor,"vSliderCmd::vSliderCmd() constructor\n") - - long style; - - if (_parentWin->_dialogType != aCmdBar) - style = WS_TABSTOP | WS_GROUP; // default for a button - else - style = WS_GROUP; - - CopyToLocal(); // Make local copies of CmdObject - - if (!(dlgCmd->attrs & CA_Hidden)) // Check for Hidden - style |= WS_VISIBLE; - - // Set the size of the slider - int SliderHeight = (dlgCmd->attrs & CA_Large) ? 170 : 110; - if (dlgCmd->attrs & CA_Small) - SliderHeight = 60; - if (dlgCmd->size > 0 && dlgCmd->size < 2048) - SliderHeight = dlgCmd->size; - - if (dlgCmd->attrs & CA_Vertical) - { - style |= SBS_VERT; - _w = 12; // set my width - _h = SliderHeight; // default height - } - else - { - style |= SBS_HORZ; - _w = SliderHeight; // set my width - _h = 14; // default height - } - - - int* minMax = (int *)_itemList; // giving range? - _minVal = 0; _maxVal = 100; // default min/max - if (minMax != 0) // They gave a range list - { - _minVal = minMax[0]; - _maxVal = minMax[1]; - } - - if (_minVal > _maxVal) - { - SysDebug2(BadVals,"vSliderCmd:vSliderCmd - bad range %d to %d\n",_minVal,_maxVal) - _minVal = 0; _maxVal = 100; // make some sense! - } - - - if (_retVal < _minVal) // set a legal value for the top - _curVal = _minVal; - else if (_retVal > _maxVal) - _curVal = _maxVal; - else - _curVal = _retVal; - - - - _parentWin->SetPosition(_x, _y, _w, _h, dlgCmd->cFrame, dlgCmd->cRightOf, - dlgCmd->cBelow); - _CtrlOffset = _parentWin->AddDlgControl(_x, _y, _w, _h, _cmdId, - style, "SCROLLBAR", _title, sizeof(vSliderCmd*), (LPBYTE)this); - } - -//==================>>> vSliderCmd::GetCmdValue <<<========================= - int vSliderCmd::GetCmdValue(ItemVal id) VCONST - { - if (id != _cmdId) - return -1; - return _curVal; - } - -//=====================>>> vSliderCmd::SetCmdVal <<<========================= - void vSliderCmd::SetCmdVal(ItemVal val, ItemSetType st) - { - - SysDebug2(Misc,"vSliderCmd::SetCmdVal(val:%d, type:%d)\n",val,st) - HWND myHwnd = GetMyHwnd(_cmdId); - if (st == Value) - { - if (val < _minVal || val > _maxVal ) - return; - _curVal = val; - // Now set appropriate _curVal, scroll - ::SetScrollRange(myHwnd, SB_CTL, _minVal, _maxVal, 0); - ::SetScrollPos(myHwnd, SB_CTL, _curVal, 1); - } - else if (st == Sensitive) - { - _Sensitive = val; // set - ::EnableWindow(myHwnd, val); - } - else if (st == Hidden) // hide or unhide - { - if (val) - { - ::ShowWindow(myHwnd,SW_HIDE); - } - else - { - ::ShowWindow(myHwnd,SW_SHOW); - } - } - } - -//===================>>> vSliderCmd::vCmdCallback <<<======================= - void vSliderCmd::CmdCallback(int id, WORD codeNotify) - { - // id is the SB_ code, and codeNotify is the position - - short newVal = _curVal; - - switch (id) - { - case SB_BOTTOM: // Scroll to bottom - newVal = _maxVal; - break; - - case SB_LINEDOWN: // Down one line - if (newVal < _maxVal) - ++newVal; - break; - - case SB_LINEUP: // Up one line - if (newVal > _minVal) - --newVal; - break; - - case SB_PAGEDOWN: // Page Down - use 10 - if (newVal + 10 < _maxVal) - newVal += 10; - else - newVal = _maxVal; - break; - - case SB_PAGEUP: // Page Up - use -10 - if (newVal - 10 > _minVal) - newVal -= 10; - else - newVal = _minVal; - break; - - case SB_THUMBPOSITION: // move to position given - case SB_THUMBTRACK: - newVal = (short) codeNotify; - break; - - case SB_TOP: // top of scroll - newVal = _minVal; - break; - } - - if (newVal != _curVal) // only notify if changed - { - _curVal = newVal; - HWND myHwnd = GetMyHwnd(_cmdId); // get my HWND - ::SetScrollPos(myHwnd, SB_CTL, _curVal, 1); // update control - _parentWin->ProcessCmd(_cmdId, _curVal, dlgCmd->cmdType); - } - } diff --git a/v/srcwin/vslist.cpp b/v/srcwin/vslist.cpp deleted file mode 100644 index eea495c..0000000 --- a/v/srcwin/vslist.cpp +++ /dev/null @@ -1,136 +0,0 @@ -//=============================================================== -// vSList Class for working with C_List char string lists -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include - -#include - -#include - -//===========================>>> vSList::vSList <<<======================= - vSList::vSList(int maxsize) - { - list = new char*[maxsize]; - max = maxsize; - init(); - } - -//===========================>>> vSList::~vSList <<<======================= - vSList::~vSList() - { - erase(); // delete contents - delete [] list; // delete the array itself - } - -//=============================>>> vSList::= <<<========================== -// vSList& vSList::operator =(const vSList& slist) -// { -// if (this == &slist) -// return *this; -// -// } - -//=============================>>> vSList::init <<<========================== - void vSList::init() - { - for (int ix = 0 ; ix < max ; ++ix) - list[ix] = 0; - } - -//=============================>>> vsList::erase <<<========================== - void vSList::erase() - { - for (int ix = 0 ; ix < max ; ++ix) - { - if (list[ix] != 0) - delete [] list[ix]; - list[ix] = 0; - } - } - -//========================>>> vSList::size <<<========================== - int vSList::size() const - { - int ix; - for (ix = 0 ; ix < max && list[ix] != 0 ; ++ix) - ; - return ix; - } - -//========================>>> vSList::insert <<<========================== - int vSList::insert(int insAt, const char* strn) const - { - int items = size(); - int iWhere = insAt; - - if (items >= max) - return -1; - - if (iWhere < 0 || iWhere >= max) // append to end - iWhere = items; - - // First, shift the list down by one - - for (int ix = items + 1 ; ix > iWhere ; --ix) - list[ix] = list[ix-1]; - - list[iWhere] = new char[strlen(strn)+1]; - strcpy(list[iWhere],strn); - return items + 1; - } - -//========================>>> vSList::replace <<<========================== - int vSList::replace(int repAt, const char* strn) const - { - int items = size(); - int iWhere = repAt; - - if (items >= max || iWhere < 0 || iWhere >= items) - return -1; - - if (list[iWhere] == 0) - return -1; - - delete [] list[iWhere]; - list[iWhere] = new char[strlen(strn)+1]; - strcpy(list[iWhere],strn); - return items; - } - -//========================>>> vSList::deleteItem <<<========================== - int vSList::deleteItem(int delAt) const - { - int items = size(); - int iWhere = delAt; - - if (iWhere < 0 || iWhere > max) // delete last item - iWhere = items - 1; - - if (iWhere >= items) - return -1; - - // First, delete the given item - - if (list[iWhere] == 0) // oops! - return -1; - - delete [] list[iWhere]; // free the space! - - // Now, shift the list up by one - - for (int ix = iWhere ; ix < items ; ++ix) - list[ix] = list[ix+1]; - - --items; - list[items] = 0; - - return items; - } diff --git a/v/srcwin/vspinc.cpp b/v/srcwin/vspinc.cpp deleted file mode 100644 index 0421ab8..0000000 --- a/v/srcwin/vspinc.cpp +++ /dev/null @@ -1,321 +0,0 @@ -//=============================================================== -// vspinc.cxx - vSpinnerCmd - Windows -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include // our definitions -#include // a command parent -#include -#include - - int vSpinnerCmd::_textIdPool = (int)M_WindowsReserved5; - -//=================>>> vSpinnerCmd::vSpinnerCmd <<<======================= - vSpinnerCmd::vSpinnerCmd(vCmdParent* dp, CommandObject* co) : - vCmd(dp, co) - { - initialize(); // and initialize - } - -//=======================>>> vSpinnerCmd::~vSpinnerCmd <<<===================== - vSpinnerCmd::~vSpinnerCmd() - { - - SysDebug(Constructor,"vSpinnerCmd::~vSpinnerCmd() Destructor\n") - - } - -//=====================>>> vSpinnerCmd::initialize <<<======================= - void vSpinnerCmd::initialize(void) - { - char *theText, intval[20]; - long style; - - SysDebug(Constructor,"vSpinnerCmd::vSpinnerCmd() constructor\n") - - CopyToLocal(); // Make local copies of CmdObject - - // First, build the Text box - - SetupList(); - - // BEW - v1.20 - If we leave this ES_READONLY, then the spinner - // has a gray background, which is confusing. It can be edited - // now, but that doesn't seem to hurt anything. - - style = /* ES_READONLY |*/ WS_BORDER | ES_CENTER; // Bordered readonly text box - - if (!(dlgCmd->attrs & CA_Hidden)) // Check for Hidden - style |= WS_VISIBLE; - - if (_TextList) - theText = _fullList[_curSelection]; - else - { - style |= (ES_MULTILINE | ES_RIGHT); - IntToStr(_curSelection,intval); - theText = intval; - } - - _maxWidth = _maxWidth*4 + 2; // change chars to dialog pixels - - _maxWidth = (dlgCmd->attrs & CA_Large) ? (_maxWidth * 3)/2 - : _maxWidth; - - if (dlgCmd->size > 0 && dlgCmd->size < 2048) - _maxWidth = dlgCmd->size; - - _w = _maxWidth; - - _h = 14; - - _textId = _textIdPool++; // get an id for the text control - - _parentWin->SetPosition(_x, _y, _w, _h, dlgCmd->cFrame, dlgCmd->cRightOf, - dlgCmd->cBelow); - - _CtrlOffset = _parentWin->AddDlgControl(_x, _y , _w, _h, _textId, - style, "EDIT", theText, sizeof(vSpinnerCmd*), (LPBYTE)this); - - - // Now, build the up/down arrows out of a scroll bar - - // Cannot make it a WS_TABSTOP or it shows the blinking thumb... - style = WS_GROUP; - - int tx = _x + _w; - int ty = _y; - int th = _h; - - int tw = 10; - - style |= SBS_VERT; - if (!(dlgCmd->attrs & CA_Hidden)) // Check for Hidden - style |= WS_VISIBLE; - - // Some kludgy stuff here. We will call SetPosition, but only - // to make the total size and frame stuff come out right. - // We know where the control goes already. - - _parentWin->SetPosition(tx, ty, tw, th, dlgCmd->cFrame, _textId, - dlgCmd->cBelow,1); - (void)/*_CtrlOffset = */_parentWin->AddDlgControl(tx, ty, tw, th, _cmdId, - style, "SCROLLBAR", _title, sizeof(vSpinnerCmd*), (LPBYTE)this); - - _w += 10; // add in width of scroll arrows - } - -//==================>>> vSpinnerCmd::GetCmdValue <<<========================= - int vSpinnerCmd::GetCmdValue(ItemVal id) VCONST - { - if (id != _cmdId) - return -1; - return _curSelection; - } - -//=====================>>> vSpinnerCmd::SetCmdVal <<<========================= - void vSpinnerCmd::SetCmdVal(ItemVal val, ItemSetType st) - { - - SysDebug2(Misc,"vSpinnerCmd::SetCmdVal(val:%d, type:%d)\n",val,st) - - if (st == ChangeList || st == ChangeListPtr) - { - if (st == ChangeListPtr) - _itemList = dlgCmd->itemList; - - int oldMax = _maxWidth; // track current max width - - SetupList(); // resetup the list - - if (oldMax > _maxWidth) - _maxWidth = oldMax; // don't let it get narrower - // redisplay text - _curSelection = val; - SetCmdVal(_curSelection,Value); - return; - } - else if (st == Hidden) // hide or unhide - { - HWND myHwnd = GetMyHwnd(_cmdId); - if (val) - { - ::ShowWindow(myHwnd,SW_HIDE); - } - else - { - ::ShowWindow(myHwnd,SW_SHOW); - } - } - else if (st == Value) - { - - _curSelection = val; // change the current value - - // See if the currently selected item is in the list - - if (_TextList) // handle like this for text list - { - if (_itemList) - { - if (_curSelection < 0) - _curSelection = 0; - if (_curSelection >= _numItems) - _curSelection = _numItems - 1; - } - - // Now show the new current selection - ::SetDlgItemText(_parentWin->getParent(),_textId, - _fullList[_curSelection]); - } - else // integer values - { - char intval[32]; - if (_curSelection < _minVal) - _curSelection = _minVal; - if (_curSelection >= _maxVal) - _curSelection = _maxVal; - - IntToStr(_curSelection, intval); - - ::SetDlgItemText(_parentWin->getParent(),_textId,intval); - } - } - else if (st == Sensitive) - { - HWND myHwnd = GetMyHwnd(_cmdId); - _Sensitive = val; // set - ::EnableWindow(myHwnd, val); - } - } - -//===================>>> vSpinnerCmd::vCmdCallback <<<======================= - void vSpinnerCmd::CmdCallback(int id, WORD codeNotify) - { - // id is the SB_ code, and codeNotify is the position - - int down = 1; - - switch (id) - { - case SB_LINEDOWN: // Down one line - down = 1; - break; - - case SB_LINEUP: // Up one line - down = 0; - break; - } - - // Change the value, either in the list or the value. - - // The increment will depend on various things - - if (_TextList) - { - if (down) - { - if (_TextList && _curSelection < (_numItems-1)) - _curSelection += _step; - } - else - { - if (_TextList && _curSelection > 0) - _curSelection -= _step; - } - } - else // up/down mean opposite for numbers - { - if (down) - { - if ((_maxVal == 0 && _minVal == 0) || (_curSelection - _step) >= _minVal) - _curSelection -= _step; - } - else - { - if ((_maxVal == 0 && _minVal == 0) || (_curSelection + _step) <= _maxVal) - _curSelection += _step; - } - } - - // Now show the new current selection - - SetCmdVal(_curSelection,Value); - - if (!(dlgCmd->attrs & CA_NoNotify)) // Notify on each selection? - _parentWin->ProcessCmd(_cmdId, _curSelection, dlgCmd->cmdType); - } - -//====================>>> vSpinnerCmd::SetupList <<<======================= - void vSpinnerCmd::SetupList(void) - { - // Set up the list for use - - int width; - - // First, count how many items are in the supplied list - - _fullList = (char**)_itemList; // list - - _maxWidth = 0; // no items yet - - if (dlgCmd->attrs & CA_Text) // A text list of values - { - _TextList = 1; // This is a text list - _step = 1; - for ( _numItems = 0 ; _fullList[_numItems] != 0 ; ++_numItems) - { - - width = strlen(_fullList[_numItems]); // strlen - if (width > _maxWidth) - _maxWidth = width; // track largest so far - } - - if (_numItems <= 0) - { - SysDebug(BadVals,"Bad list provided for ValueBox\n"); - } - - // Set to default value - - if (_retVal >= 0 && _retVal < _numItems) - _curSelection = _retVal; - else - _curSelection = 0; // item 0 by default - } - else // an integer list - { - _TextList = 0; // This is an integer list - - int* minMaxList = (int *) _itemList; // list - _minVal = 0; _maxVal = 0x7fff; _step = 1; - if (minMaxList != 0) // provided a range list - { - _minVal = minMaxList[0]; - _maxVal = minMaxList[1]; - _step = minMaxList[2]; - - // Try to make the width pretty - - char buff[20]; - IntToStr(_minVal,buff); - _maxWidth = strlen(buff) + 1; - - IntToStr(_maxVal,buff); - int maxW = strlen(buff) + 1; - if (maxW > _maxWidth) - _maxWidth = maxW; - } - else - _maxWidth = 6; - _curSelection = _retVal; - } - - } diff --git a/v/srcwin/vstartup.cpp b/v/srcwin/vstartup.cpp deleted file mode 100644 index 46f62b0..0000000 --- a/v/srcwin/vstartup.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include // for Win 32 stuff - -//======================>>> WinMain <<<====================================== - -int AppMain(int, char**); -int CMain(HANDLE , HANDLE , LPSTR , int ); -void vRegisterAppMain( int (*)(int, char**) ); - -int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, - LPSTR lpszCmdLine, int nCmdShow) -{ - // pass the address of your AppMain to the V library. - vRegisterAppMain(AppMain); - - // call CMain as in the static library. - return CMain(hInstance, hPrevInstance, lpszCmdLine, nCmdShow); -} diff --git a/v/srcwin/vtextc.cpp b/v/srcwin/vtextc.cpp deleted file mode 100644 index 0f0ff0b..0000000 --- a/v/srcwin/vtextc.cpp +++ /dev/null @@ -1,153 +0,0 @@ -//=============================================================== -// vtextc.cxx - Text output cmd - Windows -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include -#include // our definitions -#include // a command parent -#include - -//=====================>>> vTextCmd::vTextCmd <<<======================= - vTextCmd::vTextCmd(vCmdParent* dp, CommandObject* dc) : - vCmd(dp, dc) - { - initialize(); - } - -//=====================>>> vTextCmd::~vTextCmd <<<======================= - vTextCmd::~vTextCmd() - { - - SysDebug(Destructor,"vTextCmd::~vTextCmd() destructor\n") - - } - -//=====================>>> vTextCmd::initialize <<<======================= - void vTextCmd::initialize(void) - { - // multiline, boxed text output - SysDebug(Constructor,"vTextCmd::vTextCmd() constructor\n") - - int numLines; - char* useText; - char* winCopy = 0; - - CopyToLocal(); // Make local copies of CmdObject - char* theText; - - long style = ES_READONLY; - - if (!_itemList || (*(char*)_itemList == 0)) - theText = (char*) _title; - else - theText = (char*)_itemList; - - if (!(dlgCmd->attrs & CA_NoBorder)) - style |= WS_BORDER; - - if (!(dlgCmd->attrs & CA_Hidden)) // Check for Hidden - style |= WS_VISIBLE; - - - _w = vTextLen(theText, numLines)*5+4; // set my width AND get numLines - - if (dlgCmd->size > 0) // may reset title! - { - _w = dlgCmd->size; - } - - style |= ES_LEFT; - if (_parentWin->paneType() == P_Status) - { - _h = (11 * numLines) + 1; // calc height - } - else - { - _h = (11 * numLines) + 1; // calc height - - } - - useText = theText; - if (numLines > 1) // have to convert \n to \r\n - { - style |= ES_MULTILINE; - winCopy = new char[(strlen(theText) + numLines + 1)]; - char * cp; - for (cp = winCopy ; *useText ; ) - { - if (*useText == '\n') // add extra \r - *cp++ = '\r'; - - *cp++ = *useText++; - } - *cp = 0; // terminate string - useText = winCopy; - } - - _parentWin->SetPosition(_x, _y, _w, _h, dlgCmd->cFrame, dlgCmd->cRightOf, - dlgCmd->cBelow); - - _CtrlOffset = _parentWin->AddDlgControl(_x, _y , _w, _h, _cmdId, - style, "EDIT", useText, sizeof(vTextCmd*), (LPBYTE)this); - if (winCopy != 0) - delete [] winCopy; - } - -//================>>> vTextCmd::SetCmdVal <<<============================ - void vTextCmd::SetCmdVal(ItemVal val, ItemSetType st) - { - SysDebug1(Misc,"vTextCmd::SetCmdVal(val:%d)\n",val) - - HWND myHwnd = GetMyHwnd(_cmdId); - if (st == Hidden) // hide or unhide - { - if (val) - { - ::ShowWindow(myHwnd,SW_HIDE); - } - else - { - ::ShowWindow(myHwnd,SW_SHOW); - } - } - } - -//================>>> vTextCmd::SetCmdStr <<<============================ - void vTextCmd::SetCmdStr(VCONST char* str) - { - - SysDebug1(Misc,"vTextCmd::SetCmdStr(str:%s)\n",str) - - int numLines; - VCONST char* useText = str; - char* winCopy = 0; - - (void) vTextLen(str, numLines); - if (numLines > 1) // have to convert \n to \r\n - { - winCopy = new char[(strlen(str) + numLines + 1)]; - char * cp; - for (cp = winCopy ; *useText ; ) - { - if (*useText == '\n') // add extra \r - *cp++ = '\r'; - - *cp++ = *useText++; - } - *cp = 0; // terminate string - useText = winCopy; - } - - ::SetDlgItemText(_parentWin->getParent(),_cmdId, useText); - if (winCopy != 0) - delete [] winCopy; - _title = str; - } diff --git a/v/srcwin/vtextcnv.cpp b/v/srcwin/vtextcnv.cpp deleted file mode 100644 index ec5494b..0000000 --- a/v/srcwin/vtextcnv.cpp +++ /dev/null @@ -1,686 +0,0 @@ -//=============================================================== -// vtextcnv.cxx - TextCanvasPane, terminal like Text Drawing Canvas -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include - - static HWND caretWin = 0; - -//================>>> vTextCanvasPane::vTextCanvasPane <<<==================== - vTextCanvasPane::vTextCanvasPane() : vCanvasPane(P_TextCanvas) - { - - SysDebug(Constructor,"vTextCanvasPane::vTextCanvasPane() constructor\n") - - screen = new dChar[MAX_ROWS*MAX_COLS]; - - rowsAllocated = MAX_ROWS; - colsAllocated = MAX_COLS; - - for (int row = 0 ; row < MAX_ROWS ; ++row) - for (int col = 0 ; col < MAX_COLS ; ++col) - { - ScrChar(row,col) = 0 ; ScrAttr(row,col) = 0; - } - - cHeight = 0; cWidth = 0; - curRow = 0; curCol = 0; - caretOn = 0; - maxRows = -1; maxCols = -1; // We don't know this yet - textMargin = MARGIN; - - _cursorSet = 0; - } -//================>>> vTextCanvasPane::vTextCanvasPane <<<==================== - void vTextCanvasPane::initialize(vWindow* pWindow, HWND pWidget) - { - vCanvasPane::initialize(pWindow,pWidget); - - // We will always get focus when we are created, so create the - // caret here once. The rest of the time, the caret will - // be created in response to WM_MDIACTIVATE in vwindow.cpp - - // int tw = TextWidth("X"); - // ::CreateCaret(_drawWindow, NULL, tw,3); - // caretOn = 0; - } - -//================>>> vTextCanvasPane::vTextCanvasPane <<<==================== - vTextCanvasPane::vTextCanvasPane(const vTextCanvasPane& /* t */) - { - vSysError("vTextCanvasPane - V semantics do not support copy constructors!"); - } - -//================>>> vTextCanvasPane::vTextCanvasPane <<<==================== - vTextCanvasPane::~vTextCanvasPane() - { - - SysDebug(Destructor,"vTextCanvasPane::~vTextCanvasPane() desstructor\n") - - delete [] screen; - } - -//======================>>> vTextCanvasPane::Clear <<<====================== - void vTextCanvasPane::Clear(void) - { - // Clear screen - including contents - - SysDebug(Text,"vTextCanvasPane::Clear\n") - - for (int row = 0 ; row < rowsAllocated ; ++row) - for (int col = 0 ; col < colsAllocated ; ++col) - { - ScrChar(row,col) = 0 ; ScrAttr(row,col) = ChNormal; - } - - vCanvasPane::Clear(); - - GotoRC(0,0); // Go to Row & Column - } - -//=================>>> vTextCanvasPane::ClearRow <<<====================== - void vTextCanvasPane::ClearRow(const int r, const int c) - { - // Clear screen row - including the contents - - SysDebug2(Text,"vTextCanvasPane::ClearRow(r:%d, c: %d)\n",r,c) - - GotoRC(r,c); // update cursor for sure - - // Clearing implies that the previous part of the row should - // have valid characters, so change them to blanks if now 0 - for (int cc = 0 ; cc < c ; ++cc) - { - if (ScrChar(r,cc) == 0) - { - ScrChar(r,cc) = ' '; ScrAttr(r,cc) = ChNormal; - } - } - - // Now clear the rest of the row - for (int col = c ; col < maxCols ; ++col) - { - ScrChar(r,col) = 0 ; ScrAttr(r,col) = ChNormal; - } - - ClearRowDisplay(r,c); - - GotoRC(r,c); - } - -//=============>>> vTextCanvasPane::ClearRowDisplay <<<====================== - void vTextCanvasPane::ClearRowDisplay(const int r, const int c) - { - // Clear display row - - int x, y; - - x = ColToX(c); - y = RowToY(r); - if (c == 0 && x > 0) - --x; // fix for windows glitch - - ClearRect(x, y - cHeight, _width - x + 1, cHeight); - } - -//=================>>> vTextCanvasPane::ClearToEnd <<<====================== - void vTextCanvasPane::ClearToEnd(const int r, const int c) - { - // Clear from r,c to end of screen - - SysDebug2(Text,"vTextCanvasPane::ClearToEnd(r:%d, c: %d)\n",r,c) - ClearRow(r,c); - for (int row = r+1 ; row < maxRows ; ++row) - ClearRow(row,0); - - GotoRC(r,c); - } - -//=================>>> vTextCanvasPane::DrawTextCursor <<<================= - void vTextCanvasPane::DrawTextCursor(int r, int c) - { - // draw a cursor at new location - - if (caretWin == 0 || caretWin != _drawWindow) // no cursor created yet - { - if (caretWin != _drawWindow) - ::DestroyCaret(); -#ifdef UNDERSCORE_CARET - int tw = TextWidth("X"); - ::CreateCaret(_drawWindow, NULL, tw, 3); -#else - ::CreateCaret(_drawWindow, NULL, 2, cHeight); -#endif - caretWin = _drawWindow; - caretOn = 0; - } - - if (!caretOn) // we will turn caret on, but only once - { - caretOn = 1; - ::ShowCaret(caretWin); - } - - if (r < 0) // This is how we turn the caret off - { - if (caretOn) - { - caretOn = 0; - ::HideCaret(caretWin); - } - return; // This is how to turn the cursor off - } -#ifdef UNDERSCORE_CARET - ::SetCaretPos(ColToX(c), RowToY(r)-1); -#else - ::SetCaretPos(ColToX(c), RowToY(r)-cHeight); -#endif - - } - -//======================>>> vTextCanvasPane::DrawChar <<<====================== - void vTextCanvasPane::DrawChar(const char chr, const ChrAttr attr) - { - // Overwrite a char at current cursor, incr cursor - char copy[2]; // for a copy - - copy[0] = chr; copy[1] = 0; - - SysDebug1(Text,"vTextCanvasPane::DrawChar(chr:%c)\n",chr) - - ScrChar(curRow,curCol) = chr ; ScrAttr(curRow,curCol) = attr; - - // for now, assume just reverse or normal on WHOLE row - - if (attr != ChNormal) // normal or with attributes? - vCanvasPane::DrawAttrText(ColToX(curCol), RowToY(curRow), copy, attr); - else - vCanvasPane::DrawText(ColToX(curCol), RowToY(curRow), copy); - - - if (++curCol >= maxCols) - curCol = maxCols - 1; - - GotoRC(curRow, curCol); - } - -//======================>>> vTextCanvasPane::DrawText <<<====================== - void vTextCanvasPane::DrawText(const char* text) - { - DoDrawText(text, ChNormal); // Draw normal text - } - -//======================>>> vTextCanvasPane::DrawAttrText <<<====================== - void vTextCanvasPane::DrawAttrText(const char* text, const ChrAttr attr) - { - DoDrawText(text, attr); // Draw reverse text - } - -//======================>>> vTextCanvasPane::DoDrawText <<<====================== - void vTextCanvasPane::DoDrawText(const char* text, const ChrAttr attr) - { - // Draw scrolling text starting at current r,c - - if (!text || !*text) - return; - - int startC = curCol; - int needsFinalDraw = 0; - - SysDebug3(Text,"vTextCanvasPane::DrawText(%s)[r=%d,c=%d]\n",text,curRow,startC) - - for (int cc = 0 ; cc < curCol ; ++cc) // change 0's to blanks if in middle of row - { - if (ScrChar(curRow,cc) == 0) - { - ScrChar(curRow,cc) = ' '; ScrAttr(curRow,cc) = ChNormal; - } - } - - - for (const char* cp = text ; *cp != 0 ; ++cp) - { - if (*cp == '\n') // new lines take special treatment - { - // Terminate current row with 0 - ScrChar(curRow,curCol) = 0 ; ScrAttr(curRow,curCol) = attr; - - // And draw row on the screen! - DrawTextScr(curRow,startC,ScrAddr(curRow,startC)); - startC = curCol = 0; // reset column to 0 - ++curRow; // move to the next row - needsFinalDraw = 0; // Don't need final draw - // Next row is empty - ScrChar(curRow,curCol) = 0 ; ScrAttr(curRow,curCol) = ChNormal; - if (curRow >= maxRows) // see if off bottom - { - ScrollText(1); // scroll up 1 row - } - } - else if (curCol < maxCols) // overwrite current line - { - ScrChar(curRow,curCol) = *cp ; ScrAttr(curRow,curCol) = attr; - ++curCol; - needsFinalDraw = 1; // Don't need final draw - } - } - - - if (needsFinalDraw) - DrawTextScr(curRow,startC,ScrAddr(curRow,startC)); - - GotoRC(curRow,curCol); - } - -//======================>>> vTextCanvasPane::DrawAttrsText <<<====================== - void vTextCanvasPane::DrawAttrsText(const char* text, const ChrAttr* attr) - { - // Draw scrolling text starting at current r,c - // this was simply copied from DrawAttrText but uses array for attr (1.23) - - if (!text || !*text) - return; - - int startC = curCol; - int needsFinalDraw = 0; - - SysDebug3(Text,"vTextCanvasPane::DrawAttrsText(%s)[r=%d,c=%d]\n",text,curRow,startC) - - for (int cc = 0 ; cc < curCol ; ++cc) // change 0's to blanks if in middle of row - { - if (ScrChar(curRow,cc) == 0) - { - ScrChar(curRow,cc) = ' '; ScrAttr(curRow,cc) = ChNormal; - } - } - - - int ix; - for ( ix = 0; text[ix] != 0 ; ++ix) - { - if (text[ix] == '\n') // new lines take special treatment - { - // Terminate current row with 0 - ScrChar(curRow,curCol) = 0 ; ScrAttr(curRow,curCol) = attr[ix]; - - // And draw row on the screen! - DrawTextScr(curRow,startC,ScrAddr(curRow,startC)); - startC = curCol = 0; // reset column to 0 - ++curRow; // move to the next row - needsFinalDraw = 0; // Don't need final draw - // Next row is empty - ScrChar(curRow,curCol) = 0 ; ScrAttr(curRow,curCol) = ChNormal; - if (curRow >= maxRows) // see if off bottom - { - ScrollText(1); // scroll up 1 row - } - } - else if (curCol < maxCols) // overwrite current line - { - ScrChar(curRow,curCol) = text[ix] ; ScrAttr(curRow,curCol) = attr[ix]; - ++curCol; - needsFinalDraw = 1; // Don't need final draw - } - } - - if (needsFinalDraw) - DrawTextScr(curRow,startC,ScrAddr(curRow,startC)); - - GotoRC(curRow,curCol); - } - -//======================>>> vTextCanvasPane::DrawTextScr <<<====================== - void vTextCanvasPane::DrawTextScr(int r, int c, dChar* txt) - { - char copy[MAX_COLS]; // for a copy - - char* to = copy; - - ChrAttr curAttr = txt->attr; // initial attribute - - int curCol = c; - - int startCol = c; - - for (dChar* dcp = txt ; dcp->chr != 0 ; ++dcp) - { - if (dcp->attr != curAttr) // changing attr - need to show what - { // we've built so far - *to = 0; // terminate - if (curAttr != ChNormal) // normal or with attributes? - { - vCanvasPane::DrawAttrText(ColToX(startCol), RowToY(r), - copy, curAttr); - } - else - { - vCanvasPane::DrawText(ColToX(startCol), RowToY(r), copy); - } - // Now resetup for next portion of the row - to = copy; // restart buffer - curAttr = dcp->attr; // new attribute - startCol = curCol; // and new start column - // fall through for rest of the row - } - *to++ = dcp->chr; - curCol++; - } - *to = 0; - - // write rest of the row - - if (copy[0] != 0) // don't bother with empty row - { - if (curAttr != ChNormal) // normal or with attributes? - { - vCanvasPane::DrawAttrText(ColToX(startCol), RowToY(r), - copy, curAttr); - } - else - { - vCanvasPane::DrawText(ColToX(startCol), RowToY(r), copy); - } - } - } - -//=====================>>> vTextCanvasPane::EnterEV <<<========================== - void vTextCanvasPane::EnterEV(void) - { - if (caretOn) - DrawTextCursor(curRow,curCol); - if (_hasFocus) // don't double enter focus - return; - //::Beep(300,70); - _hasFocus = 1; - - - EnterFocus(); // call the virtual function - } - -//=====================>>> vCanvasPane::LeaveEV <<<========================== - void vTextCanvasPane::LeaveEV(void) - { - if (!_hasFocus) // don't double leave focus - return; - // ::Beep(600,70); - - _hasFocus = 0; - - if (caretWin == _drawWindow) // We have a created caret - { - ::DestroyCaret(); - caretWin = 0; - } - LeaveFocus(); // call the virtual function - } - -//======================>>> vTextCanvasPane::FontChanged <<<====================== - void vTextCanvasPane::FontChanged(VCONST vFont& newfont) - { - // The font has changed, so we must recalculate everything - -//1.18? Clear(); // 1.18 - match X version - ResizeText(); - } - -//======================>>> vTextCanvasPane::GotoRC <<<====================== - void vTextCanvasPane::GotoRC(const int r, const int c) - { - - // Move cursor to row, col - - if (r < 0 || c < 0) - { - if (caretOn) - ::HideCaret(_drawWindow); - caretOn = 0; - } - - // First, a sanity check - - int row = (r < 0) ? 0 : r; - int col = (c < 0) ? 0 : c; - - if (row >= maxRows) - row = maxRows - 1; - if (col >= maxCols) - col = maxCols - 1; - - curRow = row; - curCol = col; - - // have to be sure column is blank filled if moved to new column - - for (int cc = 0 ; cc < col ; ++cc) - { - if (ScrChar(row,cc) == 0) - { - ScrChar(row,cc) = ' '; ScrAttr(row,cc) = ChNormal; - } - } - - DrawTextCursor(curRow, curCol); // draw the cursor to here - } - -//======================>>> vTextCanvasPane::MouseDown <<<====================== - void vTextCanvasPane::MouseDown(int x, int y, int button) - { - // Map xy to text positions, call alternate mouse down - - TextMouseDown(YToRow(y), XToCol(x), button); - } - -//========================>>> vTextCanvasPane::MouseUp <<<====================== - void vTextCanvasPane::MouseUp(int x, int y, int button) - { - // Map xy to text positions, call alternate mouse up - TextMouseUp(YToRow(y), XToCol(x), button); - } - -//======================>>> vTextCanvasPane::MouseMove <<<====================== - void vTextCanvasPane::MouseMove(int x, int y, int button) - { - // Map xy to text positions, call alternate mouse Move - TextMouseMove(YToRow(y), XToCol(x), button); - } - -//=========================>>> vTextCanvasPane::Redraw <<<====================== - void vTextCanvasPane::Redraw(int x, int y, int width, int height) - { - if (maxRows < 0) // This is the FIRST redraw - { - ResizeText(); // resize the text! - return; // don't redraw twice! - } - -#ifdef vDEBUG // Don't have a SysDebug4 macro, so do it by hand - if (DebugState.WindowEvents && DebugState.System) - fprintf(stderr,"vTextCanvasPane::Redraw(x=%d, y=%d, w=%d, h=%d)\n",x,y,width,height); -#endif - - if (!_cursorSet) - { - SetCursor(VC_IBar); // Change here - _cursorSet = 1; - } - - // OK, do a REALLY stupid redraw - - for (int r = 0 ; r < maxRows ; ++r) - DrawTextScr(r,0,ScrAddr(r,0)); - - } - -//===================>>> vTextCanvasPane::ResizeText <<<====================== - void vTextCanvasPane::ResizeText(const int rows, const int cols) - { - // This one is overridable so user can pick up new size - - SysDebug2(WindowEvents,"vTextCanvasPane::ResizeText(%d,%d)\n",rows,cols) - } - -//===================>>> vTextCanvasPane::SetTextRowsCols <<<====================== - void vTextCanvasPane::SetTextRowsCols(int rows, int cols) - { - int newheight = ((rows+5) * cHeight) + (2*textMargin); - int newwidth = ((cols +2) * cWidth) + (2*textMargin); - SetWidthHeight(newwidth, newheight); - } - -//===================>>> vTextCanvasPane::ResizeText <<<====================== - void vTextCanvasPane::ResizeText(void) - { - // determine how many rows and columns we have - - cHeight = TextHeight(cAscent, cDescent); - if (cHeight == 0) - cHeight = 1; - cWidth = TextWidth("c"); // Use "c" as average char - - - maxRows = (_height-(2*textMargin)) / cHeight; // how many rows - if (maxRows < 1) - maxRows = 1; - if (maxRows > rowsAllocated) - maxRows = rowsAllocated; - - maxCols = (_width-(2*textMargin)) / cWidth; - if (maxCols < 1) - maxCols = 1; - - if (maxCols >= (colsAllocated - 1)) - maxCols = colsAllocated - 2; // leave room for 0 terminator - - if (curRow > maxRows) // sanity check - curRow = 0; - if (curCol > maxCols) - curCol = 0; - - // 1.18? Clear(); // 1.18 Match X version. - ResizeText(maxRows,maxCols); - - Redraw(0,0,_width,_height); // force a redraw - } - -//======================>>> vTextCanvasPane::Resize <<<====================== - void vTextCanvasPane::Resize(int w, int h) - { - vCanvasPane::Resize(w,h); - ResizeText(); - } - -//======================>>> vTextCanvasPane::ScrollText <<<====================== - void vTextCanvasPane::ScrollText(const int lineCount) - { - // scroll text on screen up or down by lineCount - - int count = (lineCount < 0) ? -lineCount : lineCount; // abs val - - if (count >= maxRows) // see if doing the whole screen - { - Clear(); - if (lineCount < 0) - GotoRC(maxRows-1,0); - } - - if (lineCount > 0) // Scroll up -- blank lines at bottom - { - int r,c, to; - // Do the scroll: move all the data up count rows - for (r = count ; r < maxRows ; ++r) - { - to = r - count; // ScrChar is a macro, so need this - // copy one row up - for (c = 0 ; c < maxCols ; ++c) - { - ScrChar(to,c) = ScrChar(r,c); - ScrAttr(to,c) = ScrAttr(r,c); - } - } - - curRow = maxRows - count; // set to bottom used row of screen - curCol = 0; - - // Now, draw the screen with new rows - for (r = 0 ; r < curRow ; ++r) - { - ClearRowDisplay(r,0); - DrawTextScr(r,0,ScrAddr(r,0)); - } - // And clear the rest of the screen - for (r = curRow ; r < maxRows ; ++r) - { - ClearRow(r,0); - } - } - else // scroll down - { - int r,c, to; - int lastRow = maxRows -1; // the last row on the screen - // Do the scroll: move all the data down count rows - for (r = lastRow - count ; r >= 0 ; --r) - { - to = r + count; // ScrChar is a macro, so need this - // copy one row down - for (c = 0 ; c < maxCols ; ++c) - { - ScrChar(to,c) = ScrChar(r,c); - ScrAttr(to,c) = ScrAttr(r,c); - } - } - - curRow = count; // set to topmost used row of screen V:1.13 - curCol = 0; - - // Now, draw the screen with new rows - for (r = curRow ; r < maxRows ; ++r) - { - ClearRowDisplay(r,0); - DrawTextScr(r,0,ScrAddr(r,0)); - } - // And clear the top part of the screen - for (r = 0 ; r < curRow ; ++r) - { - ClearRow(r,0); - } - } - } - -//======================>>> vTextCanvasPane::YToRow <<<====================== - int vTextCanvasPane::YToRow(int y) - { - if (cHeight == 0) - cHeight = 1; - int row = (y - textMargin) / cHeight; - - - if (row >= maxRows) - return maxRows - 1; // adjust for margins - else if (row < 0) - return 0; - else - return row; - } - -//======================>>> vTextCanvasPane::XToCol <<<====================== - int vTextCanvasPane::XToCol(int x) - { - if (cWidth == 0) - cWidth = 1; - int col = (x - textMargin) / cWidth; - - if (col >= maxCols) - return maxCols - 1; // adjust for margins - else if (col < 0) - return 0; - else - return col; - } diff --git a/v/srcwin/vtexted.cpp b/v/srcwin/vtexted.cpp deleted file mode 100644 index 9af9540..0000000 --- a/v/srcwin/vtexted.cpp +++ /dev/null @@ -1,5220 +0,0 @@ -//================================================================= -// -// vtexted.cpp - the V text editor class -// -// last edit date: 31 Mar 2000 12:16:55 -// -// Copyright (C) 1995-2000 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -// -// This code is based on Bruce Wampler's editor, See. I think a -// bit of history about See will explain some things about the -// reasons some of the code structure and variable names are -// what they are. See end end of this file for the See history. -// -//=============================================================== - -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -//@@@ -#include - -/// Working notes: -// allow line list to grow dynamically by adding lines and -// copying old list to new one, then deleting old one. - - const long lineListSize = 5000; // allocation increment for lines - - // one static find pattern - globalState vTextEditor::gState = { - 0, // findAtBeginning - 0, // fixed_scroll - 1, // delOnInsert - 8, // tabspc - 0, // wraplm - 2 // braceIndent - }; - int vTextEditor::findCaseSensitive = 0; - int vTextEditor::findDown = 1; - int vTextEditor::findWrap = 0; - int vTextEditor::replaceConfirm = 0; - int vTextEditor::replaceAll = 0; - char vTextEditor::theFindPat[MAX_LINE + 2] = ""; - char vTextEditor::theReplPat[MAX_LINE + 2] = ""; - -// =========================>>> vTextEditor::vTextEditor <<<================ - vTextEditor::vTextEditor(VCONST vCmdWindow* parent) - { - - _parent = const_cast(parent); // remember who my parent was - - // Set the command interp - _teCInt = new vTextEdCmdInterp(this, (vCmdWindow*)parent); - - state.readOnly = - use_wild = 0; // use wild cards in match - - oldcol = 1; - - state.ins_mode = 1; // insert (vs. overtype) - - b_lastln = - leftmg = xoutcm = - tvdlin = state.echof = lastLine = 1; - - linptr = 0; - - mouseMoveRow = mouseMoveCol = - mouseCol = mouseRow = -1; // no mouse stuff yet - scroll_lin = -1; - setCursor = 0; - - for (int ix = 0 ; ix < 26 ; ++ix) - noteloc[ix] = 0; - - _lines = 0; // make these null for smarter destructor - - _highlighter = ChHighlight; - - // create space, initialize buffers - - undoBuff = new char[MAX_UNDO+2]; - undoBuff[0] = 0; - - initBuff(); // initialize buffer routines - resetBuff(); - - myConfirm = new vTEConfirm(_parent,"Replace?"); - } - -//=========================>>> vTextEditor::~vTextEditor <<<================ - vTextEditor::~vTextEditor() - { - if (_teCInt) - delete _teCInt; // kill our command interp - - delete [] undoBuff; // zap the undo buffer - - if (_lines) - { - for (long ix = 0 ; ix < _nextLine ; ++ix) // delete contents - delete [] _lines[ix]; - delete [] _lines; // delete if created - } - } - -//=========================>>> vTextEditor::ChangeCmdInterp <<<================ - void vTextEditor::ChangeCmdInterp(vTextEdCmdInterp* newCI) - { - if (_teCInt) - delete _teCInt; // delete current command interp - if (newCI == 0) // use default CI - _teCInt = new vTextEdCmdInterp(this, (vCmdWindow*)_parent); - else - _teCInt = newCI; - } - -// ######################################################################### -// -// buffer methods -// -// These are designed to be easily overriden to allow more complex -// buffer management -- it should be possible to easily design a -// package that allows unlimited file size, for example. -// -// ######################################################################### - -//===========================>>> vTextEditor::initBuff <<<================== - void vTextEditor::initBuff(void) - { - // initialize buffer routines - handled as a method so - // can override - - _lines = new char*[lineListSize]; - _maxLines = lineListSize - 1; // safety factor - - _lines[0] = new char[2]; strcpy(_lines[0],"\n"); - _lines[1] = new char[2]; strcpy(_lines[1],"\n"); - for (long lx = 2 ; lx < lineListSize ; ++lx) - _lines[lx] = 0; - _nextLine = 2; - lastLine = lastLineBF(); - } - -// =======================>>> vTextEditor::resetBuff <<<==================== - void vTextEditor::resetBuff() // open the buffer - { - - // values used by buffer management - - if (_lines) - { - delete [] _lines[0]; - delete [] _lines[1]; - for (long ix = 2 ; ix < _nextLine ; ++ix) // delete contents - { - if (_lines[ix]) - delete [] _lines[ix]; - } - _lines[0] = new char[2]; strcpy(_lines[0],"\n"); - _lines[1] = new char[2]; strcpy(_lines[1],"\n"); - } - else - { - _lines = new char*[lineListSize]; - _maxLines = lineListSize - 1; // safety factor - - _lines[0] = new char[2]; strcpy(_lines[0],"\n"); - _lines[1] = new char[2]; strcpy(_lines[1],"\n"); - } - - _curLineBF = - _nextLine = 1; - - wasColCmd = 0; - - // values used by editor code - - mark.beg_lin = mark.end_lin = /* manually clear mark range */ - mark.beg_col = mark.end_col = 0; /* DO NOT CALL ClearMarkRange() */ - mark.beg_chr = mark.end_chr = 0; - - curlin = lastLine = 1; - - curchr = _lines[1]; - - last_col_out = - state.counter = - state.changes = 0; - - dsplin = ddline = 1; - state.ins_mode = 1; // insert (vs. overtype) - } - -// =========================>>> vTextEditor::addLine <<<==================== - int vTextEditor::addLine(char* line) - { - // This method adds the line to the end of the working buffer. - // Note: line numbers start at 1! - - if (!line) - return 0; - - if (_nextLine >= _maxLines) // check for max lines - if (!reallocLines()) - return 0; - - BUFFPTR bp = appendToBuff(line); - - if (!bp) - return 0; - - if (curchr == _lines[_nextLine]) - { - // When the very first line is added, curchr must be updated to - // point to the new line instead of to the initial "\n"! - curchr = bp; - } - - _lines[_nextLine++] = bp; // point line array to beginning of line - lastLine = lastLineBF(); // update - - return 1; - } - -// ======================>>> vTextEditor::appendToBuff <<<================== - BUFFPTR vTextEditor::appendToBuff(char* line) - { - // add text to the buffer -- allocate the spaced right here! - - BUFFPTR buff; - BUFFPTR bp; - int len = 0; - char* cp; - - for (cp = line ; *cp && *cp != '\n' && *cp != '\r' ; ++cp) // break on eos or eol - { - ++len; - } - - buff = (BUFFPTR) new char[len+2]; // the space for the line - - if (!buff) // did we get the space? - return 0; - - for (bp = buff, cp = line ; *cp && *cp != '\n' && *cp != '\r' ; ) // break on eos or eol - { - *bp++ = *cp++; - } - *bp++ = '\n'; - *bp++ = 0; - - return buff; - } - -// =========================>>> vTextEditor::autoIndent <<<==================== - int vTextEditor::autoIndent() - { - if (!state.autoIndent) - return 1; - if (curlin < 1 || curlin >= _nextLine) - { - return 1; - } - - BUFFPTR inCharP = GLine(curlin - 1); - for (char chr = GCh(inCharP) ; chr == ' ' || chr == '\t' ; - chr = GCh(++inCharP)) - charInsert((int)chr); - - return 1; // assume successful - } - -// =========================>>> vTextEditor::insertLine <<<==================== - int vTextEditor::insertLine(char* line, long before, bool doUndo) - { - // This method adds the line before line before. - // line numbers start at 1 - - if (!line) - return 0; - - if (doUndo) - undoOff("Undo"); - - if (_nextLine >= _maxLines) // check for max lines - if (!reallocLines()) - return 0; - - BUFFPTR bp = appendToBuff(line); // allocate space for line - - if (!bp) - return 0; - - if (curchr == _lines[_nextLine]) - { - // When the very first line is added, curchr must be updated to - // point to the new line instead of to the initial "\n"! - curchr = bp; - } - - for (long to = _nextLine++ ; to > before ; --to) - { - _lines[to] = _lines[to-1]; - } - - _lines[before] = bp; // point line array to beginning of line - lastLine = lastLineBF(); - adjustLines(before,1); - - return 1; - } - -// =====================>>> vTextEditor::getFirstLine <<<=================== - int vTextEditor::getFirstLine(char* line, int maxChars) - { - // return the first line in the buffer - - return getLine(line, maxChars,1); - } - -// =========================>>> vTextEditor::getNextLine <<<================ - int vTextEditor::getNextLine(char* line, int maxChars) - { - // return the next line in the text buffer, not including end of line - // returns the number of characters, -1 if at end of file - - return getLine(line, maxChars, _curLineBF +1); - } - -// =========================>>> vTextEditor::getLine <<<=================== - int vTextEditor::getLine(char* line, int maxChars, long lineNum) - { - // return the next line in the text buffer, not including end of line - // returns the number of characters, -1 if at end of file - - if (lineNum >= _nextLine || lineNum < 1) // at end! - return -1; - - _curLineBF = lineNum; // Set _curlineBF - int len = 0; - - for (char* ix = _lines[_curLineBF] ; *ix != 0 && *ix != '\n' && len < maxChars ; ) - { - line[len++] = *ix++; // copy & track length - } - line[len] = 0; // terminate - return len; - } - -// ===================>>> vTextEditor::displayBuff <<<====================== - void vTextEditor::displayBuff(long lineNum, int paintIt) - { - // All lines added, so now display the buffer - - - if (lineNum >= _nextLine) - lineNum = _nextLine - 1; - if (lineNum < 1) - lineNum = 1; - - curlin = lineNum; // Internal stuff begins with line 1 - curchr = GLine(curlin); /* first char of buffer */ - lastLine = lastLineBF(); - int oldef = state.echof; - state.echof = paintIt; - ShowVScroll(1); - Verify(); - - state.echof = oldef; - } - -// =========================>>> vTextEditor::GLine <<<====================== - BUFFPTR vTextEditor::GLine(long lineNum) - { - if (lineNum < 1 || lineNum >= _nextLine) - { - return _lines[1]; // something safe - } - - return _lines[lineNum]; - } - -// =====================>>> vTextEditor::deleteCharBF <<<=================== - BUFFPTR vTextEditor::deleteCharBF(BUFFPTR charNum, long lineNum) - { - // First, shift everything up to next end of line left - // This routine must not assume that lines are stored contiguously - - - BUFFPTR ix; - BUFFPTR newCurChar = charNum; - - char combine[MAX_LINE*2+2]; - - char chrDeleted = GCh(charNum); - - if (lastLineBF() < 1) - return 0; - - if (IsEndLine(chrDeleted)) // combine two lines? - { - if (lineNum < (_nextLine - 1)) // There IS a next line - { - BUFFPTR bp; - int to; - int offset; - int len1 = 0; - int len2 = 0; - - // combine this line with the next line - to = 0; - for (bp = _lines[lineNum] ; *bp && !IsEndLine(*bp) ; ) - { - ++len1; - combine[to++] = *bp++; - } - - offset = to; // track where we were - - for (bp = _lines[lineNum+1] ; *bp && !IsEndLine(*bp) ; ) - { - ++len2; - combine[to++] = *bp++; - } - - if (len1 + len2 >= MAX_LINE) - return 0; // fail if too long now - - *bp = 0; // kill the old eol - - combine[to] = 0; - - // create buffer for it - bp = appendToBuff(combine); - if (!bp) - return 0; - - newCurChar = bp + offset; // this is new cur char - - // free the old space - delete [] _lines[lineNum]; - delete [] _lines[lineNum+1]; - _lines[lineNum] = bp; - - // shift up the rest of the lines - for (long lp = lineNum + 1 ; lp < _nextLine ; ++lp) - _lines[lp] = _lines[lp + 1]; - --_nextLine; - lastLine = lastLineBF(); - } - adjustLines(lineNum,-1); // one line deleted - } - else - { - newCurChar = charNum; - for (ix = charNum + 1 ; *ix && !IsEndLine(*ix) ; ++ix) - *(ix-1) = *ix; - *(ix-1) = *ix; - *ix = 0; - } - return newCurChar; - } - -// ===================>>> vTextEditor::deleteLinesBF <<<==================== - long vTextEditor::deleteLinesBF(long start, long end) - { - // delete the lines in the specified range, - // return new last line of file - - long to, from; - - if (lastLineBF() < 1) - return 0; - - for (to = start ; to <= end ; ++to) - delete[] _lines[to]; - - for (to = start, from = end+1 ; from < _nextLine ; ++to, ++from) - { - _lines[to] = _lines[from]; // shift - } - _lines[from] = 0; - _nextLine -= (end - start + 1); - adjustLines(start, -(end - start + 1)); - lastLine = lastLineBF(); - - if (_nextLine <= 1) - { - _lines[1] = new char[2]; strcpy(_lines[1], "\n"); - return 1; - } - - return _nextLine - 1; - } - -// =====================>>> vTextEditor::insertCharBF <<<=================== - int vTextEditor::insertCharBF(int chr, BUFFPTR& curchar, long& curline) - { - // insert a char into the buffer at curline, curchar. - // return new curchar, curline - - char ln1[MAX_LINE+2]; - char ln2[MAX_LINE+2]; - char* newLine; - BUFFPTR origLine = _lines[curline]; // original full line - int offSet; - int ix; - BUFFPTR fp; - - - if (chr == 0) // don't allow this case - return 0; - - offSet = 0; - for (BUFFPTR bp = origLine ; bp != curchar ; ++bp, ++offSet) - ; - - if (chr != '\n') - { - for (ix = 0, fp = origLine ; *fp != 0 && ix < MAX_LINE ; ) - { - if (ix == offSet) - ln1[ix++] = chr; // add the new char - ln1[ix++] = *fp++; // copy original line - } - if (ix == offSet) - ln1[ix++] = chr; // add the new char - ln1[ix] = 0; - newLine = appendToBuff(ln1); - if (!newLine) // see if got the space - return 0; - delete [] _lines[curline]; // free the old space - _lines[curline] = newLine; // point line to new space - curchar = newLine + offSet + 1; // update curchar - } - else // adding newline - { - // we are inserting a newline! - for (ix = 0, fp = origLine ; *fp != 0 && ix < MAX_LINE ; ) - { - if (ix == offSet) - ln1[ix++] = chr; // add the new char - ln1[ix++] = *fp++; // copy original line - } - if (ix == offSet) - ln1[ix++] = chr; // add the new char - ln1[ix] = 0; - - // ln1 now has two lines in it, split em up. - - char* cp; - for (cp = ln1 ; *cp != '\n' ; ++cp) // find first part - ; - *cp++ = 0; - - char *tp; - for (tp = ln2 ; *cp ; ) // copy second part - *tp++ = *cp++; - *tp = 0; - - newLine = appendToBuff(ln1); - if (!newLine) // see if got the space - return 0; - delete [] _lines[curline]; // free the old space - _lines[curline] = newLine; // point line to new space - - if (_nextLine >= _maxLines) // check for max lines - if (!reallocLines()) // add some more lines - return 0; - - long lx; - for (lx = _nextLine ; lx > curline ; --lx) - _lines[lx] = _lines[lx - 1]; - - newLine = appendToBuff(ln2); - if (!newLine) // see if got the space - return 0; - - ++curline; ++_nextLine; - lastLine = lastLineBF(); - adjustLines(curline,1); // one more line - - _lines[curline] = newLine; // point line to new space - - curchar = _lines[curline]; // point to line beginning - } - return 1; - } - -// ==========================>>> vTextEditor::lineLenBF <<<================= - int vTextEditor::lineLenBF(long lineNum) - { - if (lineNum < 1 || lineNum >= (_nextLine - 1)) - return 0; - - int len = 0; - for (BUFFPTR ix = _lines[lineNum] ; *ix != '\n' && *ix != 0 ; ++ix) - ++len; - return len; - } - -// ===================>>> vTextEditor::adjustLines <<<====================== - void vTextEditor::adjustLines(long line_1, int by) - { - /* adjust starting line number int note locaetions */ - - int ix; - - for (ix = 0 ; ix < 26 ; ++ix) /* adjust notes */ - { - if (noteloc[ix] > line_1) /* page needs fixing */ - noteloc[ix] += (long) by; - } - } - -// ######################################################################### -// -// Command Interface methods -// -// ######################################################################### - -// ===================>>> vTextEditor::EditCommand <<<====================== - int vTextEditor::EditCommand(int id, long val) - { - // returns 1 if command succeeded, 0 if failed - // or -1 if not processed - - int retval = 1; // assume OK - switch (id) - { - case edCut: // ^X : Cut - { - EditCut(); - break; - } - - case edCopy: // ^C : Copy - { - EditCopy(); - break; - } - - case edPaste: // ^V: Paste - { - EditPaste(); - break; - } - - case edBalMatch: // find matching paren (up to val lines away) - retval = BalMatch(val); - break; - - case edFind: // find - { - vFindDialog fdlg((vBaseWindow*)_parent); - if (!fdlg.AskFindPat(theFindPat, MAX_LINE, - findCaseSensitive, findDown, findWrap)) - return 0; - retval = Find(theFindPat, - findCaseSensitive,findDown,findWrap); - break; - } - - case edFindNext: // find again - { - if (*theFindPat) // something to find - retval = FindNext(findCaseSensitive,findDown,findWrap); - else - retval = 0; - break; - } - - case edReplace: // Replace - { - vReplaceDialog rdlg((vBaseWindow*)_parent); - - if (!rdlg.AskReplacePat(theFindPat, MAX_LINE, - theReplPat, MAX_LINE, - findCaseSensitive, findDown, findWrap, - replaceConfirm, replaceAll)) - return 0; - retval = Replace(theFindPat, theReplPat, - findCaseSensitive, findDown, findWrap, - replaceConfirm, replaceAll); - break; - } - - case edBufferBottom: // move to bottom of file (no val) - bufferBottom(); - break; - - case edCenterScreen: // center cursor in screen - CenterScreen(); - break; - - case edCharDelete: // delete val chars - retval = charDelete(val); - break; - - case edCharFoldCase: // swap case of val letters - retval = charFoldCase(val); - break; - - case edCharInsert: // insert char val - retval = charInsert(val); - break; - - case edCharRight: // move val chars right - retval = charRight(val); - break; - - case edFill: - retval = lineFill(val); - break; - - case edHelp: // Show help screen - _teCInt->CmdInterpHelp(); - break; - - case edIndent: // AutoIndent if on - retval = autoIndent(); - break; - - case edLineBeginning: // move to line beginning (no val) - lineBeginning(); - break; - - case edLineDown: // move down val lines in column - retval = lineDown(val); - break; - - case edLineDownBeg: // move down val lines - retval = lineDownBeg(val); - break; - - case edLineDelete: // delete val lines - lineDelete(val); - break; - - case edLineDeleteFront: // delete to beginning of line (no val) - retval = lineDeleteFront(); - break; - - case edLineDeleteToEnd: // delete to end of line (no val) - retval = lineDeleteToEnd(); - break; - - case edLineEnd: // move to end of line (no val) - lineEnd(); - break; - - case edLineGoto: // move cursor to line val - retval = lineGoto(val); - break; - - case edLineOpen: // open val new blank lines - retval = lineOpen(val); - break; - - case edFormatC: // format C code lines - retval = formatC(val); - break; - - case edNoteLocation: // note which line we are on - if (val >= 'a' && val <= 'z' ) - val = val-'a'; - if (val < 0 || val > 25) // 0 - 25 valid - val = 0; - noteloc[val] = GetCurLine(); - break; - - case edNoteGoto: // goto noted locateion - if (val >= 'a' && val <= 'z' ) - val = val-'a'; - if (val < 0 || val > 25) // 0 - 25 valid - val = 0; - retval = lineGoto(noteloc[val]); - break; - - case edUndo: // undo the last edit - retval = undoEdit(); - break; - - case edWordRight: // move cursor val words right - wordRight(val); - break; - - case edScrollDown: // scroll val lines without changing cursor - scrollDown(val); - break; - - case edVerify: // repaint screen - Verify(); - break; - - default: // editor can't handle - retval = -1; - break; - } - return retval; - } - -// ======================>>> vTextEditor::EditKeyIn <<<===================== - int vTextEditor::EditKeyIn(vKey key, unsigned int shift) - { - // process keystrokes -- return 1 if processed, 0 if - // command fails, and -1 if not recognized - - return _teCInt->ProcessKey(key, shift); - - } - -// ===================>>> vTextEditor::defaultKeyIn <<<===================== - int vTextEditor::defaultKeyIn(vKey key, unsigned int shift) - { - // this is a virtual function so that it would be possible - // to override this method to implement a modal editor like - // vi or see. - // Returns -1 if not processed, 1 if successful, 0 if - // command didn't succeed. - - int chr = (int)key; - - if ((shift & VKM_Alt || shift & VKM_Ctrl) - && (chr < ' ' || chr > 0x7E)) - return -1; - - if (chr < ' ' && chr != '\r' && chr != '\t' && chr != '\n') - return -1; - - if (chr > 0xFE) // ignore function and alt keys - return -1; - - int retval = charInsert(key); - if (retval && (key == '\n' || key == '\r')) - retval = autoIndent(); - return retval; - } - -// =======================>>> vTextEditor::Find <<<========================= - int vTextEditor::Find(char* pat, int caseSensitive, int Down, int Wrap) - { - // Copy a new pattern to the pattern buffer - - char *fp = pat; - int ix; - for (ix = 0 ; *fp && ix < MAX_LINE ; ) - theFindPat[ix++] = *fp++; - theFindPat[ix] = 0; - - return FindNext(caseSensitive, Down, Wrap); // now use findNext - } - -// =====================>>> vTextEditor::FindNext <<<======================= - int vTextEditor::FindNext(int caseSensitive, int Down, int Wrap) - { - // find a pattern = return 1 if found, 0 if not - - BUFFPTR findBP; - char* foundAt; - int ix; - int lineOffset = 0; - - char workPat[MAX_LINE + 2]; // working pattern - char workLine[MAX_LINE + 2]; // working line - - long findLine = curlin; - long origLine = curlin; - - if (lastLineBF() < 1) - return 0; - - int patLen = strlen(theFindPat); - - for (ix = 0 ; theFindPat[ix] != 0 ; ++ix) - { - if (caseSensitive) - workPat[ix] = theFindPat[ix]; - else - workPat[ix] = tolower(theFindPat[ix]); - } - workPat[ix] = 0; - - if (Down) - { - if (gState.findAtBeginning) - { - charRight(1,0); - } - findBP = curchr; - for ( ; ; ) - { - lineOffset = findBP - GLine(findLine); // if not at beginning - for (ix = 0 ; ix < MAX_LINE && GCh(findBP) != 0 ; ++findBP, ++ix) - { - if (caseSensitive) - workLine[ix] = GCh(findBP); - else - workLine[ix] = tolower(GCh(findBP)); - } - workLine[ix] = 0; - - foundAt = strstr(workLine,workPat); // see if in there - - if (foundAt != 0) // We found it! - { - undoOff("Undo"); - ClearMarkRange(); /* no range now */ - curlin = findLine; - int offset = foundAt - &workLine[0]; - - curchr = GLine(curlin) + offset + lineOffset; - - // set up mark range - mark.beg_lin = mark.end_lin = curlin; - mark.beg_col = col_pos(curchr,0); - mark.end_col = col_pos(curchr+patLen,0); - mark.beg_chr = curchr; - mark.end_chr = curchr + patLen; - - if (!gState.findAtBeginning) - curchr += patLen; // leave at end - - // need intelligent screen updating - // This puts the pattern in the middle if we've - // moved over a screen - if ((curlin - origLine) > GetRows()) - CenterScreen(); - else - update(curlin - origLine); - return 1; - } - if (findLine >= lastLine) - { - StatusMessage(" Pattern Not Found"); - if (gState.findAtBeginning) - { - charRight(-1,0); - } - return 0; - } - else - { - findLine++; - findBP = GLine(findLine); - } - - } - if (gState.findAtBeginning) - { - charRight(-1,0); - } - StatusMessage(" Pattern Not Found"); - return 0; - } - else // find up - { - if (!gState.findAtBeginning) - { - charRight(-1,0); - } - findBP = GLine(findLine); - BUFFPTR lim = curchr; // for first time - for ( ; ; ) - { - for (ix = 0 ; ix < MAX_LINE && GCh(findBP) != 0 ; - ++findBP, ++ix) - { - if (lim != 0 && findBP >= lim) - break; // first line only - if (caseSensitive) - workLine[ix] = GCh(findBP); - else - workLine[ix] = tolower(GCh(findBP)); - } - lim = 0; // done with first line - workLine[ix] = 0; - - foundAt = strstr(workLine,workPat); // search from end - - - if (foundAt != 0) // We found it! - { - // We found the first instance, now look for the last - char *cp = foundAt; - char *lastPat = 0; - char *nextPat = 0; - for (cp++ ; (nextPat = strstr(cp,workPat)) != 0 ; ++cp) - { - lastPat = nextPat; // remember last one - } - if (lastPat != 0) // there was a later pat - { - foundAt = &workLine[strlen(workLine)-strlen(lastPat)]; - } - - undoOff("Undo"); - ClearMarkRange(); /* no range now */ - curlin = findLine; - int offset = foundAt - &workLine[0]; - - curchr = GLine(curlin) + offset; - - // set up mark range - mark.beg_lin = mark.end_lin = curlin; - mark.beg_col = col_pos(curchr,0); - mark.end_col = col_pos(curchr+patLen,0); - mark.beg_chr = curchr; - mark.end_chr = curchr + patLen; - - if (!gState.findAtBeginning) - curchr += patLen; // leave at end - - // need intelligent screen updating - // This puts the pattern in the middle if we've - // moved over a screen - if ((curlin - origLine) > GetRows()) - CenterScreen(); - else - update(curlin - origLine); - return 1; - } - if (findLine <= 0) - { - if (!gState.findAtBeginning) - { - charRight(1,0); - } - StatusMessage(" Pattern Not Found"); - return 0; - } - else - { - findLine--; - findBP = GLine(findLine); - } - - } - if (!gState.findAtBeginning) - { - charRight(1,0); - } - StatusMessage(" Pattern Not Found"); - return 0; - } - } - -// =====================>>> vTextEditor::Replace <<<==================== - int vTextEditor::Replace(const char* pat, const char* repl, - int caseSensitive, int Down, int Wrap, int Confirm, int All) - { - const char* fp = pat; - const char* rp = repl; - int ix; - for (ix = 0 ; fp && *fp && ix < MAX_LINE ; ) - theFindPat[ix++] = *fp++; - theFindPat[ix] = 0; - for (ix = 0 ; rp && *rp && ix < MAX_LINE ; ) - theReplPat[ix++] = *rp++; - theReplPat[ix] = 0; - - if (state.echof && All && !Confirm) // echo off if all - state.echof = 0; - - while (FindNext(caseSensitive, Down, Wrap)) // now use findNext - { - ReplaceConfirm doit = YesRepl; // assume replace once - if (Confirm) - { - doit = (ReplaceConfirm) myConfirm->ConfirmRep(); - } - - if (doit == YesRepl || doit == YesReplNext || doit == RepAll) - { - checkIfScrolled(); - (void) SaveKillLine(1,true); // save current line - RemoveMarkRange(false); - ClearMarkRange(); /* no range now */ - for (const char* cp = repl ; *cp ; ++cp) - { - charInsert((int)*cp,false); - } - undoOn("Undo Replace"); - // just overrite the undo stuff caused by RemoveMarkRange - // undo: dodoReplace(findpattern,repl); - } - - if (doit == RepAll) // change to replace all mode - { - Confirm = 0; All = 1; - if (state.echof) - state.echof = 0; - } - - if (doit == QuitR) - { - if (All && !Confirm) - { - state.echof = 1; - Verify(); - } - return 1; - } - - if (doit == YesReplNext || doit == NoReplNext || All) - continue; - else - { - if (All && !Confirm) - { - state.echof = 1; - Verify(); - } - return 1; - } - } - - if (All && !Confirm) - { - state.echof = 1; - Verify(); - } - return 0; - } - -// =======================>>> vTextEditor::HPage <<<======================== - void vTextEditor::HPage(int shown, int top) - { - vTextCanvasPane::HPage(shown, top); - } - -// =======================>>> vTextEditor::VPage <<<======================== - void vTextEditor::VPage(int shown, int top) - { - - long target; - if (lastLineBF() < 1 || lastLine <= GetRows()) - { - setScrollBar(); - return; - } - if ((top+shown) >= 100) - target = lastLine; - else if (top < 1) - target = 1; - else - target = ((long)top * lastLine) / 100; - - if (target < 1) - target = 1; - if (target > lastLine) - target = lastLine; - if (scroll_lin < 0) - scrollDown(target - curlin); - else - scrollDown(target-scroll_lin); - } - -// =====================>>> vTextEditor::HScroll <<<======================== - void vTextEditor::HScroll(int step) - { - vTextCanvasPane::HScroll(step); - } - -// =====================>>> vTextEditor::VScroll <<<======================== - void vTextEditor::VScroll(int step) - { - if (step < 0) - scrollDown(-1); - else - scrollDown(1); - } - -// =====================>>> vTextEditor::FontChanged <<<==================== - void vTextEditor::FontChanged(VCONST vFont& newFont) - { - vTextCanvasPane::FontChanged(newFont); - } - -// ====================>>> vTextEditor::TextMouseDown <<<=================== - void vTextEditor::TextMouseDown(int row, int col, int button) - { - - if (button != 1) // ignore right button moves - { - vTextCanvasPane::TextMouseDown(row, col, button); - return; - } - - mouseMoveRow = mouseRow = row + 1; // convert to 1,1 corner - mouseMoveCol = mouseCol = col + 1; - MouseMoveTo(mouseRow,mouseCol); // doing the move at mouse down - // makes selections easier - setScrollBar(); - ClearMarkRange(); // forces deselect - } - -// ======================>>> vTextEditor::TextMouseUp <<<=================== - void vTextEditor::TextMouseUp(int r, int c, int button) - { - if (button != 1) // ignore right button moves - { - vTextCanvasPane::TextMouseUp(r, c, button); - return; - } - } - -// ======================>>> vTextEditor::CenterScreen <<<================= - void vTextEditor::CenterScreen() - { - // Some tricky stuff to put the cursor in the middle. - int old_ddline = ddline; - if (lastLine > GetRows()) - ddline = GetRows() / 2; - else - ddline = lastLine / 2; - if (ddline < 1) - ddline = 1; - newscr(); - tvxy(findX(),tvy); /* reset cursor to current position */ - ddline = old_ddline; - - setScrollBar(); // MUST do this! - ChangeLoc(curlin,col_pos(curchr,0)); - } - -// ======================>>> vTextEditor::MouseMoveTo <<<================= - void vTextEditor::MouseMoveTo(int row, int col) - { - - // used by MouseUp and MouseMove to update cursor location - if (scroll_lin < 0) // regular move - { - int cnt = row - tvdlin; - if (cnt != 0) // difference - lineDownBeg((long)cnt,0); // changing - else - lineBeginning(); // same row - tvhdln(); - } - else // switching position to scroll window - { - curlin = maxl((long)1,minl(scroll_lin + row - 1,lastLine)); - curchr = GLine(curlin); - scroll_lin = -1; - long old_ddline = ddline; // trick - terrible awful coding, but... - ddline = row; - newscr(); - int xf = findX(); - tvxy(xf,tvy); /* reset cursor to current position */ - ddline = old_ddline; - tvhdln(); - } - - b_lastln = curlin; - - while (!IsEndLine(GCh(curchr)) && col > findX() ) - { - ++curchr; - } - tvhdln(); - - ChangeLoc(curlin,col_pos(curchr,0)); - _teCInt->MouseJump(curlin, col_pos(curchr,0)); // notify cmdinterp - } - -// ======================>>> vTextEditor::TextMouseMove <<<================= - void vTextEditor::TextMouseMove(int r, int c, int button) - { - - if (button != 1) // ignore right button moves - { - vTextCanvasPane::TextMouseMove(r, c, button); - } - else // highlighting text - { - if (mouseRow <= 0 || mouseCol <= 0) - return; - - if (curlin < 1 || GetCols() < 1 || lastLineBF() < 1) - return; - - int row = r + 1; // convert to 1,1 corner - int col = c + 1; - - if (mouseMoveRow != row) // have moved a row down or up - { - if (row > mouseMoveRow) // moved down - { - int cnt = row - mouseMoveRow; - AddToRangeRow(cnt); // add rows - mouseMoveRow = row; - // and update to columns - AddToRangeCol(col); - mouseMoveCol = col; - } - else // moving mouse up rows - { - int cnt = row - mouseMoveRow; - AddToRangeRow(cnt); // add rows - mouseMoveRow = row; - // and update to columns - AddToRangeCol(col); - mouseMoveCol = col; - } - - } - else if (mouseMoveCol != col) // mouse to right of start - { - AddToRangeCol(col); - mouseMoveCol = col; - } - } - } - -// =========================>>> vTextEditor::setSelecton <<<================= - void vTextEditor::setSelection(int howmuch) - { - // set the selection based on current cursor location - // howmuch: 0: one char - // 1: one word - // 2: C symbol (uses .,->) - // 3: whole line - - BUFFPTR origBP; - BUFFPTR endchr, begchr; - BUFFPTR begLine = GLine(curlin); - - origBP = curchr; // remember where we are now - - ClearMarkRange(); - - // first, move left until previous char is not a-z, A-Z, 0-9 or _) - - if (howmuch == 1) - { - for (begchr = curchr ; begchr != begLine ; --begchr ) - { - if (!IsWordChar(GCh(begchr-1))) // break if not word char - break; - } - // now, find the end of the word - for (endchr = curchr ; !IsEndLine(GCh(endchr)) ; ++endchr) - { - if (!IsWordChar(GCh(endchr))) - break; - } - } - else if (howmuch == 2) // C identifier - { - char p; - // first, go left to simple beginning of symbol - for (begchr = curchr ; begchr != begLine ; --begchr ) - { - p = GCh(begchr-1); - if (!IsWordChar(p)) - break; - } - // now, find the end of the word - including operators and parens - int plev = 0; - for (endchr = curchr ; !IsEndLine(GCh(endchr)) ; ++endchr) - { - p = GCh(endchr); - if (plev > 0) - { - if (p == ')' || p == ']') - --plev; - else if (p == '(' || p == '[') - ++plev; - if (plev == 0) // done when back to 0 - { - ++endchr; - break; - } - } - else if (!IsWordChar(p) && p != '-' && p != '>' && p != '.') - { - if (p == '(' || p == '[') - ++plev; - else - break; - } - } - } - else if (howmuch == 3) // whole line - { - for (begchr = curchr ; begchr != begLine ; --begchr ) - { - } - for (endchr = curchr ; !IsEndLine(GCh(endchr)) ; ++endchr) - { - } - } - - mark.end_lin = mark.beg_lin = curlin; - - mark.beg_chr = begchr; - mark.beg_col = col_pos(begchr,0); - - mark.end_chr = endchr; - mark.end_col = col_pos(endchr,0); - curchr = origBP; - tvxy(1,tvy); // Finally, fix up the highlight - type_lines(curlin, 1); // by repainting current line - tvhdln(); // and rehome cursor - ((vWindow *)_parent)->SetValue(M_Cut, 1, Sensitive); - ((vWindow *)_parent)->SetValue(M_Copy, 1, Sensitive); - - } - -// =========================>>> vTextEditor::addToRange <<<================= - void vTextEditor::addToRange(long rows, long cols) - { - // add number of rows and columns to range - // assumes done intelligently.... - - int oldef = state.echof; - // first, do rows - - if (curlin + rows > lastLine) /* past end? 1.24b */ - return; - - if (rows != 0) - { - // the way AddToRangeRow works assumes the caller will - // then call AddToRangeCol as well. - - if (rows < -1) // screen update is broken for multiple rows up - state.echof = 0; // so kludge up this workaround - AddToRangeRow(rows); - AddToRangeCol(col_pos(curchr,0)); - } - if (cols != 0) - { - if (cols > 0) // moving right - { - if (cols > 999) // special case for Shift-End - { - if (rows == 0) // just Shift-End - { - while ( !IsEndLine(GCh(curchr)) ) - AddToRangeCol(col_pos(curchr,0)+1); - } - else - AddToRangeCol(1000); // Really from Ctrl-Shift-End - } - else // Simple Shift-Right - { - if (IsEndLine(GCh(curchr))) // If at end of line, special - { - if (curlin >= lastLine) /* past end? 1.24b */ - return; - AddToRangeRow(1); // Down one row - AddToRangeCol(0); // but fix up column - } - else - AddToRangeCol(col_pos(curchr,0)+1); // finally, and easy one - } - } - else - { - if (cols < -999) // for Shift-Home - { - if (rows == 0) // just Shift-Home - { - while (curchr != GLine(curlin)) - AddToRangeCol(col_pos(curchr,0)-1); - } - else // Really Ctrl-Shift-Home - AddToRangeCol(0); - - } - else // Shift-Left - { - if (curchr == GLine(curlin)) // at line beginning? - { - AddToRangeRow(-1); // up - AddToRangeCol(1000); // fix column by going to end - } - else - AddToRangeCol(col_pos(curchr,0)-1); // just Shift-Left - } - } - } - if (rows < -1) // screen update is broken for multiple rows up - { - state.echof = oldef; - Verify(); // so just do an extra verify - } - } - -// =========================>>> vTextEditor::AddToRangeCol <<<================= - void vTextEditor::AddToRangeCol(int col) - { - - if (col < 1) - col = 1; - - if (col_pos(curchr,0) < col) // add to right - { - if (mark.beg_lin == 0) /* no lines yet */ - { - mark.end_lin = mark.beg_lin = curlin; - mark.end_chr = mark.beg_chr = curchr; - mark.end_col = mark.beg_col = col_pos(curchr,0); - while (!IsEndLine(GCh(curchr)) - && col_pos(curchr,0) < col) // find new col - charRight(1,0); - mark.end_chr = curchr; - mark.end_col = col_pos(curchr,0); - } - else if (mark.end_lin < curlin) - { - mark.end_lin = curlin; - mark.end_chr = curchr; - mark.end_col = col_pos(curchr,0); - } - else if (mark.beg_lin == curlin && mark.end_lin == curlin - && col_pos(curchr,0) > mark.end_col) - { - mark.beg_col = mark.end_col; - mark.beg_chr = mark.end_chr; - mark.end_chr = curchr; - mark.end_col = col_pos(curchr,0); - } - else if (mark.beg_lin == curlin && // some of this line marked - ((mark.end_lin == curlin && col_pos(curchr,0) < mark.end_col) - || mark.end_lin != mark.beg_lin)) - { - while (!IsEndLine(GCh(curchr)) - && col_pos(curchr) < col) // find new col - charRight(1,0); - mark.beg_col = col_pos(curchr,0); - mark.beg_chr = curchr; - } - else // normal add to marked - { - while (!IsEndLine(GCh(curchr)) - && col_pos(curchr) < col) // find new col - charRight(1,0); - - mark.end_lin = curlin; - mark.end_chr = curchr; - mark.end_col = col_pos(curchr,0); - } - } - else // add to left - { - if (mark.beg_lin == 0) // no lines yet, so note it - { - if (curchr == GLine(curlin)) - return; // No op at line beginning - mark.end_lin = mark.beg_lin = curlin; - mark.end_chr = mark.beg_chr = curchr; - mark.end_col = mark.beg_col = col_pos(curchr,0); - while (col_pos(curchr) > col) // find new col - charRight(-1,0); - mark.beg_chr = curchr; - mark.beg_col = col_pos(curchr,0); - - } - else if (mark.end_lin < curlin) - { - mark.end_lin = curlin; - mark.end_chr = curchr; - mark.end_col = col_pos(curchr,0); - } - else if (mark.end_lin == curlin && // some of this line marked - ((mark.beg_lin == curlin && col_pos(curchr,0) > mark.beg_col) - || mark.beg_lin != curlin)) - { - // handles two cases: highlight on current line only, - // or highlight starts on some line before - while (col_pos(curchr) > col) // find new col - charRight(-1,0); - mark.end_col = col_pos(curchr,0); - mark.end_chr = curchr; - } - else if (mark.end_lin == curlin // some of this line marked - && col_pos(curchr,0) > mark.beg_col) - { - while (col_pos(curchr) > col) // find new col - charRight(-1,0); - mark.end_col = col_pos(curchr,0); - mark.end_chr = curchr; - } - else // normal add to marked - { - while (col_pos(curchr) > col) // find new col - charRight(-1,0); - - mark.beg_lin = curlin; - mark.beg_chr = curchr; - mark.beg_col = col_pos(curchr,0); - } - } - - tvxy(1,tvy); // Finally, fix up the highlight - type_lines(curlin, 1); // by repainting current line - tvhdln(); // and rehome cursor - ((vWindow *)_parent)->SetValue(M_Cut, 1, Sensitive); - ((vWindow *)_parent)->SetValue(M_Copy, 1, Sensitive); - } - -// =========================>>> vTextEditor::AddToRangeRow <<<================= - void vTextEditor::AddToRangeRow(long cnt) - { - /* add to mark range varaiable, update current line, then go down */ - - if (cnt == 0) - { - ClearMarkRange(); /* no range now */ - return; - } - - if (cnt > 0) - { - if (curlin + cnt > lastLine) /* past end? */ - cnt = lastLine - curlin + 1; - if (mark.beg_lin == 0) /* no lines yet */ - { - mark.beg_lin = curlin; - mark.beg_chr = curchr; - mark.beg_col = col_pos(curchr,0); - } - if (mark.end_lin == 0) - { - mark.end_lin = curlin + cnt - 1; - } - else if (mark.beg_lin == curlin // some of this line marked - && mark.end_lin != mark.beg_lin) - { - if (mark.end_lin == curlin + cnt - && col_pos(curchr,0) > mark.end_col) - { - mark.beg_lin = curlin + cnt; - mark.beg_col = mark.end_col; - mark.beg_chr = mark.end_chr; - } - else - { - mark.beg_col = col_pos(curchr,0); - mark.beg_chr = GLine(curlin+cnt); // Something legal - mark.beg_lin = curlin + cnt; - } - } - else - { - mark.end_lin += cnt; - mark.end_col = 1000; /* BIG */ - mark.end_chr = 0; /* end of line */ - } - - /* paint the lines to highlight */ - if (tvdlin+cnt-1 <= GetRows()) - { - tvxy(1,tvy); /* fix it up */ - type_lines(curlin,(int)cnt); - } - - if (curlin == lastLine && cnt > 0) /* down from last line? */ - { - return; - } - lineDown(cnt,0); - - } - else if (cnt < 0) // up lines - { - if (curlin + cnt < 1) // past start? - cnt = -curlin; - if (mark.end_lin == curlin && mark.beg_lin == curlin - && mark.end_lin != 0) - { - mark.end_col = mark.beg_col; - mark.end_chr = mark.beg_chr; - lineDown(cnt,0); - mark.beg_lin = curlin; - mark.beg_col = col_pos(curchr,0); - mark.beg_chr = curchr; - } - else - { - if (mark.end_lin == 0) //no lines yet - { - mark.beg_lin = mark.end_lin = curlin; - mark.end_chr = curchr; - mark.end_col = col_pos(curchr,0); - mark.beg_col = 1; - mark.beg_chr = GLine(curlin); - } - - if (mark.end_lin == curlin // some of this line marked - && mark.end_lin != mark.beg_lin) - { - if (mark.beg_lin == curlin + cnt - && col_pos(curchr,0) < mark.beg_col) - { - mark.end_lin = curlin + cnt; - mark.end_col = mark.beg_col; - mark.end_chr = mark.beg_chr; - lineDown(cnt,0); - mark.beg_col = col_pos(curchr,0); - mark.beg_chr = curchr; - } - else - { - lineDown(cnt,0); - mark.end_col = col_pos(curchr,0); - mark.end_chr = GLine(curlin+cnt); // Something legal - mark.end_lin = curlin; - } - } - else - { - // now move up specified number of lines, no clrRange - lineDown(cnt, 0); - - mark.beg_lin = curlin; - mark.beg_chr = curchr; - mark.beg_col = col_pos(curchr,0); - } - } - - /* paint the lines to highlight */ - tvxy(1,tvy); /* fix it up */ - type_lines(curlin,(int)-cnt+1); - tvhdln(); - } - ((vWindow *)_parent)->SetValue(M_Cut, 1, Sensitive); - ((vWindow *)_parent)->SetValue(M_Copy, 1, Sensitive); - } - - -// =========================>>> vTextEditor::Redraw <<<===================== - void vTextEditor::Redraw(int x, int y, int w, int h) - { - vTextCanvasPane::Redraw(x,y,w,h); - } - -// ======================>>> vTextEditor::ResizeText <<<==================== - void vTextEditor::ResizeText(const int rows, const int cols) - { - - // now, if the curlin is on the new scrolled screen, we need to - // repaint it so the cursor and highlight area show - - Verify(); - - if (ddline >= GetRows()) - { - HideTextCursor(); - setCursor = 1; - } - else - setCursor = 0; - - setScrollBar(); - } - -// ######################################################################### -// -// screen update stuff - maps old see/tv to vTextCanvasPane methods -// -// ######################################################################### - -// =========================>>> vTextEditor::tvxy <<<======================= - void vTextEditor::tvxy(int ix, int iy) - { - // tvxy - position cursor at position x,y - // x=1 is left most column - // y=1 is top most line - - tvx = ix; - tvy = iy; - if (!state.echof) - return; - GotoRC(iy-1,ix-1); // Convert to 0,0 based coords - } - -// =========================>>> vTextEditor::tvplin <<<===================== - void vTextEditor::tvplin(long lineNum, BUFFPTR chrptr, int whole_line, - int hibeg, int hiend) - { /* tvplin - put line beginning at chrptr - will only type what will fit on screen (using xout) */ - - char tmp; - int linlen, origx, need_hi_end; - - int hiStart = -1; - int hiLast = -1; - - BUFFPTR i; - - char linout[MAX_LINE+1]; - - need_hi_end = 0; - - last_col_out = linptr = 0; - origx = xoutcm; /* save x so can get true linelen */ - for (i = chrptr; !IsEndLine(GCh(i)) && xoutcm < MAX_LINE; ++i) - { - /* xoutcm has current column. If a hilite goes here, - *add to the linout array as 0x01 or 0x02. - */ - if (xoutcm == hibeg) - { - hiStart = linptr; // where highlight starts - need_hi_end = 1; /* will need a follow */ - } - if (xoutcm == hiend) - { - hiLast = linptr; // where highlight ends - need_hi_end = 0; /* don't need a follow now */ - } - if (GCh(i) < ' ' && GCh(i) >= 0) /* control character? */ - { - if (GCh(i) == '\t') - { - if (gState.tabspc > 0) - { - do - { - linout[linptr++] = ' '; /* replace with blanks */ - ++xoutcm; - } - while ( ((xoutcm-1) % gState.tabspc) != 0); - } - else - { - linout[linptr++] = '^'; - linout[linptr++] = 'I'; - xoutcm += 2; - linout[linptr++] = '*'; - ++xoutcm; - } - continue; - } - else /* other control character */ - { - linout[linptr++] = '^'; - ++xoutcm; - if (xoutcm == GetCols() && !(IsEndLine(GCh(i))) ) - continue; - tmp = GCh(i) + '@'; - linout[linptr++] = tmp; - - } - } /*# end if control character */ - else - { - linout[linptr++] = GCh(i); - } - ++xoutcm; - } - - if (need_hi_end) - { - hiLast = linptr; - need_hi_end = 0; /* don't need a follow now */ - } - - linout[linptr] = 0; // terminate the line - - int lineStart = 0; - - // This whole line stuff is left over. I don't know exactly what it - // did, but it breaks repainting when the margin is shifted, so just - // ignore the whole_line value... BEW: 10/1/98 - -//@ if (whole_line) /* write whole line */ - { - last_col_out = linlen = mint(GetCols(),linptr-leftmg+1); - lineStart = leftmg - 1; - } - - if (linlen > 0) - paintLine(linout, lineStart, hiStart, hiLast, lineNum); - - } - -// ======================>>> vTextEditor::paintLine <<<===================== - void vTextEditor::paintLine(char* linout, int lineStart, - int hiStart, int hiLast, long lineNum) - { - // paint a line. This can be overridden (e.g., for syntax highlighting). - // linout: the line to output with tabs converted to spaces, etc. - // lineStart: where to begin printing the line (for hoiz. scrolling) - // hiStart, hiLast: reverse text attribute - // lineNum: the real line number in the buffer this is. This is unused - // normally, but can be used for syntax highlighting to get - // surrounding context. - - int linlen = strlen(linout); - if (linlen > 0) // only draw if there! - { - char tmpChr; // to hold char - - if (hiStart < lineStart && hiLast < lineStart) // no highlight - { - DrawText(&linout[lineStart]); // simple case - } - else // has highlighting - { - if (hiStart > lineStart) // highlight from beginning - { - tmpChr = linout[hiStart]; // remember char - linout[hiStart] = 0; - DrawText(&linout[lineStart]); // normal part - linout[hiStart] = tmpChr; // replace - } - - tmpChr = linout[hiLast]; // remember char - linout[hiLast] = 0; // make end of string - DrawAttrText(&linout[hiStart],getHighlight()); // highlight part - linout[hiLast] = tmpChr; // replace - - if (linlen > hiLast) // rest of line - DrawText(&linout[hiLast]); - } - } - } - -// ====================>>> vTextEditor::highLightCurLine <<<====================== - void vTextEditor::highLightCurLine() - { - // Highlight current line using reverse instead of highlight - ChrAttr old = getHighlight(); - setHighlight(ChReverse); - type_lines(curlin, 1, 1); // by repainting current line - tvhdln(); // and rehome cursor - setHighlight(old); - } - -// ====================>>> vTextEditor::type_lines <<<====================== - void vTextEditor::type_lines(long ibeg, int icnt, int wholeLine) - { /* type_lines - type icnt lines starting at lines[ibeg] - no cr/lf on the last line */ - - long i, lim; - int hibeg, hiend; - BUFFPTR start; - - if (!state.echof) - return; - if (ibeg < 1 || ibeg > lastLine) - return; - xoutcm = tvx; - lim = ibeg+icnt-1; - - for (i = ibeg ; i <= lim && i <= lastLine ; ++i) - { - /* simple check for whole line highlighting for now */ - if (wholeLine) - { - hibeg = 1; - hiend = 1000; - } - else if (i == mark.beg_lin) - { - hibeg = mark.beg_col; - if (i == mark.end_lin) - hiend = mark.end_col; - else - hiend = 1000; - } - else if (i >= mark.beg_lin && i <= mark.end_lin) - { - hibeg = 1; - if (i == mark.end_lin) - hiend = mark.end_col; - else - hiend = 1000; - } - else - { - hibeg = hiend = -1; - } - - start = GLine(i); - tvplin(i,start,1,hibeg, hiend); /* type out a wole line */ - xoutcm = 1; - if (last_col_out < GetCols()) - tvelin(); /* erase rest of line */ - if ( i != lim ) - tvxy(1,++tvy); - } - } - -// =========================>>> vTextEditor::Verify <<<===================== - void vTextEditor::Verify(void) - { // Verify - rewrite the screen or type current line with cursor - - int xf, old_ddline; - - if (!state.echof) - return; - - if (lastLineBF() < 1) - { - tvclr(); - return; - } - old_ddline = ddline; - ddline = dsplin; - newscr(); - xf = findX(); - tvxy(xf,tvy); /* reset cursor to current position */ - ddline = old_ddline; - ChangeLoc(curlin,col_pos(curchr,0)); - setScrollBar(); - } - -// =====================>>> vTextEditor::tvbotb <<<========================= - void vTextEditor::tvbotb(int n) - { // tvbotb - make n blank lines at the bottom of the screen - - if (!state.echof) - return; - if (n >= GetRows()) - { - tvclr(); - } - else - { - tvxy(1,GetRows()); /* go to real last line */ - - ScrollText(n); - int j = GetRows()-n+1; /* home to virtual last line */ - tvxy(1,j); /* position at first new blank line */ - } - } - -// ==========================>>> vTextEditor::tvclr <<<========================== - void vTextEditor::tvclr(void) - { // tvclr - clear the entire screen and home - - if (!state.echof) - return; - Clear(); - tvxy(1,1); - tvx = tvy = 1; - } - -// ========================>>> vTextEditor::tvelin <<<====================== - void vTextEditor::tvelin(void) - { // tvelin - erase the rest of the current line - - if (!state.echof) - return; - int r,c; - GetRC(r,c); - ClearRow(r, c); - } - -// ========================>>> vTextEditor::tvescr <<<====================== - void vTextEditor::tvescr(void) - { // tvelin - erase from cursor to end of screen - - if (!state.echof) - return; - ClearToEnd(tvy-1, tvx - 1); - } - -// ==========================>>> vTextEditor::tvtopb <<<==================== - void vTextEditor::tvtopb(int n) - { // tvtopb - create n blank lines at the top of the screen - - if (!state.echof) - return; - - tvxy(1,1); /* home first */ - if ( n >= GetRows()) - { - tvescr(); /* simply erase the screen */ - } - else - { - ScrollText(-n); - } - tvxy(1,1); /* home first */ - } - -// =======================>>> vTextEditor::bufferBottom <<<================= - void vTextEditor::bufferBottom(void) - { // bufferBottom - move cursor to bottom of current buffer - - if (lastLineBF() < 1) - return; - - ClearMarkRange(); /* no range now */ - wasColCmd = 0; - - curlin = lastLine; /* the last real line of text */ - curchr = GLine(curlin); /* the first char of that line */ - lineEnd(); /* goto end of the line */ - newscr(); // update the screen - } - -// ######################################################################### -// -// char methods -// -// ######################################################################### - -// =======================>>> vTextEditor::charDelete <<<=================== - int vTextEditor::charDelete(long cnt, bool doUndo, bool removeRange) - { // charDelete - delete next cnt characters - - static char chdel; - int abscnt,newx; - int i; - - if (state.readOnly || lastLineBF() < 1) - return 0; - - checkIfScrolled(); - if (removeRange && RemoveMarkRange(doUndo)) /* there was a range to kill */ - return 1; - ClearMarkRange(); /* no range now */ - wasColCmd = 0; - - abscnt = (cnt > 0) ? cnt : (-cnt); /* remember absolute value of cnt */ - - state.changes += abscnt; /* track changes */ - - if (cnt < 0) - charRight(cnt,0); - - if (doUndo) - { - long cntCurlin = curlin; // copy of current line - BUFFPTR cntCurchr = curchr; // copy of current char - - // find out how many lines are involved, then save that many... - - bool partialLine = false; - bool lastDeleted = false; // end of line in last line deleted? - int cntLines = 1; - for (i = 0 ; i < abscnt ; ++i) - { - if (IsEndLine(GCh(cntCurchr))) /* at end of line */ - { - if (cntCurlin >= lastLine) - { - break; /* don't go beyond end! */ - } - lastDeleted = true; // have reached end of line - ++cntLines; // how many lines we've seen - ++cntCurlin; - cntCurchr = GLine(cntCurlin); - } - else - { - lastDeleted = false; // haven't deleted whole line - ++cntCurchr; - } - } - - // We need to handle partial lines on undo. If we delete just - // part of the first line, the first line will be combined - // with the next line. Same is true if we have a partial last - // line - it will be combined with the line above it. In - // either case, we need to delete the line that remains at - // curlin after the delete before restoring the unkill buffer. - - partialLine = curchr != GLine(curlin); // partial first line - - if (curchr == GLine(curlin) && lastDeleted && cntLines == 2) - partialLine = true; // exactly one line (but count is 2!) - - if (!lastDeleted) // partial last line - partialLine = true; - - if (!SaveKillLine(cntLines, partialLine)) - { - //@@ abort if can't save all. no-op for now. - } - } - - for (i = 0 ; i < abscnt ; ++i) - { - BUFFPTR newCurChr; - - chdel = GCh(curchr); /* remember the char we are deleting */ - - newCurChr = deleteCharBF(curchr,curlin); - if (newCurChr == 0) // deleteCharBF might fail! - { - if (cnt < 0) - charRight(-cnt,0); // go back - return 0; - } - else - curchr = newCurChr; - - if (!IsEndLine(chdel)) - { - if (i + 1 == abscnt || IsEndLine(GCh(curchr))) - { - if (abscnt > 1) - Verify(); // need to verify for big deletes - else - retypeCurlin(1); // just retype current line - } - } - else - { - lastLine = lastLineBF(); - if (tvdlin < dsplin) // not at end - { - tvescr(); /* erase rest of screen */ - tvxy(1,tvy); /* fix it up */ - type_lines(curlin,mint((int)(GetRows() - tvdlin+1), - (int)(lastLine - curlin)) ); - newx = findX(); /* where cursor will go */ - tvxy(newx,tvy); /* reposition cursor */ - } - else /* at end of buffer */ - Verify(); - } - } - - ChangeLoc(curlin,col_pos(curchr,0)); - return 1; - } - -//=====================>>> vTextEditor::charFoldCase <<<==================== - int vTextEditor::charFoldCase(long cnt) - { - /* fold from upper to lower or lower to upper case if letter */ - int ni; - char fchr; - - if (state.readOnly) - return 0; - - ClearMarkRange(); /* no range now */ - wasColCmd = 0; - - for (ni = 0 ; ni < cnt ; ++ni) - { - fchr = GCh(curchr); /* get current character */ - if (fchr >= 'a' && fchr <= 'z') - fchr = cupper(fchr); - else if (fchr >= 'A' && fchr <= 'Z') - fchr = clower(fchr); - if (IsEndLine(fchr)) - charRight((long)1,1); - else - { - if (!charDelete((long) 1, false)) // delete cur char - return 0; - if (!charInsert((int)fchr,false)) /* and put back */ - return 0; - } - } - return 1; - } - -// ====================>>> vTextEditor::charInsert <<<====================== - int vTextEditor::charInsert(int ival, bool doUndo) - { - int xf; - int chr; - - if (state.readOnly) - return 0; - checkIfScrolled(); - - if (doUndo) - { - // for now, we don't undo inserts - undoOff("Undo"); - } - - if (gState.delOnInsert) - RemoveMarkRange(doUndo); /* no range now */ - - wasColCmd = 0; - - chr = ival; /* use the passed value */ - - ++state.changes; /* count changes */ - - if (lastLineBF() == 0) // First actual insert! - { - char ln1[4]; - resetBuff(); - if (chr == '\n') // this effecitvely is two lines! - { - ln1[0] = 0; - addLine(ln1); - addLine(ln1); - tvdlin = 2; - displayBuff(1); // get a proper display - } - else - { - ln1[0] = chr; - ln1[1] = 0; - addLine(ln1); - if (!_lines[1]) - return 0; - curlin = 1; - curchr = _lines[1] + 1; - tvdlin = 1; - displayBuff(1); // get a proper display - lineEnd(); // move to end of the line - } - setScrollBar(); - return 1; - } - - if (!state.ins_mode) // overtype mode? - { - if (!charDelete(1,false)) // delete nextchar - return 0; - } - - if (chr == '\r') - chr = '\n'; // this is our convention - - if (chr == 0) - chr = ' '; - - if (!insertCharBF(chr, curchr, curlin)) - return 0; - lastLine = lastLineBF(); // update this one - - if (chr != '\n') - { - retypeCurlin(0); // just retype whole line - } - else - { - long dummy1; int dummy2; - FindDispLine(dummy1,dummy2); - if (tvdlin < dsplin) // not at end - { - tvescr(); /* erase rest of screen */ - tvxy(1,tvy); /* fix it up */ - type_lines(curlin,mint((int)(GetRows() - tvdlin + 1), - (int)(lastLine - curlin)) ); - } - else /* at end of buffer */ - Verify(); - setScrollBar(); - tvhdln(); /* home to display line */ - xf = findX(); - tvxy(xf,tvy); /* reset cursor to current position */ - } - - ChangeLoc(curlin,col_pos(curchr,0)); - - return 1; - } - -// ====================>>> vTextEditor::retypeCurlin <<<====================== - void vTextEditor::retypeCurlin(int eraseLine) - { - if (!state.echof) - return; - if (eraseLine) - tvelin(); - tvxy(1,tvy); - tvtyln(curlin,GLine(curlin), curchr == GLine(curlin)); - tvhdln(); // home to display line - int xf = findX(); - tvxy(xf,tvy); // reset cursor to current position - } - -// ====================>>> vTextEditor::charRight <<<====================== - int vTextEditor::charRight(long cnt, int clear_mark) - { // charRight: move cursor right cnt characters - // newlines count as one character - - long change; - int i, rv; - - if (lastLineBF() < 1) - return 0; - if (cnt == 0) - return 1; - - checkIfScrolled(); - if (clear_mark) - ClearMarkRange(); /* no range now */ - - wasColCmd = 0; - - rv = 1; /* assume success */ - change = 0; /* no change yet */ - if (cnt > 0) /* moving right */ - { - for (i = 1 ; i <= cnt ; ++i) - { - if (IsEndLine(GCh(curchr))) /* at end of line */ - { - if (curlin >= lastLine) - { - rv = 0; - break; /* don't go beyond end! */ - } - ++curlin; - ++change; /* we've gone down one line */ - curchr = GLine(curlin); - } - else - ++curchr; - } - } - else if (cnt < 0) /* moving left */ - { - cnt = (-cnt); /* fix this */ - for (i = 1 ; i <= cnt ; ++i) - { - if (curchr == GLine(curlin)) /* at front */ - { - if (curlin > 1) /* can only go up on >= line 2 */ - { - --curlin; - --change; - for (curchr = GLine(curlin) ; - !IsEndLine(GCh(curchr)) ; - ++curchr) - ; /* bump curchr to end of the line */ - } - else - { - rv = 0; - break; /* don't go beyond front! */ - } - } - else - --curchr; - } - } - if (change != 0) /* don't do unnecessary change */ - update(change); - if (clear_mark) - ChangeLoc(curlin,col_pos(curchr,0)); - tvhdln(); - return rv; - } - -// ######################################################################### -// -// line methods -// -// ######################################################################### - -// ===================>>> vTextEditor::lineBeginning <<<==================== - void vTextEditor::lineBeginning() - { /* lineBeginning - move cursor to beginning of current line */ - - int xf; - - if (lastLineBF() < 1) - return; - - ClearMarkRange(); /* no range now */ - wasColCmd = 0; - - curchr = GLine(curlin); /* point to current character */ - xf = findX(); /* this line needed to make the next */ - /* call eval order independent, if you wondered */ - tvxy(xf,tvy); /* and move cursor */ - ChangeLoc(curlin,col_pos(curchr,0)); - } - -// =====================>>> vTextEditor::lineDelete <<<===================== - void vTextEditor::lineDelete(long cnt, bool doUndo) - { // lineDelete - delete cnt lines - - int ityp; - - long line_1, last_line; /* range of lines to kill */ - long istrt; - - if (state.readOnly || lastLineBF() < 1) - return; - ClearMarkRange(); /* no range now */ - wasColCmd = 0; - - if (cnt == 0) - return; - - if (cnt < 0) /* negative kill */ - { - cnt = minl(-cnt,curlin-1); /* all upwards? */ - lineDownBeg(-cnt,0); /* go up that far */ - } - - if (doUndo) - { - if (!SaveKillLine(cnt)) - { - //@@ abort if can't save all. no-op for now. - } - } - - if (cnt != 0) - { - range(cnt,&line_1,&last_line); /* calculate the line numbers to kill */ - - curlin = line_1; /* remember new current line */ - - - ++state.changes; /* count changes */ - lastLine = deleteLinesBF(line_1,last_line); /* delete the lines from the buffer(s) */ - - if (lastLine < curlin) - curlin = lastLine; /* don't go past end */ - - curchr = GLine(curlin); /* remember new current character */ - - if (cnt >= 0 && curlin+(GetRows() - tvdlin) <= lastLine && - tvdlin < GetRows()) /* killing down */ - { - tvxy(1,tvy); /* get to start of line */ - ityp = (int) minl((long)(GetRows()-tvdlin+1),lastLine - curlin + 1); - tvescr(); /* erase the screen */ - istrt = curlin; - type_lines(istrt, ityp); - tvhdln(); /* home to display line */ - } - else - Verify(); /* kill up, retype screen */ - } - ChangeLoc(curlin,col_pos(curchr,0)); - } - -// =====================>>> vTextEditor::lineDeleteFront <<<=============== - int vTextEditor::lineDeleteFront(bool doUndo) - { // lineDeleteFront - delete from cursor to beginning of line - - int chrs; - - if (state.readOnly || lastLineBF() < 1) - return 0; - ClearMarkRange(); /* no range now */ - wasColCmd = 0; - - chrs = curchr - GLine(curlin); /* how much to delete */ - if (chrs > 0) - return charDelete((long)(-chrs),doUndo); // won't cause a combine, so don't worry - return 1; - } - -// =====================>>> vTextEditor::lineDeleteToEnd <<<=============== - int vTextEditor::lineDeleteToEnd(bool doUndo) - { // lineDeleteToEnd: - // kill the rest of the line, not including cursor and endLine - - int chrs; - BUFFPTR i; - - if (state.readOnly || lastLineBF() < 1) - return 0; - ClearMarkRange(); // no range now - wasColCmd = 0; - - chrs = 0; - for (i = curchr; !IsEndLine(GCh(i)) ; ++i) - ++chrs; // count how much to delete - if (chrs > 0) - return charDelete((long) chrs, doUndo); // won't cause combine - return 1; - } - -// ========================>>> vTextEditor::lineDown <<<==================== - int vTextEditor::lineDown(long cnt, int clrRange) - { /* lineDown - move down in column */ - - int curcol,l,oldef,needns,ic,ix,lim,rv; - - if (lastLineBF() < 1) - return 0; - if (clrRange) - ClearMarkRange(); /* no range now */ - - oldef = state.echof; - needns = 0; - if (leftmg > 1) /* handle right virtual screen different */ - { - needns = 1; - } - - if (wasColCmd) // going up/down columnwise - curcol = oldcol; - else - oldcol = curcol = col_pos(curchr,1); /* calculate the current column */ - - rv = lineDownBeg(cnt,0,clrRange); /* go down given lines, update screen */ - - state.echof = 0; - - if (curlin >= 1 && curlin <= lastLine && curcol > 1) /* not at ends? */ - { - l = lineLenBF(curlin); - lim = mint(curcol-1,l); - for (ix = 0, ic = col_pos(curchr,1) ; ix < lim && ic < curcol ; - ++ix, ic = col_pos(curchr,1)) - ; - charRight((long)ix,clrRange); - } - - state.echof = oldef; - if (needns) /* needed new screen */ - { - Verify(); - } - else - tvhdln(); - ChangeLoc(curlin,col_pos(curchr,0)); - wasColCmd = 1; - return rv; - } - -// ====================>>> vTextEditor::lineDownBeg <<<===================== - int vTextEditor::lineDownBeg(long cnt, int notify, int clrRange) - { /* lineDownBeg - move dot down cnt lines */ - - long oldlin,change; - - if (lastLineBF() < 1) - return 0; - if (clrRange) - ClearMarkRange(); /* no range now */ - wasColCmd = 0; - - if (curlin == lastLine && cnt > 0) /* down from last line? */ - { - lineEnd(); - return 0; /* make loops fail */ - } - oldlin = curlin; /* remember where we started from */ - if (curlin + cnt < 1) - curlin = 1; - else if (curlin + cnt > lastLine) - curlin = lastLine; - else - curlin = curlin + cnt; - curchr = GLine(curlin); /* point to the current character */ - change = curlin-oldlin; /* calculate how many lines changed */ - update(change); /* update the screen */ - if (notify) - ChangeLoc(curlin,col_pos(curchr,0)); - return change != 0; - } - -// =====================>>> vTextEditor::lineEnd <<<======================== - void vTextEditor::lineEnd(int clrRange) - { // lineEnd - move cursor to end of the line - - int knt; - BUFFPTR i; - - if (lastLineBF() < 1) - return; - if (clrRange) - ClearMarkRange(); /* no range now */ - wasColCmd = 0; - - knt = 0; - for (i = curchr ; !IsEndLine(GCh(i)) ; ++i) /* find end of line */ - ++knt; - charRight((long)knt,clrRange); /* move to end of line */ - ChangeLoc(curlin,col_pos(curchr,0)); - } - -// ======================>>> vTextEditor::lineOpen <<<====================== - int vTextEditor::lineOpen(long cnt) - { // lineOpen - open a new line - - int i; - long pcnt; - - - if (state.readOnly || lastLineBF() < 1) - return 0; - - undoOff("Undo"); - pcnt = cnt >= 0 ? cnt : (-cnt); /* only allow positive opens */ - - for (i=1; i<=pcnt; ++i) - { - if (!charInsert('\n')) /* insert right number of newlines */ - return 0; - } - - lineDownBeg(-pcnt,0); /* and goto beginning of the opened line */ - - lineEnd(); - return 1; - } - -// ======================>>> vTextEditor::lineGoto <<<====================== - int vTextEditor::lineGoto(long cnt) - { // lineGoto: move cursor to line cnt - - if (cnt < 0 || lastLineBF() < 1) - return 0; - - undoOff("Undo"); - - ClearMarkRange(); /* no range now */ - wasColCmd = 0; - - curlin = maxl(minl(cnt,lastLine),(long) 1); /* move to lines */ - curchr = GLine(curlin); /* point to the current character */ - Verify(); - return 1; - } - -// =====================>>> vTextEditor::lineAutoFill <<<=================== - void vTextEditor::lineAutoFill(void) - { - BUFFPTR bx, startx; - int lines, old_ef, old_y, ityp, go_right, cp, chr; - long start_line, istrt; - - if (state.readOnly || lastLineBF() < 1) - return; - - if (gState.wraplm < 1) - return; /* no auto-wrap going on */ - - /* 1. Check if current line needs to be wrapped */ - - startx = GLine(curlin); /* first char of line */ - bx = lastBX(curlin); /* index of last char of line */ - if (startx == bx) - return; /* blank line, can't need tidy */ - if (col_pos(bx,0) <= gState.wraplm) /* is last char beyond limit? */ - return; /* line doesn't need tidy */ - - /* 2. If it does, figure out where the cursor is. */ - - go_right = curchr - startx; /* where CURRENT char is */ - start_line = curlin; - old_y = tvdlin; /* original line */ - - /* 3. Echo off. */ - - old_ef = state.echof; - state.echof = 0; - - /* 4. Tidy down to PP or blank line or line beginning with white */ - - for (lines = 1 ; lines < 50 && curlin <= lastLine ; - ++lines ) - { - lineFill((long) 1); /* fix current line */ - chr = GCh(curchr); - if (chr == '.' || chr == ' ' || chr == '\t' || IsEndLine(chr)) - break; - } - - /* 5. Restore echo */ - - state.echof = old_ef; - - /* 6. Return to current line, making sure it stays where it was - on the screen (or shift by one if it gets moved), - and repaint the rest of the screen. - */ - - curlin = start_line; - curchr = GLine(curlin); - tvdlin = old_y; - - if (state.echof) - { - tvxy(1,old_y); - istrt = curlin; - ityp =(int) minl((long)(GetRows()-tvdlin+1), - lastLine - curlin + 1); - type_lines(istrt, ityp); - } - - tvhdln(); /* home to display line */ - - for ( ; ; ) - { - bx = lastBX(curlin); /* see if still on this line */ - cp = col_pos(bx,0); - if (go_right <= cp) /* on this line */ - { - curchr = GLine(curlin) + go_right; - break; - } - go_right -= cp; /* next line */ - if (!lineDownBeg((long) 1,0)) - break; - } - tvhdln(); /* home to display line */ - ChangeLoc(curlin,col_pos(curchr,0)); - } - -// =====================>>> vTextEditor::lineFill <<<======================= - int vTextEditor::lineFill(long count) - { // lineFill - fill lines to current margin - - char curline[20]; /* first part of current line */ - - int oldef, i ; - BUFFPTR linbeg, old_cc; - int retval; - - if (state.readOnly || lastLineBF() < 1 || gState.wraplm < 1) - return 0; /* no auto-wrap going on */ - - undoOff("Undo"); - - ClearMarkRange(); /* no range now */ - wasColCmd = 0; - - retval = 1; - oldef = state.echof; - if (count > 1) - state.echof = 0; - if (gState.wraplm <= 1 || curlin > lastLine) - goto l900; /* work only if wrap limit turned on */ - - for (i = 1 ; i <= count ; ++i) - { - lineBeginning(); /* start at beginning of line */ - if (curlin >= lastLine) - goto l900; - - // don't fill leading space, cr, period, tab, - // latex keyword, or some HTML - - getCurLineFront(curline,curlin); /* current line */ - if (!(*curline) || isSpecial(curline)) - { - lineDownBeg((long) 1,0); - continue; /* skip special lines */ - } - - while (curlin < lastLine) - { - if (IsEndLine(GCh(curchr))) - { - if (tvx+leftmg-1 < gState.wraplm) /* combine lines! */ - { - /* pt to first char of next line */ - linbeg = GLine(curlin+1); - getCurLineFront(curline,curlin+1); // get the front - if (IsEndLine(GCh(linbeg)) || isSpecial(curline)) - { - lineDownBeg((long) 1); - break; /* no more combining */ - } - if (! Fill1(1,32)) - goto l990; - /* fall thru to test for wrap */ - } - else - { - lineDownBeg((long) 1); /* no more combining on line */ - break; - } - } - - old_cc = curchr; - wordRight((long) 1); - if (tvx+leftmg-1 > gState.wraplm) - { - if (tvx+leftmg-2 == gState.wraplm && IsEndLine(GCh(curchr)) ) - { - lineDownBeg((long) 1); - break; - } - else if ((tvx+leftmg-2 == gState.wraplm || - tvx+leftmg-3 == gState.wraplm) && - (GCh(curchr-1) == ' ' || GCh(curchr-1) == '\t')) - { - if (!Fill1(-1,'\n')) - goto l990; - } - else if (GCh(old_cc-1) == ' ' || - GCh(old_cc-1) == '\t') - { - curchr = old_cc; - if (!Fill1(-1,'\n')) - goto l990; - } - else if (GCh(old_cc-2) == ' ' || - GCh(old_cc-2) == '\t') - { - curchr = old_cc-1; - if (!Fill1(-1,'\n')) - goto l990; - } - else if (IsEndLine(GCh(curchr)) ) - { - lineDownBeg((long) 1); - break; - } - else if (GCh(curchr-1) == ' ' || - GCh(curchr-1) == '\t') - { - if (!Fill1(-1,'\n')) - goto l990; - } - else - { - for (wordRight((long) -1) ; /* go back a word, then break */ - (GCh(curchr-1) != ' ' && GCh(curchr-1) != '\t' - && !IsEndLine(GCh(curchr-1)) ) ; - wordRight((long) -1)) - { - /* this line can't be filled - stop now */ - if (curchr == GLine(curlin)) - goto l990; - } - charInsert('\n',false); - } - break; - } - - } /* end of for (;;) */ - - } /*# end of the for (count) */ -l900: - state.echof = oldef; - if (oldef && count > 1) - Verify(); - - ChangeLoc(curlin,col_pos(curchr,0)); - return retval; - -l990: /* failure return */ - retval = 0; - goto l900; - } - -//===========================>>> vTextEditor::isSpecial <<<===================== - bool vTextEditor::isSpecial(char* curline) - { - - static char* special[] = /* special keywords */ - { /* that shouldn't cause a wrap */ - "", - "

>> vTextEditor::formatC <<<===================== - int vTextEditor::formatC(long count) - { - /* format C code according to Bruce's style */ - - int oldef, i, ij, ik, spaces, tabs, prev_key; - long prev_lnum; - -#define MAX_PREV 100 - char prev_line[MAX_PREV]; - char prev_prev_line[MAX_PREV]; - - oldef = state.echof; - if ( curlin >= _nextLine-1) /* can't do last line */ - return 0; - - if (count > 1) - state.echof = 0; - - for (i = 1 ; i <= count ; ++i, lineDownBeg((long)1)) - { - if ((prev_lnum = get_prev(prev_line,curlin)) <= 0) /* get the previous line */ - continue; /* handle 1st line of file! */ - - (void) get_prev(prev_prev_line,prev_lnum); /* and the line before it */ - - if (*prev_line != ' ' && *prev_line != '\t') /* funny line */ - { - lineDownBeg((long)1); - break; /* give up */ - } - - /* count previous tabs/spaces */ - tabs = spaces = 0; - for (ij = 0 ; ij < 38 ; ++ij) - { - if (prev_line[ij] == '\t') - { - spaces = 0; /* skip embedded spaces */ - ++tabs; - } - else if (prev_line[ij] == ' ') - ++spaces; - else - break; /* break on first non tab non blank */ - } - if (tabs == 0 && spaces <= 2) - { - lineDownBeg((long) 1); - break; /* give up on function heads */ - } - - /* now process current line */ - lineBeginning(); /* start at beginning of line */ - - if (curlin >= _nextLine-1) - break; /* done */ - - /* don't fix blank lines */ - - if (GCh(curchr) != ' ' && GCh(curchr) != '\t' ) - { - lineDownBeg((long) 1); - break; /* break on line I don't know about */ - } - - while (GCh(curchr) == ' ' || GCh(curchr) == '\t') - charDelete((long)1,false); /* delete them */ - - if (GCh(curchr) == '\n') - continue; /* skip blank lines */ - - /* determine spacing of current line based on prev line */ - - prev_key = 0; - if (is_key_word(&prev_line[ij],1)) /* a kew word! */ - { - prev_key = 1; /* last line was key */ - if (GCh(curchr) == '{') - { - spaces += gState.braceIndent; - } - else - spaces += 4; - } - else if (prev_line[ij] == '{') - { - spaces += (4-gState.braceIndent); - } - else if (prev_line[ij] == '}') - { - // handle } else { K&R - if (prev_line[ij+1] && has_key(&prev_line[ij+2],"else")) - spaces += 4; - else - spaces -= gState.braceIndent; - } - - if (has_key((char*)curchr, "else")) - { - if (prev_line[ij] != '}') - spaces -= 4; - } - else if (has_key((char *)curchr, "case") || - has_key((char*)curchr, "default:")) - { - if (prev_line[ij] != '{') - spaces -= 4; - } - else if (!prev_key && prev_line[ij] != '{' && - prev_line[ij] != '}' && is_key_word(prev_prev_line,0)) - { - // could handle K&R here... - // check for '{' in prev_prev_line - // this is fairly simple minded - but then the whole - // beautifier is. It will fail if there is a { - // in a string in the control statement. - for (int ib = 0 ; prev_prev_line[ib] ; ++ib) - { - char curChr = prev_prev_line[ib]; // for convenience - if (curChr == '/' && - (prev_prev_line[ib+1] == '/' || prev_prev_line[ib+1] == '*')) - break; - if (curChr == '{' && prev_prev_line[ib+1] != '\'') - { - spaces += 4; // will undo on break; - break; - } - } - - spaces -= 4; - } - - /* don't else next one, works with last else if */ - if (GCh(curchr) == '}') /* } */ - spaces -= (4-gState.braceIndent); - - /* fix tab/space counts */ - if (spaces < 0) - { - if (--tabs < 0) - tabs = 0; - spaces = 8 + spaces; - } - while (spaces >= 8) - { - ++tabs; - spaces -= 8; - } - - for (ik = 0 ; ik < tabs ; ++ik) - charInsert('\t',false); - for (ik = 0 ; ik < spaces ; ++ik) - charInsert(' ',false); - - } /* end of main for loop */ - - state.echof = oldef; - if (oldef && count > 1) - Verify(); - - return 1; - - } - -// =============================>>> vTextEditor::has_key <<<======================= - int vTextEditor::has_key(char *buff_ptr, char *key) - { - while (*key) - { - if (*buff_ptr++ != *key++) - return 0; - } - return 1; /* buff_ptr matches key up to key's EOS */ - - } - -// ==========================>>> vTextEditor::is_key_word <<<====================== - int vTextEditor::is_key_word(char *bf, int case_def) - { - //char *strstr(); - - while (*bf == ' ' || *bf == '\t') /* skip leading white */ - ++bf; - if (strstr(bf,"if(") == bf) - return 1; - if (strstr(bf,"if (") == bf) - return 1; - if (strstr(bf,"for(") == bf) - return 1; - if (strstr(bf,"for (") == bf) - return 1; - if (strstr(bf,"while(") == bf) - return 1; - if (strstr(bf,"while (") == bf) - return 1; - if (strstr(bf,"do") == bf) - return 1; - if (strstr(bf,"catch(") == bf) - return 1; - if (strstr(bf,"catch (") == bf) - return 1; - if (strstr(bf,"else") == bf) - return 1; - if (strstr(bf,"try") == bf) - return 1; - if (strstr(bf,"typedef ") == bf) - return 1; - if (strstr(bf,"struct ") == bf) - return 1; - if (strstr(bf,"switch(") == bf) - return 1; - if (strstr(bf,"switch (") == bf) - return 1; - if (case_def && strstr(bf,"case ") == bf) - return 1; - if (case_def && strstr(bf,"default:") == bf) - return 1; - return 0; - } - -//=============================>>> vTextEditor::get_prev <<<====================== - long vTextEditor::get_prev(char *prev_buff, long start) - { // Get previous non-blank line in text buffer (BEW: 10/1/98) - long pline; - int ix, blank_line; - BUFFPTR bi; - - *prev_buff = 0; /* empty line for sure */ - pline = start; -GP_TOP: - --pline; /* previous line */ - - if (pline <= 1) - return 0; /* there is no previous line */ - - bi = GLine(pline); /* first char of buffer */ - - blank_line = 1; - for (ix = 0 ; ix < MAX_PREV-2 ; ++ix) - { - if (GCh(bi+ix) == '\n') - break; - prev_buff[ix] = GCh(bi+ix); /* copy the char */ - if (prev_buff[ix] != ' ' || prev_buff[ix] != '\t') - blank_line = 0; /* not a blank line */ - } - prev_buff[ix] = 0; /* terminate the string */ - if (blank_line || prev_buff[0] == '#') - goto GP_TOP; /* find previous non-blank line */ - - return pline; - } - - -// ######################################################################## -// -// Misc. methods -// -// ######################################################################## - -// ======================>>> vTextEditor::getSelection <<<================= - int vTextEditor::getSelection(char* sel, int max) - { - // Fetch the highlighted text - - long sl = SelectionLen(); // length of selection - if (sl <= 0 || sl >= max-1) - return 0; - - CopySelection(sel, max, 0); // copy the selection - return 1; - } - -// ======================>>> vTextEditor::EditCut <<<================= - int vTextEditor::EditCut() - { - // Cut text to clipboard - - long sl = SelectionLen(); // length of selection - if (sl < 0) - return 0; - char* cut = new char[sl+1]; // space for a copy - - CopySelection(cut, sl+1, 0); // copy the selection - theApp->ClipboardSetText(cut); // set the clipboard - - delete [] cut; // free the space - - RemoveMarkRange(); // finally, cut it - return 1; - } - -// ======================>>> vTextEditor::EditCopy <<<================= - int vTextEditor::EditCopy() - { - // Cut text to clipboard - - long sl = SelectionLen(); // length of selection - if (sl < 0) - return 0; - char* cut = new char[sl+1]; // space for a copy - - CopySelection(cut, sl+1, 0); // copy the selection - theApp->ClipboardSetText(cut); // set the clipboard - - delete [] cut; // free the space - - return 1; - } - -// ======================>>> vTextEditor::EditPaste <<<================= - int vTextEditor::EditPaste() - { - char* paste = theApp->ClipboardGetText(); // get the text - if (!paste || !*paste) - return 0; - long pasteLen = strlen(paste); - long orig_line = curlin; - - int old_echo = state.echof; - - if (pasteLen > 80) - state.echof = 0; - - while (*paste) // dumb paste - char at a time insert - { - if (*paste != '\r') // ignore \r on both X and Windows - { - if (*paste == '\n') - charInsert((int)'\r',false); // this works for both X and Windows - else - charInsert((int)*paste,false); - } - ++paste; - } - if (state.echof == 0) - { - state.echof = old_echo; - // Verify(); - } - - if (curlin != orig_line) /* refresh screen if moved */ - Verify(); - else - tvhdln(); /* just fix the cursor */ - return 1; - } - -// ======================>>> vTextEditor::SelectionLen <<<================= - int vTextEditor::SelectionLen() - { - long lines; - int len; - MARK_RANGE r_mark; - - if (mark.beg_lin != 0) // we have some text to count - { - r_mark = mark; // use a copy - - // count the range - - lines = r_mark.end_lin - r_mark.beg_lin + 1; - - if (lines == 1) /* all on current line */ - { - if (r_mark.end_chr) /* find type range */ - { - len = r_mark.end_chr - r_mark.beg_chr; - } - else - { - for (len = 0 ; GCh(r_mark.beg_chr + len) != 0 ; ++len) - ; - } - return len; - } - else // more than one line - { - // Count 1st line - for (len = 0 ; GCh(r_mark.beg_chr + len) != 0 ; ++len) - ; - // Count middle lines - for (long mid = r_mark.beg_lin + 1 ; - mid < r_mark.end_lin ; ++mid) - { - int linlen; - for (linlen = 0 ; GCh(GLine(mid) + linlen ) != 0 ; - ++linlen) - ; // count len of this line - len += linlen; // add to total - } - // Count last line - count up to r_mark.end_chr, or - // to the end of the line (some places we call end_chr - // a big number that really isn't the end of the line - int lastlen; - for (lastlen = 0 ; - GLine(r_mark.end_lin) + lastlen < r_mark.end_chr - && GCh(GLine(r_mark.end_lin) + lastlen) != 0 ; - ++lastlen) - ; - len += lastlen; - return len; - } - } - return 0; - } - -// ======================>>> vTextEditor::CopySelection <<<================= - int vTextEditor::CopySelection(char* buff, int max, int unmark) - { - long cnt; - int ix; - char *to; - MARK_RANGE r_mark; - - to = buff; - - *to = 0; // always a valid string, even NULL - if (mark.beg_lin != 0) /* we have some text to kill */ - { - if (max < SelectionLen() + 1) // make sure fits - return 0; - - r_mark = mark; /* make copy to avoid recursion */ - - /* now safe to kill off range */ - if (unmark) - { - mark.beg_lin = mark.end_lin = - mark.beg_col = mark.end_col = 0; - mark.beg_chr = mark.end_chr = 0; - theApp->SetValueAll(M_Cut, 0, Sensitive); // zap menu - theApp->SetValueAll(M_Copy, 0, Sensitive); - } - - - /* clean up screen */ - if (curlin != r_mark.beg_lin || - r_mark.end_lin - r_mark.beg_lin > 0) - { - Verify(); - } - else - { - tvxy(1,tvdlin); /* fix it up */ - type_lines(curlin, 1); - tvhdln(); - } - - /* copy the range */ - - cnt = r_mark.end_lin - r_mark.beg_lin + 1; - - if (cnt == 1) /* all on current line */ - { - if (r_mark.end_chr) /* find type range */ - { - cnt = r_mark.end_chr - r_mark.beg_chr; - } - else - { - for (cnt = 0 ; GCh(r_mark.beg_chr + cnt) != 0 && cnt < (max - 1) ; - ++cnt) - ; - } - for (ix = 0 ; ix < cnt && ix < (max - 1) ; ++ix) /* copy directly */ - { - *(to+ix) = GCh(r_mark.beg_chr+ix); - if (*(to+ix) == 0) - break; - } - *(to+ix) = 0; - } - else /* more than one line */ - { - // Copy 1st line - for (long len1 = 0 ; GCh(r_mark.beg_chr + len1) != 0 ; ++len1) - *to++ = GCh(r_mark.beg_chr + len1); - // Copy middle lines - for (long mid = r_mark.beg_lin + 1 ; - mid < r_mark.end_lin ; ++mid) - { - for (int linlen = 0 ; GCh(GLine(mid) + linlen) != 0 ; - ++linlen) - *to++ = GCh(GLine(mid) + linlen); - } - // Count last line - count up to r_mark.end_chr, or - // to the end of the line (some places we call end_chr - // a big number that really isn't the end of the line - for (int lastlen = 0 ; - GLine(r_mark.end_lin) + lastlen < r_mark.end_chr - && GCh(GLine(r_mark.end_lin) + lastlen) != 0 ; - ++lastlen) - *to++ = GCh(GLine(r_mark.end_lin) + lastlen); - *to++ = 0; - } - return 1; - } - return 0; - } - -// ======================>>> vTextEditor::ClearMarkRange <<<================ - void vTextEditor::ClearMarkRange(void) - { - - checkIfScrolled(); // can check for scroll here - - /* clear the range variables */ - if (mark.beg_lin != 0) - { - mark.beg_lin = mark.end_lin = - mark.beg_col = mark.end_col = 0; - mark.beg_chr = mark.end_chr = 0; - Verify(); - } - else /* just be sure we stay in phase */ - { - mark.beg_lin = mark.end_lin = - mark.beg_col = mark.end_col = 0; - mark.beg_chr = mark.end_chr = 0; - } - theApp->SetValueAll(M_Cut, 0, Sensitive); - theApp->SetValueAll(M_Copy, 0, Sensitive); - } - -// =====================>>> vTextEditor::insertToRange <<<================ - int vTextEditor::insertToRange(char* atFront, char* atEnd) - { - // This will insert the text supplied around the marked - // range, clearing the range, and leaving the cursor - // at the end of the new text - return 1; - } - -// =====================>>> vTextEditor::RemoveMarkRange <<<================ - int vTextEditor::RemoveMarkRange(bool doUndo) - { - /* delete the text in the marked range - return - 0 : no text deleted - 1 : text deleted - */ - - static int inHere = 0; // don't let it be recursive - int retval = 0; - - long cnt, orig_line; - MARK_RANGE r_mark; - BUFFPTR orig_chr; - - if (inHere) - return 0; - if (mark.beg_lin == 0) /* we have some text to kill */ - return 0; - - inHere = 1; - - r_mark = mark; /* make copy to avoid recursion */ - - /* now safe to kill off range */ - mark.beg_lin = mark.end_lin = - mark.beg_col = mark.end_col = 0; - mark.beg_chr = mark.end_chr = 0; - - /* kill off range */ - orig_line = curlin; - orig_chr = curchr; - curlin = r_mark.beg_lin; - curchr = r_mark.beg_chr; - cnt = r_mark.end_lin - r_mark.beg_lin + 1; - - - if (!state.readOnly && cnt == 1) /* all on current line */ - { - if (r_mark.end_chr) /* find type range */ - { - long dcnt = r_mark.end_chr - r_mark.beg_chr; - charDelete(dcnt,doUndo); - } - else /* ^M type range */ - { - if (curchr == GLine(curlin)) - { - lineDelete(cnt,doUndo); /* kill whole current line */ - } - else - { - lineDeleteToEnd(doUndo); // past line beg, just kill rest - } - } - retval = 1; - if (curlin != orig_line) /* refresh screen if moved */ - Verify(); - else - tvhdln(); /* just fix the cursor */ - - } - else if (!state.readOnly) // more than one line - { - int oldef = state.echof; - state.echof = 0; // turn off echo - - if (doUndo) - { - bool partialLine; - partialLine = curchr != GLine(curlin); // partial first line - if (!IsEndLine(GCh(r_mark.end_chr))) - partialLine = true; - if (!SaveKillLine(cnt,partialLine)) - { - } - } - - lineDeleteToEnd(false); // past line beg, just kill rest - lineDownBeg((long)1,0); /* and the end of line */ - --cnt; /* one less */ - lineDelete(cnt - 1, false); // kill off all but last line - if (!r_mark.end_chr) /* kill whole last line */ - { - lineDelete((long)1,false); - } - else - { - curchr = r_mark.end_chr; /* get last char */ - if (IsEndLine(GCh(curchr))) - lineDelete((long)1,false); - else - lineDeleteFront(false); // kill last line - } - charDelete((long)-1,false); // and the lead cr - retval = 1; - state.echof = oldef; - if (doUndo) - undoOn("Undo Delete"); - Verify(); - } - - ChangeLoc(curlin,col_pos(curchr,0)); - - inHere = 0; - return retval; - } - -// ===========================>>> BalMatch <<<============================== - int vTextEditor::BalMatch(long val) - { - /* Find balance of )]} or [{( */ - - int orig_line, dir, nest, old_ef, echo_off; - long limit, ix; - BUFFPTR orig_chr; - char start_c, match; - - if (lastLineBF() < 1) - return 0; - ClearMarkRange(); /* no range now */ - wasColCmd = 0; - - old_ef = state.echof; - echo_off = 0; /* haven't turned off echo */ - - limit = ((long) val) * 4000L; /* limit for search */ - - orig_chr = curchr; - orig_line = curlin; - start_c = GCh(curchr); /* original char */ - switch (start_c) - { - case '(': - match = ')'; - dir = 1; - break; - - case '{': - match = '}'; - dir = 1; - break; - - case '[': - match = ']'; - dir = 1; - break; - - case ')': - match = '('; - dir = -1; - break; - - case '}': - match = '{'; - dir = -1; - break; - - case ']': - match = '['; - dir = -1; - break; - - default: - state.echof = old_ef; - return 0; /* no op if not a paren thing */ - - } - - for (ix = 1, nest = 0 ; ix < limit ; ++ix) - { - charRight((long)dir,1); /* go right */ - if (!echo_off && (curlin != orig_line)) - { - state.echof = 0; - echo_off = 1; /* disable echoing */ - StatusMessage("Scanning for matching paren"); - } - if (GCh(curchr) == start_c) - ++nest; /* bump nest */ - else if (GCh(curchr) == match) - { - if (nest) - --nest; /* undo nest */ - else - { - state.echof = old_ef; - if (state.echof) /* update if it was on */ - Verify(); - return 1; /* found the matching thing */ - } - } - } - - /* fall through ==> died */ - curchr = orig_chr; - curlin = orig_line; - state.echof = old_ef; - newscr(); - ChangeLoc(curlin,col_pos(curchr,0)); - return 0; - } - -// ######################################################################### -// -// Private helper methods -// -// ######################################################################### - -//========================>>> vTextEditor::reallocLines <<<====================== - int vTextEditor::reallocLines() - { - BUFFPTR* oldLines; - - oldLines = _lines; // remember old lines - _lines = new char*[_maxLines + lineListSize]; - if (!_lines) - { - _lines = oldLines; // failed to get more lines - return 0; - } - - long lx; - for (lx = 0 ; lx < _maxLines ; ++lx) // copy old lines - _lines[lx] = oldLines[lx]; - - _maxLines = _maxLines + lineListSize - 1; // safety factor - - for (; lx < _maxLines ; ++lx) // null new lines - _lines[lx] = 0; - - delete [] oldLines; // free the old lines - return 1; - } - -//========================>>> vTextEditor::col_pos <<<====================== - int vTextEditor::col_pos(BUFFPTR chr_pos, int do_shift) - { /* col_pos - find the x position of the character chr_pos on current line - handles spacing for tabs, control characters etc */ - - BUFFPTR i; - int pos; - - pos = 1; - for (i = GLine(curlin) + 1 ; i <= chr_pos ; ++i) - { - if (GCh(i-1) < ' ' && GCh(i-1) > 0) /* cur pos depends on last chr */ - { - if (GCh(i-1) == '\t' && gState.tabspc > 0) /* handle tabs */ - { - for (++pos ; ((pos-1) % gState.tabspc) != 0; ++pos) - ; - } - else /* control characters (echoed as ^X) */ - pos += 2; /* 2 spaces for other control character */ - } - else /* normal character */ - ++pos; - } - - while (do_shift) - { - if (pos < leftmg) /* won't fit on screen */ - { - leftmg -= 16; /* shift left */ - } - else if (pos >= GetCols() + leftmg) - { - leftmg += 16; - } - else - break; - } - - if (do_shift) - return pos - leftmg + 1; - else - return pos; - } - -// ===========================>>> vTextEditor::mint <<<===================== - int vTextEditor::mint(int v1, int v2) - { - return (v1 > v2 ? v2 : v1); - } - -// ============================>>> vTextEditor::maxt <<<==================== - int vTextEditor::maxt(int v1, int v2) - { - return (v1 > v2 ? v1 : v2); - } - -// ===========================>>> vTextEditor::minl <<<===================== - long vTextEditor::minl(long v1,long v2) - { - return (v1 > v2 ? v2 : v1); - } - -// ===========================>>> vTextEditor::maxl <<<===================== - long vTextEditor::maxl(long v1, long v2) - { - return (v1 > v2 ? v1 : v2); - } - -// ===========================>>> vTextEditor::clower <<<=================== - int vTextEditor::clower(int ch) - { - return ((ch >='A' && ch<='Z') ? ch + ' ' : ch); - } - -// ==========================>>> vTextEditor::cupper <<<=================== - int vTextEditor::cupper(int ch) - { - return ((ch >= 'a' && ch <= 'z') ? ch - ' ' : ch); - } - -// ===================>>> vTextEditor::line_can_fit <<<===================== - int vTextEditor::line_can_fit(long l) - { - /* if line can't fit onto screen width, we need to update deleted - characters a bit differently. - */ - BUFFPTR to; - int len; - - for (to = GLine(l) + 1, len = 0 ; !IsEndLine(GCh(to)) ; ++to) - { - if (GCh(to) < ' ') - return 0; /* ctrl chars mess it up, so false */ - ++len; - } - return (len < GetCols()); - } - -// =======================>>> vTextEditor::FindDispLine <<<================= - void vTextEditor::FindDispLine(long& ibeg, int& cnt) - { /* FindDispLine - find the display line - known: current line, calculate where it would go on the screen */ - - if (curlin <= dsplin) - { /* it is in first part of the display */ - ibeg = 1; - cnt = (int) minl((long)GetRows(),(long)(lastLine)); - tvdlin = (int)curlin; /* update the display line */ - } - else if (lastLine-curlin < GetRows()-dsplin) - { /* at bottom of display */ - ibeg = maxl((long)1,(long)(lastLine - GetRows() + 1)); - cnt = mint(GetRows(),(int) lastLine); - tvdlin = minl(curlin,(long)(GetRows()-(lastLine-curlin+1)+1)); - } - else /* normal case: in middle */ - { - ibeg = maxl((long) 1,(long)(curlin-dsplin+1)); - cnt = minl((long)GetRows(),(long)(lastLine-(ibeg)+1)); - tvdlin = dsplin; - } - } - -// ======================>>> vTextEditor::findX <<<======================== - int vTextEditor::findX(void) - { /* findX - find the x position of the current character - handles spacing for tabs, control characters etc */ - - BUFFPTR i; - int pos, need_newscr; - - if (curlin < 1 || GetCols() <= 1 || lastLineBF() < 1) - return 1; - need_newscr = 0; - pos = 1; - - for (i = GLine(curlin)+1 ; i <= curchr ; ++i) - { - if (GCh(i-1) < ' ' && GCh(i-1) > 0) /* cur pos depends on last chr */ - { - if (GCh(i-1) == '\t' && gState.tabspc > 0) /* handle tabs */ - { - for (++pos ; ((pos-1) % gState.tabspc) != 0; ++pos) - ; - } - else /* control characters (echoed as ^X) */ - pos += 2; /* 2 spaces for other control character */ - } - else /* normal character */ - ++pos; - } - - for (;;) - { - if (pos < leftmg) /* won't fit on screen */ - { - leftmg -= 16; /* shift left */ - need_newscr = 1; - if (GetCols() <= 16) - break; - } - else if (pos >= GetCols()+leftmg) - { - leftmg += 16; - need_newscr = 1; - if (GetCols() <= 16) - break; - } - else - break; - } - - if (need_newscr) - { - Verify(); - } - - return (pos-leftmg+1); - } - -// ===================>>> vTextEditor::getCurLineFront <<<======================= - void vTextEditor::getCurLineFront(char* buff, long start) - { - int ix; - BUFFPTR bi; - - buff[0] = 0; /* empty line for sure */ - - if (lastLineBF() < 1) - return; - - bi = GLine(start); /* first char of buffer */ - - for (ix = 0 ; ix < 18 ; ++ix) /* 18 chars max */ - { - if (IsEndLine(GCh(bi+ix))) - break; - buff[ix] = tolower(GCh(bi+ix)); /* copy the char */ - } - buff[ix] = 0; /* terminate the string */ - } - -// ====================>>> vTextEditor::lastBX <<<========================== - BUFFPTR vTextEditor::lastBX(long line) - { - /* return the buff index of the last char of the line */ - BUFFPTR bx; - - for (bx = GLine(line) ; !IsEndLine(GCh(bx)) ; ++bx) - ; /* find last char in line */ - return bx; - } - -// ====================>>> vTextEditor::Fill1 <<<========================== - int vTextEditor::Fill1(int dir, int val) - { /* change character dir to val */ - - int oldwrp; - - if (state.readOnly) - return 0; - oldwrp = gState.wraplm; - gState.wraplm = 0; - if (! charDelete((long)dir,false)) - goto l900; - if (! charInsert(val,false)) - goto l900; - gState.wraplm = oldwrp; - return 1; -l900: - gState.wraplm = oldwrp; - return 0; - } - -// ======================>>> vTextEditor::newscr <<<======================== - void vTextEditor::newscr(void) - { /* newscr - retype entire screen, updating cursor position if necessary */ - - long ibeg; - int cnt; - - if (!state.echof) - return; - - if (curlin < 1) - { - tvclr(); - tvxy(1,1); - return; - } - if (lastLine < GetRows()) /* two kinds of screen rewrite */ - tvclr(); /* clear the screen and home */ - tvxy(1,1); - - dsplin = tvdlin = ddline; /* home to middle */ - FindDispLine(ibeg, cnt); /* calculate where it will go */ - type_lines(ibeg,cnt); /* type it out */ - tvhdln(); /* home to display line */ - } - -// =====================>>> vTextEditor::range <<<========================= - void vTextEditor::range(long cnt, long *lbeg, long *lend) - { /* determine a legal line number range given cnt */ - - if (cnt <= 0) - { - if ((*lbeg = curlin + cnt) < 0) - *lbeg = 1; - *lend = curlin; - if (cnt < 0) - *lend = (*lend)-1; - } - else - { - *lbeg = curlin; - if ((*lend = curlin+cnt-1) > lastLine) - *lend = lastLine; - } - } - -// ====================>>> vTextEditor::setScrollBar <<<==================== - void vTextEditor::setScrollBar() - { - long shown; - long top; - long last = lastLine; - - if (!state.echof) - return; - - if (last < 1) - last = 1; - - if (lastLine <= (long)GetRows()) - shown = 100L; - else - shown = ((long) GetRows() * 100L) / last; - - if (shown < 1) - shown = 1; - - long cur = (scroll_lin > 0) ? scroll_lin : curlin; // handle scrolling - - if (cur >= last) - top = 100L; - else if (cur == 1) - top = 0; - else - top = (cur * 100L) / last; - - if (top < 0) - top = 0; - - SetVScroll((int) shown, (int) top); - } - -// ====================>>> vTextEditor::checkIfScrolled <<<================= - void vTextEditor::checkIfScrolled() - { - // If we are scrolled, we need to restore screen - - if (!state.echof) - return; - - if (scroll_lin > 0 || setCursor) - { - setCursor = 0; - scroll_lin = -1; - ShowTextCursor(); - Verify(); - } - } - -// ====================>>> vTextEditor::scrollDown <<<====================== - void vTextEditor::scrollDown(long delta) - { /* scroll screen without moving cursor either 1 line or screenful*/ - - long change; - - if (!state.echof) - return; - - if (lastLineBF() < 1 || delta == 0) - { - setScrollBar(); - return; - } - - if (!gState.fixed_scroll && scroll_lin < 0) /* might be on same screen */ - { - // this just adjusts the screen without really scrolling - if (delta == 1 && dsplin > 1) /* scroll down */ - { - if ((curlin+GetRows()-tvdlin) >= lastLine) - return; // no where to go - tvbotb(1); /* make room */ - tvxy(1,GetRows()); /* home to last line */ - dsplin = tvdlin = tvdlin - 1; /* change line */ - type_lines((long)(curlin+GetRows()-tvdlin),1); /* fix up screen */ - tvhdln(); /* home to display line */ - setScrollBar(); - return; - } - else if (delta == -1 && dsplin < GetRows()) - { - if ((curlin-tvdlin) <= 0 ) - return; - tvtopb(1); /* make blank lines at top */ - dsplin = tvdlin = tvdlin + 1; /* change line */ - type_lines((long)(curlin-tvdlin+1),1); /* fill in */ - tvhdln(); /* home to display line */ - setScrollBar(); - return; - } - } - - if (scroll_lin < 0) /* initial setup */ - { - if (curlin <= dsplin) /* on first screen */ - { - scroll_lin = 1; /* assume 1st line */ - } - else if (lastLine - curlin < GetRows() - dsplin) - { /* at bottom of display */ - scroll_lin = maxl((long)1,(long)(lastLine - GetRows() + 1)); - } - else /* normal case: in middle */ - { - scroll_lin = maxl((long)1,(long)(curlin-dsplin+1)); - } - } - - if (delta < 0 && scroll_lin == 1) /* at top already */ - return; - - change = delta; - - if (change < 0) /* have to scroll screen down */ - { - if (change == -1) - { - if (scroll_lin <= 1) - return; - scroll_lin -= 1; - tvtopb(1); /* make blank lines at top */ - type_lines(scroll_lin,1); /* fill in */ - } - else /* a screenful or so */ - { - scroll_lin = maxl((long)1,(long)(scroll_lin + delta)); - newScrollScreen(scroll_lin); - } - } - else if (change > 0) /* have to scroll screen up */ - { - if ((scroll_lin+GetRows()) > lastLine) - return; // no where to go - if (change == 1) - { - scroll_lin += 1; - tvbotb(1); /* make blank lines at top */ - type_lines((long)(scroll_lin+GetRows()-1),1); /* fill in */ - } - else /* a screenful or so */ - { - scroll_lin = minl(lastLine, (long)(scroll_lin + delta)); - newScrollScreen(scroll_lin); - } - } - - // now, if the curlin is on the new scrolled screen, we need to - // repaint it so the cursor and highlight area show - - - if (curlin >= scroll_lin && curlin < (scroll_lin + GetRows())) - { - ShowTextCursor(); - int xf = findX(); - tvxy(xf, curlin - scroll_lin + 1); // reset cursor to current position - // scroll_lin = -1; // BEW: 3/31/99 removed reset to -1 - } - else - HideTextCursor(); - - setScrollBar(); - - } - -// =================>>> vTextEditor::newScrollScreen <<<==================== - void vTextEditor::newScrollScreen(long ibeg) - { /* newScrollScreen - retype entire screen, - updating cursor position if necessary */ - - if (!state.echof) - return; - - tvclr(); /* clear the screen and home */ - type_lines(ibeg,(int)minl(lastLine,(long)GetRows())); /* type it out */ - } - -// ===================>>> vTextEditor::undoOn <<<===================== - void vTextEditor::undoOn(const char* msg) - { - if (!state.echof) - return; - ((vWindow *)_parent)->SetValue(M_UnDo, 1, Sensitive); - if (msg && *msg) - ((vWindow *)_parent)->SetString(M_UnDo, (char*) msg); - } - -// ===================>>> vTextEditor::undoOff <<<===================== - void vTextEditor::undoOff(const char* msg) - { - undoCurlin = -1; // so can't try to undo... - if (!state.echof) - return; - ((vWindow *)_parent)->SetValue(M_UnDo, 0, Sensitive); - if (msg && *msg) - ((vWindow *)_parent)->SetString(M_UnDo, (char*) msg); - } - -// ===================>>> vTextEditor::SaveKillLine <<<===================== - bool vTextEditor::SaveKillLine(long cnt, bool partialLine) - { - // SaveKillLine - save lines that will be killed - // killFirst and killLast are used with charDelete to note - // if we are killing part of a line that needs to be replaced - // in case of an undo. - - char ln[MAX_LINE+2]; - // BUFFPTR from; - - undoOn("Undo Delete"); - - // remember state - undoCurcol = col_pos(curchr,1); - undoCurlin = curlin; - undoPartialLine = partialLine; - - // copy lines to buffer - - int to = 0; // start at beginning of undo buffer - - for (long lx = 0 ; lx < cnt && to < MAX_UNDO ; ++lx) - { - int len = getLine(ln,MAX_LINE,curlin+lx); - if (len < 0) // out of lines? - break; - for (int ix = 0 ; ix < len && to < MAX_UNDO ; ++ix) - { - undoBuff[to++] = ln[ix]; // copy to buffer - } - undoBuff[to++] = '\n'; // add end of line - } - - undoBuff[to] = 0; // terminate the buffer - - if (to >= MAX_UNDO) // oops! - { - // issue warning? - return false; - } - return true; // save succeeded - } - -// =======================>>> vTextEditor::undoEdit <<<======================= - int vTextEditor::undoEdit(void) - { /* unkill the single last line killed */ - - char ln[MAX_LINE+2]; // temp line - long lines = 0; - - if (undoCurlin < 0) - return 0; - long useCurlin = undoCurlin; // keep local copy - - lineGoto(useCurlin); // and go to beginning of undo stuff - - if (undoPartialLine) // kills partial line before restore - lineDelete(1,false); - - for (int from = 0 ; from < MAX_UNDO && undoBuff[from] != 0 ; ++from) - { // scan whole buffer - - for (int to = 0 ; to < MAX_LINE && from < MAX_UNDO ; ++to) - { // copy line at a time - if (undoBuff[from] == '\n' || undoBuff[from] == 0) - { // \n marks end of each line - ln[to] = 0; - insertLine(ln, useCurlin + lines++, false); // insert it - break; - } - else - ln[to] = undoBuff[from++]; - } - } - - lineGoto(useCurlin); // and go to beginning of undo stuff - //@@ goto curchr... - long lim = lineLenBF(curlin); - for (int ic = 0; ic < lim && col_pos(curchr,1) < undoCurcol ; ++ic) - charRight(1, 0); - - if (state.readOnly) - return 0; - - return 1; - } - -// =====================>>> vTextEditor::tvhdln <<<========================= - void vTextEditor::tvhdln(void) - { /* tvhdln - home to display line */ - - int xf; - - if (curlin < 1) - tvxy(1,1); - else - { - if (mark.beg_lin > 0) - { - tvxy(1,tvdlin); - type_lines(curlin, 1); - } - xf = findX(); - tvxy(xf,tvdlin); - } - } - -// ========================>>> vTextEditor::tvtyln <<<====================== - void vTextEditor::tvtyln(long lineNum, BUFFPTR chrptr, int whole_line) - { /* tvtyln - type a line on the screen without cr/lf */ - - xoutcm = tvx; - tvplin(lineNum,chrptr,whole_line,-1,-1); - } - -// =======================>>> vTextEditor::update <<<======================= - void vTextEditor::update(long change) - { /* update - update the screen when line position has changed - will not be used if any alterations have been made */ - - if (change == 0) - { - tvhdln(); - return; - } - setScrollBar(); - if (gState.fixed_scroll) - updateScroll(change); /* cursor stays on fixed line */ - else - updateNoScroll(change); /* cursor roams around screen */ - } - -// ===================>>> vTextEditor::updateScroll <<<===================== - void vTextEditor::updateScroll(long change) - { /* update - update the screen when line position has changed - will not be used if any alterations have been made */ - - long abschg; - - if (!state.echof) - return; - abschg = change; - - if (change < 0) /* have to scroll screen down */ - { - abschg = (-change); - if (tvdlin-abschg < 1) - Verify(); - else if (curlin < tvdlin) /* won't fit exactly */ - { - if (tvdlin >= dsplin && abschg != 1) - { - tvclr(); /* clear the screen */ - type_lines((long)1,GetRows()); /* type out a screen */ - } - tvdlin = curlin; - } - else if (tvdlin - abschg >= dsplin) - tvdlin -= abschg; - else - { - if (tvdlin > dsplin) - { /* moving up from below display line */ - abschg = dsplin-(tvdlin-abschg); - tvdlin=dsplin; /* update */ - } - tvtopb((int)abschg); /* make blank lines at top */ - type_lines((long)(curlin-tvdlin+1),(int)abschg); /* fill in */ - } - } - else if (change > 0) /* have to scroll screen up */ - { - if (tvdlin+change > GetRows() && tvdlin < dsplin || - change >= GetRows()) - Verify(); - else if (tvdlin < dsplin || lastLine <= GetRows()) - if (tvdlin+change > dsplin && lastLine > GetRows()) - Verify(); - else - tvdlin += change; - else if (lastLine - curlin < GetRows() - tvdlin) /* on bottom part */ - { - if (tvdlin<=dsplin && abschg != 1) - { - tvclr(); /* rewrite whole screen */ - type_lines((long)(lastLine - GetRows() + 1), GetRows()); - } - tvdlin = (int) minl((long)GetRows(), (long)(lastLine)) - - (lastLine - curlin + 1) + 1; - } - else - { - tvbotb((int)abschg); /* make room */ - tvxy(1,(int)(GetRows()-abschg+1)); /* home to right line */ - type_lines((long)(curlin+GetRows()-tvdlin-abschg+1),(int)abschg); /* fix up screen */ - if (tvdlin < dsplin) - tvdlin = dsplin; - } - } - tvhdln(); - } - -// ==================>>> vTextEditor::updateNoScroll <<<==================== - void vTextEditor::updateNoScroll(long change) - { /* update - update the screen when line position has changed - will not be used if any alterations have been made */ - - long abschg; - - if (!state.echof) - return; - abschg = change; - - if (change < 0) /* have to scroll screen down */ - { - abschg = (-change); - if (curlin + abschg < tvdlin && curlin < tvdlin) // won't fit exactly - { - dsplin = tvdlin = curlin; - } - else if (tvdlin - abschg >= 1) - { - dsplin = tvdlin -= (int)abschg; - } - else if (abschg == 1) /* simple case */ - { - tvtopb((int)abschg); /* make blank lines at top */ - type_lines((long)(curlin-tvdlin+1),(int)abschg); /* fill in */ - dsplin = tvdlin = 1; - } - else /* scroll to above top line */ - { - dsplin = tvdlin; - Verify(); - } - } - else if (change > 0) /* have to scroll screen up */ - { - if (tvdlin + change <= GetRows()) - { - dsplin = - tvdlin = tvdlin + change; - } - else if (change == 1) - { - tvbotb((int)abschg); /* make room */ - tvxy(1,(int)(GetRows()-abschg+1)); /* home to right line */ - type_lines((long)(curlin+GetRows()-tvdlin-abschg+1),(int)abschg); - /* fix up screen */ - dsplin = - tvdlin = GetRows(); - } - else /* scroll to above top line */ - { - dsplin = tvdlin; - Verify(); - } - } - tvhdln(); - } - -// ######################################################################### -// -// word methods -// -// ######################################################################### - -// =====================>>> vTextEditor::wordRight <<<===================== - int vTextEditor::wordRight(long cnt) - { /* wordRight - move cursor over words */ - - long lim, words, incr, lenmov; - int rv; - - if (lastLineBF() < 1) - return 0; - ClearMarkRange(); /* no range now */ - wasColCmd = 0; - - rv = 1; - lenmov = 0; - if (cnt < 0) - { - incr = (-1); /* change */ - lim = (-cnt); - } - else if (cnt == 0) - { - incr = -1; - lim = 0; - } - else - { - incr = 1; - lim = cnt; - } - - for (words = 1; words <= lim; ++words) - { - if ((IsEndLine(GCh(curchr)) && incr > 0) || - (curchr == GLine(curlin) && incr < 0) ) - { - if (curlin + incr > lastLine || curlin + incr < 1) - { - rv = 0; - break; /* at a buffer limit, so quit */ - } - lineDownBeg((long)incr,0); /* move up or down */ - lenmov += incr; - if (cnt<0) - lineEnd(); - continue; /* move to next word */ - } - - /* ok, first, skip over word characters */ - while (IsWordChar(GCh(curchr))) - { - if (curchr == GLine(curlin) && incr < 0) - goto l100; - else - { - curchr += incr; - lenmov += incr; - } - } - - /* now skip over remaining non word chars */ - while (! IsWordChar(GCh(curchr))) - { - if ((IsEndLine(GCh(curchr)) && incr > 0) || - (curchr == GLine(curlin) && incr < 0) ) - break; - else - { - curchr += incr; - lenmov += incr; - } - } -l100: ; - } - - if (incr < 0) /* move cursor to beginning of word */ - { - while (IsWordChar(GCh(curchr-1))) - { - curchr += incr; - lenmov += incr; - } - } - tvhdln(); - oldlen = lenmov; - ChangeLoc(curlin,col_pos(curchr,0)); - return rv; - } - -// ====================>>> vTextEditor::IsWordChar <<<====================== - int vTextEditor::IsWordChar(int chr) - { /* IsWordChar - determine if a character is a "word" type character */ - - if ((chr>='a' && chr <= 'z') || (chr >= 'A' && chr <= 'Z') || - (chr >= '0' && chr <= '9') || chr == '_' || chr == '\\') - return 1; - else - return 0; - } - -// ######################################################################### -// -// DEFAULT vTextEdCmdInterp -// -// ######################################################################### - -// ==================>>> vTextEdCmdInterp::vTextEdCmdInterp <<<================= - vTextEdCmdInterp::vTextEdCmdInterp(VCONST vTextEditor* textEd, - VCONST vCmdWindow* cw) - { - _textEd = const_cast(textEd); - _myCmdWindow = const_cast(cw); - metaWait = 0; - countWait = 0; // not waiting on meta cmd - metaChar = 'A'-'@'; // ^A is default meta char - cmdCount = 1; - } - -// ==================>>> vTextEdCmdInterp::~vTextEdCmdInterp <<<================ - vTextEdCmdInterp::~vTextEdCmdInterp() - { - } - -// =====================>>> vTextEdCmdInterp::InitCmdInterp <<<==================== - void vTextEdCmdInterp::InitCmdInterp() - { - } - - -// ----------------------------- Default CI -------------------------------- - -// =====================>>> vTextEdCmdInterp::CmdInterpHelp <<<==================== - void vTextEdCmdInterp::CmdInterpHelp() - { - static char* helplist [] = - { - "Standard V Generic Editor", - "Key -- Command Description", - "Esc -- Prefix to enter count n", - " ", - " *** Movement Commands ***", - "nLeft -- Move left [^L]", - "nCtl-Left -- Move left a word", - "nUp -- Move up [^U]", - "n^AUp -- Move up to beg of line", - "nRight -- Move right [^R]", - "nCtl-Right -- Move right a word", - "nDown -- Move down [^D]", - "n^ADown -- Move down to beg of line", - "Home -- Goto beg of line [^A,]", - "Ctrl-Home -- Goto beg of file", - "End -- Goto end of line [^A.]", - "Ctrl-End -- Goto end of file", - "nPgUp -- Move a screenful up", - "nCtrl-PgUp -- Scroll a screenful up", - "nPgDn -- Move a screenful down", - "nCtrl-PgDn -- Scroll a screenful down", - "n^G -- Goto line n", - "n^A^N -- Note (mark) location n (1-25)", - "n^AN -- Goto noted location n", - "^AM -- Center Cursor in screen", - "^Av -- Repaint screen", - " ", - " *** Searching commands ***", - "^A[ -- Balance match", - "^F -- Find pattern", - "Shift-^F -- Find next", - "^Af -- Find/Replace", - " ", - " *** Insertion Commands ***", - "n^AIns -- Insert char with value of n", - "Ins -- Toggle insert/overtype", - "n^AO -- Open a new blank line", - " ", - " *** Kill/change commands ***", - "nBkspace -- Delete previous char", - "^ABkspace -- Delete to line begin [^A']", - "nDel -- Delete next char", - "^ADel -- Delete to line end [^A\"]", - "nShft-Del -- Delete line [^K]", - "nShft-^C -- Fold case", - "^V -- Paste from clipboard", - "^C -- Copy highlight to clipboard", - "^X -- Cut highlight to clipboard", - "^Z -- Undo", - " ", - " *** File Commands ***", - "^N -- Open new file", - "^O -- Open file", - "^S -- Save file", - - 0 - }; - - static CommandObject HelpD[] = - { - {C_Button,M_Cancel,0,"Close",NoList,CA_None,isSens,NoFrame,0,0}, - {C_Label,8000,0,"List of Editor commands",NoList,CA_None,isSens,NoFrame,M_Cancel,0}, - {C_List,8001,0,"Help",(void*)helplist,CA_Size, - isSens, NoFrame,0,M_Cancel,32}, - {C_EndOfList,0,0,0,0,CA_None,0,0,0} - - }; - - // I'd have liked a modeless dialog, but then I'd have to track - // and delete the object. This way it gets dynamically created - // each time. - - - ItemVal temp; - - vModalDialog Help(te()->GetPaneParent(),"Editor Help"); - Help.AddDialogCmds(HelpD); - - (void)Help.ShowModalDialog("Generic Editor Help",temp); - - } - -// =====================>>> vTextEdCmdInterp::ProcessKey <<<==================== - int vTextEdCmdInterp::ProcessKey(vKey key, unsigned int shift) - { -// Commands supported by default keyboard mapping: -// -// Most commands can be preceeded by a count, which is entered -// with Esc followed by a value followed by the command. Negative -// counts can be used for most commands as well. An n in front -// of a command indicates it can use a count. -// -// Some commands have synonyms compatible with See and -// touch typing shown in []'s (e.g., ^A, for Home). -// -// Commands that change text interact with highlighted text -// by deleting it, but without copying it to the clipboard. -// ^X and ^C interact with the clipboard. -// -// - - if (vk_IsModifier(key)) // ignore modifiers - return -1; - - int retval = 1; - - if (countWait != 0) - { - if (key == '-') - { - countWait = -1; - return 1; - } - else if (key >= '0' && key <= '9') // it is a count - { - cmdCount = (cmdCount * 10) + (key - '0'); - return 1; - } - else - { - cmdCount *= countWait; // negative? - countWait = 0; // done building count - } - } - - if (metaWait) // Meta command - { - metaWait = 0; - switch (key) - { - case vk_KP_Insert: - case vk_Insert: - { - retval = te()->charInsert(cmdCount); - break; - } - - case '\'': - case vk_BackSpace: - { - retval = te()->lineDeleteFront(); - break; - } - - case '"': - case vk_Delete: - case vk_KP_Delete: - { - retval = te()->lineDeleteToEnd(); - break; - } - - case ',': // line beginning - { - te()->lineBeginning(); - break; - } - - case '.': // line end - { - te()->lineEnd(); - break; - } - - case '[': // ^A[ - bal match - { - retval = te()->BalMatch(cmdCount); - break; - } - - case 'F': - case 'f': - { - te()->EditCommand(edReplace,cmdCount); - break; - } - - case 'M': - case 'm': - { - te()->CenterScreen(); - break; - } - - - case 'N'-'@': // ^N: note location - { - retval = te()->EditCommand(edNoteLocation, cmdCount); - break; - } - - case 'N': // go to noted location - case 'n': - { - retval = te()->EditCommand(edNoteGoto,cmdCount); - break; - } - - case 'O': // O: Open line - { - retval = te()->lineOpen(cmdCount); - break; - } - - case 'v': - case 'V': - case 'V'-'@': - { - te()->Verify(); - break; - } - - case 'U'-'@': - case vk_Up: - case vk_KP_Up: - { - retval = te()->lineDownBeg(-cmdCount); - break; - } - - case 'D'-'@': - case vk_KP_Down: - case vk_Down: - { - retval = te()->lineDownBeg(cmdCount); - break; - } - - default: - { - retval = -1; - break; - } - } - cmdCount = 1; - return retval; - } - else if (key == (vKey) metaChar) - { - metaWait = 1; - return 1; - } - - switch (key) - { - case 'C'-'@': // ^C : Copy ; Shift-^C: fold case - { - if (shift & VKM_Shift) // Shift-^F - { - retval = te()->charFoldCase(cmdCount); - } - else - te()->EditCopy(); - break; - } - - case 'F'-'@': // ^F: find, Shift-^F: find next - { - if (shift & VKM_Shift) // Shift-^F - { - retval = te()->EditCommand(edFindNext, cmdCount); - } - else - { - retval = te()->EditCommand(edFind, cmdCount); - } - break; - } - - case 'G'-'@': // ^G: Goto line - { - retval = te()->lineGoto(cmdCount); - break; - } - - case 'K'-'@': // ^K: Kill line - { - te()->lineDelete(cmdCount); - break; - } - - - case 'N'-'@': // ^N - New - { - vWindow* wp = te()->GetPaneParent(); - wp->WindowCommand(M_New,1,C_Button); - break; - } - - case 'O'-'@': // ^O- Open - { - vWindow* wp = te()->GetPaneParent(); - wp->WindowCommand(M_Open,1,C_Button); - break; - } - - case 'S'-'@': // ^S - Save - { - vWindow* wp = te()->GetPaneParent(); - wp->WindowCommand(M_Save,1,C_Button); - break; - } - - case 'V'-'@': // ^V: Paste - { - te()->EditPaste(); - break; - } - - case 'X'-'@': // ^X : Cut - { - te()->EditCut(); - break; - } - - case 'Z'-'@': // ^Z : Undo - { - te()->undoEdit(); - break; - } - - case 'L'-'@': - case vk_Left: - case vk_KP_Left: - { - if (shift & VKM_Ctrl || shift & VKM_Shift) - retval = te()->wordRight(-cmdCount); - else - retval = te()->charRight(-cmdCount,1); - break; - } - - case 'U'-'@': - case vk_Up: - case vk_KP_Up: - { - retval = te()->lineDown(-cmdCount); - break; - } - - case 'R'-'@': - case vk_Right: - case vk_KP_Right: - { - if (shift & VKM_Ctrl) - retval = te()->wordRight(cmdCount); - else - retval = te()->charRight(cmdCount,1); - break; - } - - case 'D'-'@': - case vk_KP_Down: - case vk_Down: - { - retval = te()->lineDown(cmdCount); - break; - } - - case vk_BackSpace: - { - retval = te()->charDelete(-cmdCount); - break; - } - - case vk_Tab: - { - retval = te()->defaultKeyIn('\t',shift); - break; - } - - case vk_Linefeed: - { - break; - } - - case vk_Return: - case vk_KP_Enter: - { - retval = te()->defaultKeyIn('\n',shift); - break; - } - - case vk_Escape: - { - countWait = 1; - cmdCount = 0; - return 1; - } - - case vk_Delete: - case vk_KP_Delete: - { - if (shift & VKM_Shift || shift & VKM_Ctrl) - te()->lineDelete(cmdCount); - else - retval = te()->charDelete(cmdCount); - break; - } - - case vk_Home: - case vk_KP_Home: - { - if (shift & VKM_Shift || shift & VKM_Ctrl) - retval = te()->lineGoto(1); - else - te()->lineBeginning(); - break; - } - - case vk_Page_Up: - case vk_KP_Page_Up: - { - if (shift & VKM_Ctrl) - te()->scrollDown(-cmdCount * te()->GetRows()); - else - retval = te()->lineDown((long)(-cmdCount * te()->GetRows())); - break; - } - - case vk_Page_Down: - case vk_KP_Page_Down: - { - if (shift & VKM_Ctrl) - te()->scrollDown(cmdCount * te()->GetRows()); - else - retval = te()->lineDown( - (long) te()->minl((cmdCount * te()->GetRows()), - (long)(te()->GetLines() - te()->GetCurLine() + 1))); - break; - } - - case vk_End: - case vk_KP_End: - { - if (shift & VKM_Shift || shift & VKM_Ctrl) - te()->bufferBottom(); - else - te()->lineEnd(); - break; - } - - case vk_KP_Insert: - case vk_Insert: - { - te()->SetInsMode(!(te()->GetEdState().ins_mode)); - te()->ChangeInsMode(te()->GetEdState().ins_mode); - break; - } - - default: - { - retval = te()->defaultKeyIn(key,shift); - break; - } - } - cmdCount = 1; - return retval; - } - -//*********************************************************************** - DialogCmd vTEConfirm::ConfirmCmds[] = - { - {C_Frame,30,0,"",NoList,CA_NoSpace|CA_NoBorder,isSens,NoFrame,0,0}, - {C_Label, 31, 0,"Replace?",NoList,CA_None,isSens,30, 0, 0}, - {C_Button, YesRepl, 0, "Yes", NoList, CA_DefaultButton, isSens, 30, 31, 0, 0, "Replace this instance"}, - {C_Button, YesReplNext, 0, "Yes/Next", NoList, CA_None, isSens, 30, YesRepl, 0, 0, "Replace this instance, go on to next"}, - {C_Button, NoRepl,0," No",NoList,CA_None,isSens,30,31,YesRepl,0,"Don't replace"}, - {C_Button, NoReplNext,0," No/Next",NoList,CA_None,isSens,30,NoRepl,YesRepl,0,"Don't replace, go on to next"}, - - {C_Button, QuitR, 0,"Stop",NoList,CA_None,isSens,30,31,NoRepl,0,"Stop Replace"}, - {C_Button, RepAll,0,"Yes/All",NoList,CA_None,isSens,30,QuitR,NoRepl,0,"Replace All"}, - - - {C_EndOfList,0,0,0,0,CA_None,0,0,0} - }; - -// =====================>>> vTEConfirm::Confirm <<<==================== - int vTEConfirm::ConfirmRep() - { - int id, val; - if (!added) - { - AddDialogCmds(ConfirmCmds); - added = 1; - } - id = ShowModalDialog("Replace?",val); - return id; - } - -//====================>>> vTEConfirm::DialogCommand <<<======================= - void vTEConfirm::DialogCommand(ItemVal id, ItemVal val, CmdType ctype) - { - vModalDialog::DialogCommand(id,val,ctype); - CloseDialog(); - } - - -//================================================================== -// I wrote the original version of the See editor, called TVX, in -// 1980 in a language called Ratfor, a preprocessor that gave -// Fortran the syntax of C. At that time, much of the TVX command -// structure was based on a Tenex editor called TV, which in turn -// had a command syntax similar to an editor called TECO. The Ratfor -// version of TVX actually worked quite will on a TRS-80 with 48K -// (that's right, 48K) of RAM. I've been using some decendent of -// TVX ever since. My fingers know the commands too well to -// change much. -// -// TVX was character based, and ported to many platforms, -// including CP/M, RT-11, RSX-11, VMS, and of course Unix. Much -// of the organization of the edit updates are designed to work -// over serial lines on a text terminal. This was accomplished -// using either a custom terminal driver, or a package such as -// TERMCAP on Unix. In fact, one could use the full screen editor -// quite well over even 1200 Baud serial lines (visual editors -// such as Vi really failed at much less than 9600 Baud). -// -// TVX was translated (semi-automatically) from Ratfor to C. Most -// recently (about 1995) I converted it to C++, and finally to this -// C++ class for inclusion in the VGUI package. Somewhere along -// the way, I changed the name to See, which stood for Simple -// Enough Editor. -// -// Certainly, if I were designing an editor from scratch in C++, -// it would be quite different in structure than this editor. -// However, I always found it easier to port rather than rewrite. -// Many of the specialized editor commands I developed for See -// are still found in this code. A good emulation of many editor -// command sets can be implemented with different command -// parsers. -// -// What this goes to show is that old code never dies, it just -// mutates. This code originated almost 20 years ago now. Many of -// the 6 character variable names owe their origin to Fortran -// variable name restrictions. Much of the seemingly complicated -// screen update stuff owes its origin to the restrictions of -// working with different terminals over slow baud rates. As -// time goes by, even this code will probably mutate. -//================================================================== diff --git a/v/srcwin/vtextinc.cpp b/v/srcwin/vtextinc.cpp deleted file mode 100644 index f8d90ea..0000000 --- a/v/srcwin/vtextinc.cpp +++ /dev/null @@ -1,146 +0,0 @@ -//=============================================================== -// vtextinc.xxx - TextIn Cmd - Windows -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include -#include // our definitions -#include // a command parent - - -#define TextInFont SysVariableFont // The font to use - -//=====================>>> vTextInCmd::vTextInCmd <<<======================= - vTextInCmd::vTextInCmd(vCmdParent* dp, CommandObject* co) : - vCmd(dp, co) - { - initialize(); - } - -//=====================>>> vTextInCmd::~vTextInCmd <<<======================= - vTextInCmd::~vTextInCmd() - { - - SysDebug(Destructor,"vTextInCmd::~vTextInCmd() destructor\n") - - } - -//=====================>>> vTextInCmd::initialize <<<======================= - void vTextInCmd::initialize(void) - { - // build a TextIn command for use in a parent window - - SysDebug(Constructor,"vTextInCmd::vTextInCmd() constructor\n") - - _msg[0] = 0; // no string yet - - CopyToLocal(); // Make local copies of CmdObject - - int defLen = strlen(_title); // length of supplied string - - if (defLen < 130) strcpy(_msg,_title); - - int defWidth = (dlgCmd->attrs & CA_Large) ? 35 : 20; - - if (dlgCmd->attrs & CA_Small) // allow small, too. - defWidth = 10; - - if (dlgCmd->size > 0) // V:1.13 - defWidth = dlgCmd->size; - - if (defLen > defWidth) // Some work space - defWidth = defLen + 6; - - long style = ES_LEFT | ES_AUTOHSCROLL | WS_TABSTOP; // V 1.18 BEW - - if (dlgCmd->attrs & CA_Password) - style |= ES_PASSWORD; - - if (!(dlgCmd->attrs & CA_NoBorder)) - style |= WS_BORDER; - - if (!(dlgCmd->attrs & CA_Hidden)) // Check for Hidden - style |= WS_VISIBLE; - - _w = defWidth * 4 + 6; - - _h = 14; // default height - - - _parentWin->SetPosition(_x, _y, _w, _h, dlgCmd->cFrame, dlgCmd->cRightOf, - dlgCmd->cBelow); - - _CtrlOffset = _parentWin->AddDlgControl(_x, _y , _w, _h, _cmdId, - style, "EDIT", _title, sizeof(vTextInCmd*), (LPBYTE)this); - } - -//=====================>>> vTextInCmd::GetTextIn <<<======================= - int vTextInCmd::GetTextIn(ItemVal /*id*/, char* str, int maxlen) VCONST - { - // recover the data from a TextInCmd - return text + length - int ix; - for (ix = 0 ; _msg[ix] != 0 && ix < maxlen-1 ; ++ix) - str[ix] = _msg[ix]; - str[ix] = 0; - return strlen(str); - } - -//================>>> vTextInCmd::SetCmdVal <<<============================ - void vTextInCmd::SetCmdVal(ItemVal val, ItemSetType st) - { - - SysDebug1(Misc,"vTextInCmd::SetCmdVal(val:%d)\n",val) - HWND myHwnd = GetMyHwnd(_cmdId); - if (st == Sensitive) - { - _Sensitive = val; // set - ::EnableWindow(myHwnd, val); - } - else if (st == Hidden) // hide or unhide - { - if (val) - { - ::ShowWindow(myHwnd,SW_HIDE); - } - else - { - ::ShowWindow(myHwnd,SW_SHOW); - } - } - - } - -//================>>> vTextInCmd::SetCmdStr <<<============================ - void vTextInCmd::SetCmdStr(VCONST char* str) - { - - SysDebug1(Misc,"vTextInCmd::SetCmdStr(str:%s)\n",str) - ::SetDlgItemText(_parentWin->getParent(),_cmdId, str); - - } - -//====================>>> vRadioButtonCmd::CmdCallback <<<======================= - void vTextInCmd::CmdCallback(int /*id*/, WORD codeNotify) - { - // Edit strings are noops except for EN_CHANGE - if (codeNotify == EN_CHANGE) - { - HWND myHwnd = GetMyHwnd(_cmdId); - ::SendMessage(myHwnd, WM_GETTEXT, 130, (LPARAM)((LPSTR)_msg)); - if ((dlgCmd->attrs & CA_TextInNotify)) // Notify on each selection? - _parentWin->ProcessCmd(_cmdId, M_TextInChange, dlgCmd->cmdType); - } - else if (codeNotify == EN_KILLFOCUS) - { - if ((dlgCmd->attrs & CA_TextInNotify)) // Notify on each selection? - _parentWin->ProcessCmd(_cmdId, M_TextInLeaveFocus, dlgCmd->cmdType); - } - - } diff --git a/v/srcwin/vthislst.cpp b/v/srcwin/vthislst.cpp deleted file mode 100644 index 2c3e74a..0000000 --- a/v/srcwin/vthislst.cpp +++ /dev/null @@ -1,107 +0,0 @@ -//=============================================================== -// vThislst.cpp - vThisList class functions - Windows -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include - -//======================>>> vThisList::vThisList <<<======================= - vThisList::vThisList() - { - // This will keep a list of this pointers accessed by some id - _cur = 0; // empty list - _list = 0; - - } - -//======================>>> vThisList::~vThisList <<<======================= - vThisList::~vThisList() - { - // This will keep a list of this pointers accessed by some id - thisList* next; - for (thisList* tl = _list ; tl != 0 ; tl = next) - { - next = tl->next; // get next one - delete tl; - } - } - -//======================>>> vThisList::Add <<<======================= - void vThisList::Add(ThisId id, void* This) - { - // Add to list - thisList* newList = new thisList; - - newList->id = id; - newList->thisPtr = This; - newList->next = _list; - _cur = _list = newList; - } - -//======================>>> vThisList::Delete <<<======================= - void vThisList::Delete(ThisId id) - { - // delete from the list - thisList* next, *prev; - - prev = 0; - for (thisList* tl = _list ; tl != 0 ; tl = next) - { - next = tl->next; - if (tl->id == id) - { - if (prev == 0) - _list = next; - else - prev->next = next; - delete tl; - _cur = _list; // keep _cur valid - return; - } - prev = tl; - } - } - -//======================>>> vThisList::GetThis <<<======================= - void* vThisList::GetThis(ThisId id) VCONST - { - for (thisList* tl = _list ; tl != 0 ; tl = tl->next) - { - if (tl->id == id) - { - _cur = tl; // keep cur valid - return tl->thisPtr; - } - } - return 0; - } - -//======================>>> vThisList::GetFirstThis <<<======================= - void* vThisList::GetFirstThis() VCONST - { - _cur = _list; // start at front - if (_cur) - return _cur->thisPtr; - else - return 0; - } - -//======================>>> vThisList::GetNextThis <<<======================= - void* vThisList::GetNextThis() VCONST - { - if (_cur) - { - _cur = _cur->next; // point to next entry - if (_cur) - return _cur->thisPtr; - } - - return 0; - } diff --git a/v/srcwin/vtimer.cpp b/v/srcwin/vtimer.cpp deleted file mode 100644 index 77d03f3..0000000 --- a/v/srcwin/vtimer.cpp +++ /dev/null @@ -1,101 +0,0 @@ -//=============================================================== -// vTimer.cxx - vTimer class functions - Windows -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include -#include -#include - -// Define static data of the class - - void CALLBACK vTimerProc(HWND /*hwnd*/, UINT msg, UINT idTimer, DWORD /*dwTime*/); - - static vThisList _timers; - -//=========================>>> vTimer::vTimerProc <<<======================= - void CALLBACK vTimerProc(HWND hwnd, UINT msg, UINT idTimer, DWORD dwTime) - { - if (msg != WM_TIMER) - return; // ignore... - - vTimer* mytime = (vTimer*) _timers.GetThis((ThisId)idTimer); - if (mytime) // Make sure we got a this - mytime->tick(); - } - -//======================>>> vTimer::vTimer <<<======================= - vTimer::vTimer( ) // default constructor - { - SysDebug(Constructor,"vTimer::vTimer - constructor\n"); - - _id = 0; // no id - _interval = 0; // no interval - } - -//======================>>> vTimer::~vTimer <<<======================= - vTimer::~vTimer( ) - { - SysDebug(Destructor,"vTimer::~vTimer - destructor\n"); - - if (_id) // remove timer if in effect - { - TimerStop(); - } - } - -//======================>>> vTimer::TimerSet <<<======================= - int vTimer::TimerSet(long interval) - { - - if (_id) // remove timer if in effect - { - TimerStop(); - } - - _interval = interval; - - _id = (HWND) ::SetTimer(0,0, interval, (TIMERPROC)vTimerProc); - - if (_id != 0) - { - _timers.Add((ThisId)_id, (void*)this); - return 1; - } - else - return 0; - - } - -//======================>>> vTimer::TimerStop <<<======================= - void vTimer::TimerStop(void) - { - if (_id) // remove timer if in effect - { - ::KillTimer(_id, 0); - _timers.Delete((ThisId)_id); // delete old timer - _id = 0; - } - } - -//======================>>> vTimer::TimerTick <<<======================= - void vTimer::TimerTick(void) - { - // default has no action - will be overridden - } - -//=========================>>> vTimer::tick <<<======================= - void vTimer::tick(void) - { - // internal tick routine - - TimerTick(); // call the work routine - } - diff --git a/v/srcwin/vutil.cpp b/v/srcwin/vutil.cpp deleted file mode 100644 index bc1cecb..0000000 --- a/v/srcwin/vutil.cpp +++ /dev/null @@ -1,212 +0,0 @@ -//=============================================================== -// General Purpose V Utilities -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include - -#include - -#define __USELOCALES__ -#include - -//#include - - -//=============================>>> vTextLen <<<============================ - int vTextLen(const char *str, int& numLines) - { - // calculate length of multiline text string - int l, maxl; - maxl = 0; // no length so far - numLines = 1; - for (l = 0 ; *str; str++) - { - if (*str != '\n' && *str != '\r') - { - ++l; - } - else - { - ++numLines; - if (l > maxl) - maxl = l; - l = 0; - } - - } - if (l > maxl) - maxl = l; - return maxl; - } - -//=============================>>> ByteToStr <<<============================ - void ByteToStr(unsigned char intg, char* str) - { // convert byte intg to char string in str - - int i; - int d, intval, j; - char k; - static char digits[] = "0123456789ABCDEF"; - - intval = intg; - str[0] = '\0'; - i = 0; - do - { // generate digits - i++; - d = intval % 16; // mod 10 - str[i] = digits[d]; - intval = intval / 16; - } - while (intval != 0); - - for (j = 0 ; j < i ; j++ ) - { // then reverse - k = str[i]; - str[i--] = str[j]; - str[j] = k; - } - if (str[1] == 0) // one char only - { - str[1] = str[0]; str[2] = 0; str[0] = '0'; - } - } - -//=============================>>> vLblLen <<<============================ - int vLblLen(const char *str) - { - int l; - for (l = 0 ; *str; str++) - if (*str != '&') - ++l; - return l; - } - -//=============================>>> l_to_a <<<============================ - long StrToLong(VCONST char* str) - { // convert int intg to char string in str - - long val = 0; - long neg = 1; - if (*str == '-') - { - neg = -1; - ++str; - } - while (*str) - { - if (*str >= '0' && *str <= '9') - val = (val*10) + (*str++ - '0'); - else - break; - } - return val * neg; - } - -//=============================>>> l_to_a <<<============================ - void IntToStr(int intg, char* str) - { // convert int intg to char string in str - - LongToStr((long)intg, str); - } - -//=============================>>> l_to_a <<<============================ - void LongToStr(long intg, char* str) - { // convert long intg to char string in str - - long i; - long d, intval, j; - char k; - static char digits[] = "0123456789"; - - intval = intg >= 0L ? intg : (-intg); - str[0] = '\0'; - i = 0; - do - { // generate digits - i++; - d = intval % 10L; // mod 10 - str[i] = digits[d]; - intval = intval / 10L; - } - while (intval != 0L); - - if (intg < 0L) - { // then sign - str[++i] = '-'; - } - for (j = 0 ; j < i ; j++ ) - { // then reverse - k = str[i]; - str[i--] = str[j]; - str[j] = k; - } - } - -//=============================>>> vGetLocalTime <<<========================== - void vGetLocalTime(char* tm) - { - - char buff[20]; - time_t t; - t = time(0); - strftime(buff, 20, "%X", localtime(&t)); - strcpy(tm,buff); - } - -//=============================>>> vGetLocalDate <<<========================== - void vGetLocalDate(char* tm) - { - - char buff[20]; - time_t t; - t = time(0); - strftime(buff, 20, "%d %b %Y", localtime(&t)); - strcpy(tm,buff); - } - -//=============================>>> vBeep <<<========================== - void vBeep() - { - ::MessageBeep(MB_OK); - } - -//================================================================== -// -// Some special case utils for working with CommandObjects -// -//=============================>>> vGetcmdIdIndex <<<========================== - int vGetcmdIdIndex(ItemVal cmdId, CommandObject *cmdObj) - { - // Return the index to the CommandObject array for the - // I which has the matching cmdId. - for (int i = 0 ; cmdObj[i].cmdType != C_EndOfList ; ++i) - { - if (cmdObj[i].cmdId == cmdId) - return i; - } - return -1; - } - -//=============================>>> vGetMenuIdIndex <<<========================== - int vGetMenuIdIndex(ItemVal cmdId, vMenu *cmdObj) - { - // Return the index to the CommandObject array for the - // I which has the matching cmdId. - for (int i = 0 ; cmdObj[i].label != 0 ; ++i) - { - if (cmdObj[i].menuId == cmdId) - return i; - } - return -1; - } - - diff --git a/v/srcwin/vwindc.cpp b/v/srcwin/vwindc.cpp deleted file mode 100644 index d5dc4c4..0000000 --- a/v/srcwin/vwindc.cpp +++ /dev/null @@ -1,1026 +0,0 @@ -//=============================================================== -// vWinDC - Windows Base DC -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - - -#include // for Win 32 stuff - -#include - -#include -#include - -#include // need access to the app -#include // our own canvas widget -#include - -//----------------------------------------------------------------------- - -//================>>> vWinDC::vWinDC <<<======================== - vWinDC::vWinDC() - { - SysDebug(Constructor,"vWinDC::vWinDC() constructor\n") - - _font = theApp->GetDefaultFont(); // Use the default fixed font by default! - - _hdc = 0; _hdcPaint = 0; - _hpen = (HPEN) ::GetStockObject(BLACK_PEN); - _hbrush = static_cast(::GetStockObject(WHITE_BRUSH)); - _canvasBG = RGB(255,255,255); - _isPrinterDC = 0; // Assume not printer - _isWin32s = 0; -#ifndef VWIN16 - OSVERSIONINFO vi; - vi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - if (GetVersionEx(&vi)) - { - _isWin32s = vi.dwPlatformId == VER_PLATFORM_WIN32s; - } -#endif - } - -//================>>> vWinDC::~vWinDC <<<======================== - vWinDC::~vWinDC() - { - - SysDebug(Destructor,"vWinDC::~vWinDC() destructor\n") - - } - -//=====================>>> vXDC::CopyFromMemoryDC <<<========================== - void vWinDC::CopyFromMemoryDC(vMemoryDC* vmemdc, int destX, int destY, - int srcX, int srcY, int srcW, int srcH) // V:1.13 - { - // Copy myself to another DC - int ch = vmemdc->_physHeight; - int cw = vmemdc->_physWidth; - int cx = 0; - int cy = 0; - - if (srcX > 0) // Fixed: 10/11/96 - cx = srcX; - if (srcY > 0) - cy = srcY; - if (srcW > 0) - cw = srcW; - if (srcH > 0) - ch = srcH; - - if ((cw + cx) > vmemdc->_physWidth && _physWidth > 0) // only copy what will fi - cw = vmemdc->_physWidth - cx; - if ((ch + cy) > vmemdc->_physHeight && _physHeight > 0) - ch = vmemdc->_physHeight - cy; - - if ((cw + destX) > _physWidth && _physWidth > 0) - cw = _physWidth - destX; - if ((ch + destY) > _physHeight && _physHeight > 0) - ch = _physHeight - destY; - - GetHDC(); // Get my hdc - vmemdc->GetHDC(); // the source hdc - HDC memDC = vmemdc->_hdc; - - - ::BitBlt(_hdc, destX, destY, cw, ch, memDC, cx, cy, SRCCOPY); - - vmemdc->ReleaseHDC(); - ReleaseHDC(); - } - -#ifdef DRAWARC -//====================>>> vWinDC::DrawArc <<<========================== - void vWinDC::DrawArc(int xx1, int yy1, int xx2, int yy2, - int xxc, int yyc) - { - double dx = xx1 - xxc; - double dy = yy1 - yyc; - double radius = sqrt(dx * dx + dy * dy); - int r = (int) radius; - -const double PIx2 = 6.283185; - - double radius1, radius2; - - if (xx1 == xx2 && yy1 == yy2) - { - radius1 = 0.0; - radius2 = 360.0; - } - else if (radius == 0.0) - radius1 = radius2 = 0.0; - else - { - if (xx1 - xxc == 0) - { - if (yy1 - yyc < 0) - radius1 = 90.0; - else - radius1 = -90.0; - } - else - radius1 = -atan2 ((double) (yy1 - yyc), (double) (xx1 - xxc)) * 360.0 / PIx2; - - if (xx2 - xxc == 0) - { - if (yy2 - yyc < 0) - radius2 = 90.0; - else - radius2 = -90.0; - } - else - radius2 = -atan2 ((double) (yy2 - yyc), (double) (xx2 - xxc)) * 360.0 / PIx2; - } - radius1 *= 64.0; - radius2 *= 64.0; - int alpha1 = (int) radius1; - int alpha2 = (int) (radius2 - radius1); - while (alpha2 <= 0) - alpha2 += 360 * 64; - - while (alpha2 > 360 * 64) - alpha2 -= 360 * 64; - - if (_brush.brushStyle != vTransparent) - { - XFillArc(_XDisplay, _XWindow, _GC, - xxc - r, yyc - r, 2 * r, 2 * r, alpha1, alpha2); - } - - if (_pen.penStyle != vTransparent) - { - XDrawArc(_XDisplay, _XWindow, _GC, - xxc - r, yyc - r, 2 * r, 2 * r, alpha1, alpha2); - } - } -#endif - -//====================>>> vWinDC::DrawEllipse <<<========================== - void vWinDC::DrawEllipse(int x, int y, int width, int height) - { - if (height == 0 || width == 0) - return; - - int xx = Scale(x+_tx); - int yy = Scale(y+_ty); - int x2 = Scale(x+_tx+width); - int y2 = Scale(y+_ty+height); - - GetHDC(); // Get a DC to use - _hpen = _pen.GetHPEN(); // Get the pen - HPEN oldpen = (HPEN)::SelectObject(_hdc, _hpen); // Select it - _hbrush = _brush.GetHBRUSH(); - HBRUSH oldbrush = static_cast(::SelectObject(_hdc, _hbrush)); - - (void)::Ellipse(_hdc, xx, yy, x2, y2); - - ::SelectObject(_hdc, oldpen); // original - ::SelectObject(_hdc, oldbrush); // something safe - - ReleaseHDC(); // Release the DC - } - -//====================>>> vWinDC::DrawIcon <<<========================== - void vWinDC::DrawIcon(int x, int y, VCONST vIcon& icon) - { - - int xx = Scale(x+_tx); - int yy = Scale(y+_ty); - - // Now, draw the icon - GetHDC(); // get our hdc - ::SetBkColor(_hdc, _canvasBG); - - HBRUSH hbrush, oldbrush; - HPEN oldpen; - - HDC hdcMem = ::CreateCompatibleDC(_hdc); - - if (_isPrinterDC) - { - hbrush = static_cast(::GetStockObject(WHITE_BRUSH)); - oldpen = (HPEN)::SelectObject(_hdc, ::GetStockObject(BLACK_PEN)); - } - else - hbrush = ::CreateSolidBrush(_pen.GetColor().pixel()); // use pen color! - - oldbrush = static_cast(::SelectObject(_hdc, hbrush)); - - HBITMAP hbm = icon.GetIconHBM(_hdc); // get the bitmap - HBITMAP oldbm = static_cast(::SelectObject(hdcMem,hbm)); - - // Now BitBlt the icon BMP into the drawing canvas, leaving - // background untouched, and the pen color to draw 1 bits - if (icon.depth == 1) - { - ::BitBlt(_hdc, xx, yy, icon.width, icon.height, - hdcMem, 0, 0, 0xE20746L); - } - else - { - if (icon.iType == Transparent) - { - // Prepare a memory DC with the mask - HDC hdcMemMask = ::CreateCompatibleDC( _hdc ); - HBITMAP hmsk = icon.GetIconMask( _hdc ); // get icon mask HBITMAP - HBITMAP oldBM = static_cast(::SelectObject( hdcMemMask, hmsk )); - - // Prepare DC for scratch pad - HDC hdcScratch = ::CreateCompatibleDC( _hdc ); - HBITMAP hscr = ::CreateCompatibleBitmap( _hdc, icon.width, icon.height ); - HBITMAP scrBM = static_cast(::SelectObject( hdcScratch, hscr )); - - // Copy inverted mask to the scratch dc - ::BitBlt( hdcScratch, 0, 0, icon.width, icon.height, - hdcMemMask, 0, 0, NOTSRCCOPY); - - // Leave the background untouched where the mask is black - // Erase the background where the mask is white - ::BitBlt( _hdc, xx, yy, icon.width, icon.height, - hdcScratch, 0, 0, SRCAND); - - // Paint the icon on the scratch DC only where the mask is white - // Erase scratch DC where the mask is black - ::BitBlt( hdcScratch, 0, 0, icon.width, icon.height, - hdcMem, 0, 0, SRCERASE); - - // Merge the background DC with the scratch DC (or) - ::BitBlt( _hdc, xx, yy, icon.width, icon.height, - hdcScratch, 0, 0, SRCPAINT); - - // Delete the scratch DC and the bitmap - ::SelectObject( hdcScratch, scrBM ); - ::DeleteObject( hscr ); - ::DeleteDC( hdcScratch ); - - // Delete the mask DC - ::SelectObject( hdcMemMask, oldBM ); - ::DeleteDC( hdcMemMask ); - } - else - ::BitBlt(_hdc, xx, yy, icon.width, icon.height, - hdcMem, 0, 0, SRCCOPY); - } - ::DeleteDC(hdcMem); - if (!_isPrinterDC) - ::DeleteObject(hbrush); // free brush - else - ::SelectObject(_hdc, oldpen); // something safe - ::SelectObject(_hdc, oldbrush); // something safe - - ::SelectObject(hdcMem,oldbm); - - ReleaseHDC(); // Release the DC - - - } - -//====================>>> vWinDC::DrawLine <<<========================== - void vWinDC::DrawLine(int x, int y, int xend, int yend) - { - // Draw a line from x,y to xend,yend - - // This method has the typical sequence of code for drawing. All other - // drawing methods are modeled using this approach - - // First, do the required scaling - - int xx = Scale(x+_tx); - int yy = Scale(y+_ty); - int xe = Scale(xend+_tx); - int ye = Scale(yend+_ty); - - // Windows needs a DC to draw into. For efficiency, the DC we use - // can be created in one of two ways. While the user program is - // drawing stuff interactively (usually in response to mouse input), - // the DC is created and released each time the drawing method is - // used. For Redraw, the canvas redraw event will issue a BeginPaint - // and EndPaint, which will bracket all drawing, and creates and - // releases a DC (_hdcPaint). So, the GetHDC will either use the - // existing _hdcPaint, or create a new one as needed. ReleaseHDC - // then either releases the DC, or does nothing, and lets EndPaint - // do the job. - - GetHDC(); // Get a DC to use - _hpen = _pen.GetHPEN(); // Get the pen - HPEN oldpen = (HPEN)::SelectObject(_hdc, _hpen); // Select it - - // Shapes will do a similar sequence for brushes as well - - // Now the code to actually do the drawing - - ::MoveTo(_hdc,xx, yy); - ::LineTo(_hdc, xe, ye); - - // We need to set the pen (and brush for shapes) to a system - // defined object so it is safe to fiddle with our pen and brush - // during BeginPaint / EndPaint blocks. Changing pens and brushes - // causes them to be destroyed and recreated, and you can't do - // that if they are selected into the DC, which could happen - // inside the BeginPaint / EndPaint sequence. - - ::SelectObject(_hdc, oldpen); // something safe - - ReleaseHDC(); // Release the DC - } - -//====================>>> vWinDC::DrawLines <<<========================== - void vWinDC::DrawLines(vLine* lineList, int count) - { - - if (count < 1 || lineList == 0) - return; - - GetHDC(); // Get a DC to use - _hpen = _pen.GetHPEN(); // Get the pen - HPEN oldpen = (HPEN)::SelectObject(_hdc, _hpen); // Select it - - vLine* lp = lineList ; - for (int num = 0 ; num < count ; ++lp, ++num) - { - - int xx = Scale(lp->x+_tx); - int yy = Scale(lp->y+_ty); - int xe = Scale(lp->xend+_tx); - int ye = Scale(lp->yend+_ty); - - ::MoveTo(_hdc,xx, yy); - ::LineTo(_hdc, xe, ye); - } - - ::SelectObject(_hdc, oldpen); // something safe - - ReleaseHDC(); // Release the DC - } - -//====================>>> vWinDC::DrawLines <<<========================== - void vWinDC::DrawLines(vPoint* points, int n) - { - // draw a complete polyline - - if ( n < 2 || points == 0 ) - return; - - POINT* xpoints; - - if (_hasScale || _tx != 0 || _ty != 0) // If we have to scale, then we need to copy - { - xpoints = new POINT[n]; // allocate space for copy - for (int i = 0; i < n; i++) - { - xpoints[i].x = ((points[i].x+_tx) * _Mult) / _Div; // scale - xpoints[i].y = ((points[i].y+_ty) * _Mult) / _Div; - } - } - else -#ifdef _WIN32 - { - xpoints = new POINT[n]; // allocate space for copy - for (int i = 0; i < n; i++) - { - xpoints[i].x = points[i].x; - xpoints[i].y = points[i].y; - } - } -#else - { - xpoints = (POINT*)points; // just use original values - } -#endif - - GetHDC(); // Get a DC to use - _hpen = _pen.GetHPEN(); // Get the pen - HPEN oldpen = (HPEN)::SelectObject(_hdc, _hpen); // Select it - HBRUSH oldbrush = _hbrush = _brush.GetHBRUSH(); - ::SelectObject(_hdc, _hbrush); - - (void)::Polyline(_hdc, xpoints, n); - - ::SelectObject(_hdc, oldpen); // something safe - ::SelectObject(_hdc, oldbrush); // something safe - - ReleaseHDC(); // Release the DC - -#ifndef _WIN32 - if (_hasScale) -#endif - delete[]xpoints; -} - -//==================>>> vWinDC::DrawColorPoints <<<====================== - void vWinDC::DrawColorPoints(int x, int y, int nPoints, vColor* pointList) - { - // Draw a bunch of color points. - - if (nPoints < 1 || pointList == 0) - return; - - int xx = Scale(x+_tx); - int yy = Scale(y+_ty); - - if (yy < 0) - return; // row not displayed - - GetHDC(); // Get a DC to use - - COLORREF curpix = pointList[0].pixel(); - COLORREF prevpix = curpix; - COLORREF usepix = curpix; // rep used by windows - - if (xx < 0) // need to check every time - { - for (int ix = 0 ; ix < nPoints ; ++ix) - { - if (xx+ix < 0) - continue; // this one not displayed - curpix = pointList[ix].pixel(); - if (curpix != prevpix) // don't reset color if same - { - usepix = prevpix = curpix; - } - usepix = ::SetPixel(_hdc,xx+ix,yy,usepix); - } - } - else // don't need xx check - { - for (int ix = 0 ; ix < nPoints ; ++ix) - { - curpix = pointList[ix].pixel(); - if (curpix != prevpix) // don't reset color if same - { - usepix = prevpix = curpix; - } - usepix = ::SetPixel(_hdc,xx+ix,yy,usepix); - } - } - - ReleaseHDC(); // Release the DC - } - -//==================>>> vWinDC::DrawPoint <<<====================== - void vWinDC::DrawPoint(int x, int y) - { - - // First, do the required scaling - - int xx = Scale(x+_tx); - int yy = Scale(y+_ty); - - GetHDC(); // Get a DC to use - _hpen = _pen.GetHPEN(); // Get the pen - HPEN oldpen = (HPEN)::SelectObject(_hdc, _hpen); // Select it - - // Now the code to actually do the drawing - - ::MoveTo(_hdc,xx, yy); - ::LineTo(_hdc, xx+1, yy+1); - - ::SelectObject(_hdc, oldpen); // something safe - - ReleaseHDC(); // Release the DC - - } - -//==================>>> vWinDC::DrawPoints <<<====================== - void vWinDC::DrawPoints(vPoint* pointList, int count) - { - - if (count < 1 || pointList == 0) - return; - - // First, do the required scaling - - GetHDC(); // Get a DC to use - _hpen = _pen.GetHPEN(); // Get the pen - HPEN oldpen = (HPEN)::SelectObject(_hdc, _hpen); // Select it - - // Now the code to actually do the drawing - - vPoint* pl = pointList ; - for (int num = 0 ; num < count ; ++pl, ++num) - { - int xx = Scale(pl->x+_tx); - int yy = Scale(pl->y+_ty); - - ::MoveTo(_hdc,xx, yy); - ::LineTo(_hdc, xx+1, yy+1); - } - - ::SelectObject(_hdc, oldpen); // something safe - - ReleaseHDC(); // Release the DC - - } - -//==================>>> vWinDC::DrawPolygon <<<====================== - void vWinDC::DrawPolygon(int n, vPoint points[], int fillStyle) - { - // draw a complete polygon (starting point specified twice!) - - - POINT* xpoints; - - if (_hasScale || _tx != 0 || _ty != 0) // If we have to scale, then we need to copy - { - xpoints = new POINT[n]; // allocate space for copy - for (int i = 0; i < n; i++) - { - xpoints[i].x = ((points[i].x+_tx) * _Mult) / _Div; // scale - xpoints[i].y = ((points[i].y+_ty) * _Mult) / _Div; - } - } - else -#ifndef VWIN16 - { - xpoints = new POINT[n]; // allocate space for copy - for (int i = 0; i < n; i++) - { - xpoints[i].x = points[i].x; - xpoints[i].y = points[i].y; - } - } -#else - { - xpoints = (POINT*)points; // just use original values - } -#endif - - GetHDC(); // Get a DC to use - _hpen = _pen.GetHPEN(); // Get the pen - HPEN oldpen = (HPEN)::SelectObject(_hdc, _hpen); // Select it - HBRUSH oldbrush = _hbrush = _brush.GetHBRUSH(); - ::SelectObject(_hdc, _hbrush); - - int prev = ::SetPolyFillMode(_hdc, (fillStyle == vAlternate) ? ALTERNATE : WINDING); - - (void)::Polygon(_hdc, xpoints, n - 1); - - ::SetPolyFillMode(_hdc,prev); - - ::SelectObject(_hdc, oldpen); // something safe - ::SelectObject(_hdc, oldbrush); // something safe - - ReleaseHDC(); // Release the DC - -#ifdef VWIN16 - if (_hasScale) -#endif - delete[]xpoints; -} - -//==================>>> vWinDC::DrawRectangle <<<====================== - void vWinDC::DrawRectangle(int x, int y, int width, int height) - { - if (height == 0 || width == 0) - return; - - int xx = Scale(x+_tx); - int yy = Scale(y+_ty); - int x2 = Scale(x+width+1+_tx); - int y2 = Scale(y+height+1+_ty); - - GetHDC(); // Get a DC to use - if (height == 1 && width == 1) - { - COLORREF curpix = _brush.GetColor().pixel(); - ::SetPixel(_hdc,xx,yy,curpix); - ReleaseHDC(); - return; - } - _hpen = _pen.GetHPEN(); // Get the pen - HPEN oldpen = (HPEN)::SelectObject(_hdc, _hpen); // Select it - _hbrush = _brush.GetHBRUSH(); - HBRUSH oldbrush = static_cast(::SelectObject(_hdc, _hbrush)); - - (void)::Rectangle(_hdc, xx, yy, x2, y2); - - ::SelectObject(_hdc, oldpen); // something safe - ::SelectObject(_hdc, oldbrush); // something safe - - ReleaseHDC(); // Release the DC - - } - -//==================>>> vWinDC::DrawRectangles <<<====================== - void vWinDC::DrawRectangles(vRect* rectList, int count) - { - if (count < 1 || !rectList) - return; - - GetHDC(); // Get a DC to use - - _hpen = _pen.GetHPEN(); // Get the pen - HPEN oldpen = (HPEN)::SelectObject(_hdc, _hpen); // Select it - _hbrush = _brush.GetHBRUSH(); - HBRUSH oldbrush = static_cast(::SelectObject(_hdc, _hbrush)); - - vRect* rp = rectList ; - for (int num = 0 ; num < count ; ++rp, ++num) - { - int xx = Scale(rp->x+_tx); - int yy = Scale(rp->y+_ty); - int x2 = Scale(rp->x+rp->w+1+_tx); - int y2 = Scale(rp->y+rp->h+1+_ty); - - if (rp->h == 0 && rp->w == 0) - continue; - - if (rp->h == 1 && rp->w == 1) - { - COLORREF curpix = _brush.GetColor().pixel(); - ::SetPixel(_hdc,xx,yy,curpix); - } - - else - (void)::Rectangle(_hdc, xx, yy, x2, y2); - } - - ::SelectObject(_hdc, oldpen); // something safe - ::SelectObject(_hdc, oldbrush); // something safe - - ReleaseHDC(); // Release the DC - - } - -//================>>> vWinDC::DrawRoundedRectangle <<<=================== - void vWinDC::DrawRoundedRectangle(int x, int y, - int width, int height, int radius) - { - if (height == 0 || width == 0) - return; - - int xx = Scale(x+_tx); - int yy = Scale(y+_ty); - int x2 = Scale(x+width+_tx); - int y2 = Scale(y+height+_ty); - int r; - - if (radius < 0) - { - // Negative radius means divide average of hight and width - // by this - r = (Scale(width+height)/(-2 * radius)); - } - else - r = Scale(radius); - - - GetHDC(); // Get a DC to use - _hpen = _pen.GetHPEN(); // Get the pen - HPEN oldpen = (HPEN)::SelectObject(_hdc, _hpen); // Select it - _hbrush = _brush.GetHBRUSH(); - HBRUSH oldbrush = static_cast(::SelectObject(_hdc, _hbrush)); - - (void)::RoundRect(_hdc, xx, yy, x2, y2, r, r); - - ::SelectObject(_hdc, oldpen); // something safe - ::SelectObject(_hdc, oldbrush); // something safe - - ReleaseHDC(); // Release the DC - } - -//==================>>> vWinDC::DrawRubberEllipse <<<=================== - void vWinDC::DrawRubberEllipse(int x, int y, int width, int height) - { - if (height == 0 || width == 0) - return; - - int xx = Scale(x+_tx); - int yy = Scale(y+_ty); - int x2 = Scale(x+width+_tx); - int y2 = Scale(y+height+_ty); - vPen xorPen = _pen; // start with current pen - - xorPen.SetColor(255,255,255); // need it to be white - - GetHDC(); // Get a DC to use - _hpen = xorPen.GetHPEN(); // Get the pen - HPEN oldpen = (HPEN)::SelectObject(_hdc, _hpen); // Select it - HBRUSH oldbrush = static_cast(::SelectObject(_hdc, ::GetStockObject(NULL_BRUSH))); - ::SetROP2(_hdc, R2_XORPEN); // draw in XOR - (void)::Ellipse(_hdc, xx, yy, x2, y2); - ::SetROP2(_hdc, R2_COPYPEN); // regular pen - ::SelectObject(_hdc, oldpen); // something safe - ::SelectObject(_hdc, oldbrush); // something safe - - ReleaseHDC(); // Release the DC - } - -//==================>>> vWinDC::DrawRubberLine <<<====================== - void vWinDC::DrawRubberLine(int x, int y, int xend, int yend) - { - // Draw a rubber-band line from x,y to xend,yend. Redrawing - // over the same with will erase it. - - int xx = Scale(x+_tx); - int yy = Scale(y+_ty); - int xe = Scale(xend+_tx); - int ye = Scale(yend+_ty); - - vPen xorPen = _pen; // start with current pen - - xorPen.SetColor(255,255,255); // need it to be white - - GetHDC(); // Get a DC to use - _hpen = xorPen.GetHPEN(); // Get the pen - HPEN oldpen = (HPEN)::SelectObject(_hdc, _hpen); // Select - ::SetROP2(_hdc, R2_XORPEN); // draw in XOR - ::MoveTo(_hdc,xx, yy); - ::LineTo(_hdc, xe, ye); - ::SetROP2(_hdc, R2_COPYPEN); // regular pen - ::SelectObject(_hdc, oldpen); // something safe - ReleaseHDC(); - } - -//==================>>> vWinDC::DrawRubberPoint <<<====================== - void vWinDC::DrawRubberPoint(int x, int y) - { - int xx = Scale(x+_tx); - int yy = Scale(y+_ty); - - vPen xorPen = _pen; // start with current pen - - xorPen.SetColor(255,255,255); // need it to be white - - GetHDC(); // Get a DC to use - _hpen = xorPen.GetHPEN(); // Get the pen - HPEN oldpen = (HPEN)::SelectObject(_hdc, _hpen); // Select - ::SetROP2(_hdc, R2_XORPEN); // draw in XOR - ::MoveTo(_hdc,xx, yy); - ::LineTo(_hdc, xx+1, yy+1); - ::SetROP2(_hdc, R2_COPYPEN); // regular pen - ::SelectObject(_hdc, oldpen); // something safe - ReleaseHDC(); - } - -//==================>>> vWinDC::DrawRubberRectangle <<<================== - void vWinDC::DrawRubberRectangle(int x, int y, int width, int height) - { - if (height == 0 || width == 0) - return; - - int xx = Scale(x+_tx); - int yy = Scale(y+_ty); - int x2 = Scale(x+width+_tx); - int y2 = Scale(y+height+_ty); - vPen xorPen = _pen; // start with current pen - - xorPen.SetColor(255,255,255); // need it to be white - - GetHDC(); // Get a DC to use - _hpen = xorPen.GetHPEN(); // Get the pen - HPEN oldpen = (HPEN)::SelectObject(_hdc, _hpen); // Select it - HBRUSH oldbrush = static_cast(::SelectObject(_hdc, ::GetStockObject(NULL_BRUSH))); - ::SetROP2(_hdc, R2_XORPEN); // draw in XOR - (void)::Rectangle(_hdc, xx, yy, x2, y2); - ::SetROP2(_hdc, R2_COPYPEN); // regular pen - ::SelectObject(_hdc, oldpen); // something safe - ::SelectObject(_hdc, oldbrush); // something safe - - ReleaseHDC(); // Release the DC - } - -//=====================>>> vWinDC::DrawAttrText <<<========================== - void vWinDC::DrawAttrText(int x, int y, VCONST char* text, const ChrAttr attr) - { - // Draw text with attributes at given x, y. - - static int mapColor[] = - { - vC_Black, vC_Blue, vC_Green, vC_Cyan, - vC_Red, vC_Magenta, vC_Yellow, vC_White, - vC_DarkGray, vC_DimBlue, vC_DimGreen, vC_DimCyan, - vC_DimRed, vC_DimMagenta, vC_DimYellow, vC_MedGray - }; - - int xx = Scale(x+_tx); - int yy = Scale(y+_ty); - - COLORREF oldbk = 0; - COLORREF oldtc; - - GetHDC(); // Get a DC to use - - _font.LoadFont(_hdc,_isPrinterDC > 0); // need to setup font! - - HFONT oldfont = (HFONT)::SelectObject(_hdc, _font.GetHFONT()); // select it in - - if (attr & ChHighlight) - { - oldbk = ::SetBkColor(_hdc, ::GetSysColor(COLOR_HIGHLIGHT)); - oldtc = ::SetTextColor(_hdc, ::GetSysColor(COLOR_HIGHLIGHTTEXT)); - if (attr & 0xF0) // A color overide - { - ::SetTextColor(_hdc,vStdColors[ mapColor[((attr & 0xF0) >> 4)] ].pixel()); - } - } - else if (attr & ChReverse) - { - COLORREF crf = _canvasBG; - oldtc = ::SetTextColor(_hdc, crf); - if (_font.GetFontColor() != 0) - { - crf = _font.GetFontColor(); - oldbk = ::SetBkColor(_hdc, crf); - } - else - { - crf = _pen.GetColor().pixel(); - oldbk = ::SetBkColor(_hdc, crf); - } - if (attr & 0xF0) // A color overide - { - ::SetTextColor(_hdc,vStdColors[ mapColor[((attr & 0xF0) >> 4)] ].pixel()); - } - } - else if (attr & ChBlackOnBG) - { - oldtc = ::SetTextColor(_hdc,vStdColors[ mapColor[vC_Black] ].pixel()); - oldbk = ::SetBkColor(_hdc,vStdColors[ mapColor[((attr & 0xF0) >> 4)] ].pixel()); - } - else if (attr & ChWhiteOnBG) - { - oldtc = ::SetTextColor(_hdc,vStdColors[ mapColor[vC_White] ].pixel()); - oldbk = ::SetBkColor(_hdc,vStdColors[ mapColor[((attr & 0xF0) >> 4)] ].pixel()); - } - else - { - oldbk = ::SetBkColor(_hdc, _canvasBG); - if (_font.GetFontColor() != 0) - oldtc = ::SetTextColor(_hdc, _font.GetFontColor()); - else - oldtc = ::SetTextColor(_hdc, _pen.GetColor().pixel()); - - if (attr & 0xF0) // A color overide - { - ::SetTextColor(_hdc,vStdColors[ mapColor[((attr & 0xF0) >> 4)] ].pixel()); - } - } - - - int oldMode = 0; - - if (_pen.GetStyle() == vTransparent) - { - oldMode = ::GetBkMode(_hdc); // current background mode - ::SetBkMode(_hdc,TRANSPARENT); - } - - // Now the code to actually do the drawing - if (_isPrinterDC > 0) - ::TextOut(_hdc, xx, yy-(_font.GetPointSize()), text, strlen(text)); - else - { - TEXTMETRIC tm; - int fh = 8; - if (::GetTextMetrics(_hdc, &tm)) - fh = tm.tmAscent + tm.tmDescent; - ::TextOut(_hdc, xx, yy-fh, text, strlen(text)); - } - - if (oldMode != 0) - ::SetBkMode(_hdc,oldMode); // Restore mode - - ::SelectObject(_hdc, oldfont); - - if (oldbk != 0) - { - ::SetBkColor(_hdc, oldbk); - } - ::SetTextColor(_hdc,oldtc); - - ReleaseHDC(); // Release the DC - - } - -//=====================>>> vWinDC::DrawText <<<========================== - void vWinDC::DrawText(int x, int y, VCONST char* text) - { - // simple draw text at given x, y - - // First, do the required scaling - - if (!text || !*text) - return; - - int xx = Scale(x+_tx); - int yy = Scale(y+_ty); - - COLORREF oldtc; - - GetHDC(); // Get a DC to use - ::SetBkColor(_hdc, _canvasBG); - - _font.LoadFont(_hdc,_isPrinterDC > 0); // need to setup font! - HFONT curfont = _font.GetHFONT(); - HFONT oldfont = (HFONT)::SelectObject(_hdc, curfont); // select it in - - if (_font.GetFontColor() != 0) - oldtc = ::SetTextColor(_hdc, _font.GetFontColor()); - else - oldtc = ::SetTextColor(_hdc, _pen.GetColor().pixel()); - - // Now the code to actually do the drawing - - int oldMode = 0; - - if (_pen.GetStyle() == vTransparent) - { - oldMode = ::GetBkMode(_hdc); // current background mode - ::SetBkMode(_hdc,TRANSPARENT); - } - - if (_isPrinterDC > 0) - ::TextOut(_hdc, xx, yy-(_font.GetPointSize()), text, strlen(text)); - else - { - TEXTMETRIC tm; - int fh = 8; - if (::GetTextMetrics(_hdc, &tm)) - fh = tm.tmAscent + tm.tmDescent; - ::TextOut(_hdc, xx, yy-fh, text, strlen(text)); - } - - if (oldMode != 0) - ::SetBkMode(_hdc,oldMode); // Restore mode - - ::SetTextColor(_hdc,oldtc); - - ::SelectObject(_hdc, oldfont); - - ReleaseHDC(); // Release the DC - - } - -//=====================>>> vWinDC::SetBrush <<<============================ - void vWinDC::SetBrush(VCONST vBrush& brush) - { - _brush = brush; - } - -//=====================>>> vWinDC::SetPen <<<============================ - void vWinDC::SetPen(VCONST vPen& pen) - { - _pen = pen; - } - -//====================>>> vWinDC::TextHeight <<<============================= - int vWinDC::TextHeight(int& asc, int& des) VCONST - { - // Return total height of this font. V will use total height, which - // is most often made up of ascent + descent. This is too much - // detail for the kind of apps V will support. - - GetHDC(); // Get a DC to use - _font.LoadFont(_hdc,_isPrinterDC > 0); // need to setup font! - HFONT oldfont = (HFONT)::SelectObject(_hdc, _font.GetHFONT()); // select it in - - TEXTMETRIC tm; - int a = 5, d = 3; // something reasonable? - - if (::GetTextMetrics(_hdc, &tm)) - { - a = tm.tmAscent; d = tm.tmDescent; - } - - asc = a ; des = d; - - ::SelectObject(_hdc, oldfont); // restore - - ReleaseHDC(); // Release the DC - - - return a+d; - } - -//========================>>> vvWinDC::TextWidth <<<========================== - int vWinDC::TextWidth(VCONST char* str) VCONST - { - int len = strlen(str); // strlen - - GetHDC(); // Get a DC to use - _font.LoadFont(_hdc,_isPrinterDC > 0); // need to setup font! - HFONT oldfont = (HFONT)::SelectObject(_hdc, _font.GetHFONT()); // select it in - -#ifndef VWIN16 - SIZE size; - if (!_isWin32s) - ::GetTextExtentPoint32(_hdc, str, len,&size); - else - ::GetTextExtentPoint(_hdc, str, len,&size); - ::SelectObject(_hdc,oldfont); - ReleaseHDC(); // Release the DC - return size.cx; -#else - DWORD extent = ::GetTextExtent(_hdc, str, len); - ReleaseHDC(); // Release the DC - // call x to get the length - return LOWORD(extent); -#endif - } diff --git a/v/srcwin/vwindow.cpp b/v/srcwin/vwindow.cpp deleted file mode 100644 index 574c234..0000000 --- a/v/srcwin/vwindow.cpp +++ /dev/null @@ -1,836 +0,0 @@ -//=============================================================== -// vWindow.cpp - vWindow class functions - MSWindows -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include // we are a friend of App -#include // our header -#include // we have panes -#include -#include - -#include - -// Define static data of the class - - int vWindow::_numWindows = 0; - vWindow* vWindow::_WinList = 0; - HWND vWindow::_curWin = 0; - HWND vWindow::_prevWin = 0; - -//======================>>> vWindow::vWindow <<<======================= - vWindow::vWindow(VCONST char *name, int width, int height, - WindowType wintype ) : vBaseWindow(name) // constructor - { - - SysDebug2(Constructor,"vWindow::vWindow(height %d, width %d) constructor\n", - height,width) - - _WindowMenuIndex = 0; // haven't added windows menu yet - // make hendles null - - _menuBar = 0; - _paneList = 0; // no panes yet - - // Set height and width using default if 0 supplied - _WinHeight = height ? height : theApp->DefaultHeight(); - _WinWidth = width ? width : theApp->DefaultWidth(); - - _wType = wintype; - - _NextWin = _WinList; // link in at top - _WinList = this; - _canvasPane = 0; // no canvas pane yet - _justActivated = 0; - _mouseDown = 0; - _shiftKeyDown = 0; - _ctrlKeyDown = 0; - _createdOK = 0; - - initialize(); // set this guy up - } -//======================>>> vWindow::vWindow <<<======================= - vWindow::vWindow(const vWindow& w) : // Copy Constructor - vBaseWindow(w) - { - // Copy is shallow, but we track that it is a copy - vSysError("vWindow - V semantics do not support copy constructors!"); - } - -//======================>>> vWindow::~vWindow <<<======================= - vWindow::~vWindow() // destructor - { - SysDebug(Destructor,"vWindow::~vWindow destructor\n") - - if (!_createdOK) - return; - _createdOK = 0; // prevent multiple destructs - PaneList* temp; - for (PaneList* pl = _paneList ; pl != 0 ; ) - { - temp = pl; - pl = pl->nextPL; - delete temp; // delete the PaneLists we allocated - } - if (_menuBar != 0) // clean up the menu bar - { - ::DestroyMenu(_menuBar); - _menuBar = 0; - } - } - -//======================>>> vWindow::AddPane <<<======================= - void vWindow::AddPane(vPane* add_pane) - { - // Add a pane to the window - - PaneList* newPane = new PaneList; // add a new pane to the list - - SysDebug1(Build,"vWindow::AddPane() to %s\n",_name) - - newPane->pane = add_pane; // this is the pane we are adding - - newPane->nextPL = _paneList; // add new pane in at top - _paneList = newPane; - - if (add_pane->_paneType == P_Menu) // P_Menu is special - { - _menuPane = add_pane; - add_pane->initialize(this, (HWND)_menuBar); - HMENU popup = ::GetSubMenu(_menuBar,_WindowMenuIndex); // get 1st menu item - - if (popup) // add the window list - { -#ifdef VWIN16 - BOOL refresh = 0; -#else - BOOL refresh = 1; -#endif - FORWARD_WM_MDISETMENU(theApp->_Client, refresh, - (HMENU) _menuBar, popup, ::SendMessage); - } - - ::DrawMenuBar(theApp->_Frame); // Make it change - } - else - add_pane->initialize(this, _myHwnd); // add to _toplevel paneWidget - } - -//======================>>> vWindow::initialize <<<======================= - void vWindow::initialize(void) - { - // All top level windows in this frame are implemented - // as MDI child windows - - if (_numWindows > 0 && theApp->simSDI()) - return; - - MDICREATESTRUCT mdic; - - _menuBar = ::CreateMenu(); // Menu Bar - - mdic.szClass = "MdiWindowClass"; // Standard Windows setup - mdic.szTitle = _name; - mdic.hOwner = theApp->vHandle(); - mdic.x = mdic.y = CW_USEDEFAULT; - int fx = ::GetSystemMetrics(SM_CXFRAME); - int fy = ::GetSystemMetrics(SM_CYFRAME); - - int titley = ::GetSystemMetrics(SM_CYCAPTION); - - mdic.cx = _WinWidth+(2*fx); - mdic.cy = _WinHeight + (2*fy) + titley; - if (theApp->simSDI()) - mdic.style = WS_MAXIMIZE | WS_CHILD | WS_CLIPSIBLINGS - | WS_CLIPCHILDREN | WS_VISIBLE; - else - mdic.style = 0; - mdic.lParam = (LPARAM)this; // send this to PMdiWindowProc - - _myHwnd = (HWND)::SendMessage(theApp->_Client, - WM_MDICREATE,0, (long)(LPMDICREATESTRUCT) &mdic); - - // save a copy of this in the window structure - - ::SetWindowLong(_myHwnd, 0 , (long)this); - ::SetWindowText(_myHwnd, _name); - - ++_numWindows; // bump how many windows up - _cursor = ::LoadCursor(NULL, IDC_ARROW); - ::SetFocus(_myHwnd); - _createdOK = 1; - } - -//============================>>> vWindow::SetWinCursor <<<================== - void vWindow::SetWinCursor(VCursor vcursor) - { - - switch (vcursor) - { - case VC_None: - _cursor = ::LoadCursor(NULL, IDC_ARROW); - break; - case VC_Arrow: - _cursor = ::LoadCursor(NULL, IDC_ARROW); - break; - case VC_CenterArrow: - _cursor = ::LoadCursor(NULL, IDC_UPARROW); - break; - case VC_CrossHair: - _cursor = ::LoadCursor(NULL, IDC_CROSS); - break; - case VC_EWArrows: - _cursor = ::LoadCursor(NULL, IDC_SIZEWE); - break; - case VC_Hand: - _cursor = ::LoadCursor(NULL, IDC_ARROW); - break; - case VC_IBar: - _cursor = ::LoadCursor(NULL, IDC_IBEAM); - break; - case VC_Icon: - _cursor = ::LoadCursor(NULL, IDC_ICON); - break; - case VC_NSArrows: - _cursor = ::LoadCursor(NULL, IDC_SIZENS); - break; - case VC_Pencil: - _cursor = ::LoadCursor(NULL, IDC_ARROW); - break; - case VC_Question: - _cursor = ::LoadCursor(NULL, IDC_CROSS); - break; - case VC_Sizer: - _cursor = ::LoadCursor(NULL, IDC_SIZE); - break; - case VC_Wait: - _cursor = ::LoadCursor(NULL, IDC_WAIT); - break; - case VC_X: - _cursor = ::LoadCursor(NULL, IDC_ARROW); - break; - default: - _cursor = ::LoadCursor(NULL, IDC_ARROW); - break; - } - } - -//============================>>> vWindow::CloseWin <<<========================== - void vWindow::CloseWin(void) - { - // close button class callback - // - vWindow* w_list; - - // close base window, which cleans up some stuff - - SysDebug1(Build,"vWindow::CloseWin() - %s.\n",_name) - - closeBaseWindow(); // close this window - - --_numWindows; - // Remove from active list - - if (_WinList == this) // first one on list - { - _WinList = _WinList->_NextWin; // point to next - } - else - { - for (w_list = _WinList ; w_list != 0 ; w_list = w_list->_NextWin) - { - if (w_list->_NextWin == this) - { - // remove from list - w_list->_NextWin = (w_list->_NextWin)->_NextWin; - break; - } - } - } - - HWND hChild = FORWARD_WM_MDIGETACTIVE(theApp->_Client, ::SendMessage); // who caused this? - FORWARD_WM_MDIDESTROY(theApp->_Client, hChild, ::SendMessage); - } - -//======================>>> vWindow::ShowPane <<<======================= - void vWindow::ShowPane(vPane* wpane, int OnOrOff) VCONST - { - // Show or hide this pane - - // Search all panes until we find this one - for (PaneList* pl = _paneList ; pl != 0 ; pl = pl->nextPL) - { - if (pl->pane == wpane) - { - (pl->pane)->ShowPane(OnOrOff); // let each pane show hide - return; - } - } - return; - } - -//====================>>> vWindow::GetValue <<<====================== - int vWindow::GetValue(ItemVal id) VCONST - { - // scan all buttons in this window to retrieve the what value - - int retval = 0; // default to 0 - - // Search all panes until we find this id - for (PaneList* pl = _paneList ; pl != 0 ; pl = pl->nextPL) - { - if ((pl->pane)->GetPaneValue(id, retval)) - { - return retval; - } - } - - return 0; - } - -//====================>>> vWindow::GetTextIn <<<====================== - int vWindow::GetTextIn(ItemVal id, char* val, int maxlen) VCONST - { - // scan all buttons in this window to retrieve the what value - - int retval = 0; // default to 0 - - // Search all panes until we find this id - for (PaneList* pl = _paneList ; pl != 0 ; pl = pl->nextPL) - { - if ((pl->pane)->GetPaneTextIn(id, val, maxlen)) - { - return 1; - } - } - - return 0; - } - -//=========================>>> vWindow::KeyIn <<<========================== - void vWindow::KeyIn(vKey keysym, unsigned int shift) - { - // General interface to a keyboard event - - theApp->KeyIn(this, keysym, shift); // pass on unprocessed keys to app - } - -//=======================>>> vWindow::KeyInEV <<<========================== - void vWindow::KeyInEV(unsigned int keycode, int map, int /*extended*/) - { - // Local interface to a keyboard event - - unsigned int WinCodes[] = - { - VK_HOME, VK_LEFT, VK_UP, VK_RIGHT, VK_DOWN, - VK_PRIOR,VK_NEXT, VK_END, VK_INSERT, VK_DELETE, - - VK_F1, VK_F2, VK_F3, VK_F4, VK_F5, VK_F6, VK_F7, - VK_F8, VK_F9, VK_F10, VK_F11, VK_F12, VK_F13, - VK_F14, VK_F15, VK_F16, 0 - }; - unsigned int vCodes[] = - { - vk_Home, vk_Left, vk_Up, vk_Right, vk_Down, - vk_Page_Up, vk_Page_Down, vk_End, vk_Insert, vk_Delete, - - vk_F1, vk_F2,vk_F3, vk_F4, vk_F5, vk_F6, vk_F7, - vk_F8, vk_F9,vk_F10, vk_F11, vk_F12, vk_F13, - vk_F14, vk_F15, vk_F16, 0 - }; - - ItemVal id; - - vKey vkey; - int shift = 0; - - if (::GetKeyState(VK_SHIFT) < 0) - shift |= VKM_Shift; - if (::GetKeyState(VK_CONTROL) < 0) - shift |= VKM_Ctrl; - - if (!map) - vkey = keycode; - else - { - int ix; - for (ix = 0 ; WinCodes[ix] != 0 ; ++ix) - { - if (WinCodes[ix] == keycode) - { - vkey = vCodes[ix]; - break; - } - } - if (WinCodes[ix] == 0) // Ignore keys with no mapping - return; - } - - if (vkey == vk_Tab && (shift & VKM_Shift) != 0) - vkey = vk_BackTab; - else if (vkey < ' ') - shift &= VKM_Shift; // Kill VKM_Ctrl for real control chars - - // BEW: V:1.13 - if (_menuPane && ((vMenuPane*)_menuPane)->CheckAccel(vkey, shift, id)) - MenuCommand(id); - else - KeyIn(vkey,shift); // pass on to general code - } - -//======================>>> vWindow::MenuCommand <<<========================== - void vWindow::MenuCommand(ItemVal id) - { - // Menu Commands go through here first, then the regular WindowCommand - - WindowCommand(id, id, C_Menu); - } - -//==================>>> vWindow::SetValue <<<======================== - void vWindow::SetValue(ItemVal id, int val, ItemSetType setType) - { - // Set the given item on or off - for (PaneList* pl = /* w_list->*/ _paneList ; pl != 0 ; pl = pl->nextPL) - { - (pl->pane)->SetPaneValue(id, val, setType); - } - } - -//==================>>> vWindow::SetValueAll <<<======================== - void vWindow::SetValueAll(ItemVal id, int val, ItemSetType setType) - { - // Set the given item on or off in all windows - - - // search all windows to set all buttons - for (vWindow* w_list = _WinList ; w_list != 0 ; w_list = w_list->_NextWin) - { - // in each window, search each pane list - for (PaneList* pl = /* w_list->*/ _paneList ; pl != 0 ; pl = pl->nextPL) - { - (pl->pane)->SetPaneValue(id, val, setType); - } - } - } - -//================>>> vWindow::GetPosition <<<======================== - void vWindow::GetPosition(int& left, int& top, int& width, - int& height) VCONST - { - RECT rct; - RECT ar; - - ::GetWindowRect(_myHwnd, &rct); - ::GetWindowRect(theApp->winClientHwnd(), &ar); - - left = (rct.left >= ar.left) ? rct.left - ar.left : rct.left; - top = (rct.top >= ar.top) ? rct.top - ar.top : rct.top; - width = rct.right - rct.left; - height = rct.bottom - rct.top; - - } - -//================>>> vWindow::SetPosition <<<======================== - void vWindow::SetPosition(int left, int top) - { - (void)::SetWindowPos(_myHwnd,HWND_TOP,left,top,0,0,SWP_NOSIZE); - } - -//================>>> vWindow::RaiseWindow <<<======================== - void vWindow::RaiseWindow(void) - { - // raise this window to the top of all other windows - ::BringWindowToTop(_myHwnd); - } - -//================>>> vWindow::SetString <<<======================== - void vWindow::SetString(ItemVal id, VCONST char* str) - { - // search all buttons in this windows to set to correct value - - for (PaneList* pl = /* w_list->*/ _paneList ; pl != 0 ; pl = pl->nextPL) - { - (pl->pane)->SetPaneString(id, str); - } - } - -//================>>> vWindow::SetStringAll <<<======================== - void vWindow::SetStringAll(ItemVal id, VCONST char* str) - { - // search all buttons in all windows to set to correct value - - for (vWindow* w_list = _WinList ; w_list != 0 ; w_list = w_list->_NextWin) - { - // in each window, search each pane list - for (PaneList* pl = /* w_list->*/ _paneList ; pl != 0 ; pl = pl->nextPL) - { - (pl->pane)->SetPaneString(id, str); - } - } - } - -//======================>>> vWindow::SetTitle <<<========================== - void vWindow::SetTitle(VCONST char* title) - { - // set the title in the title bar - - ::SetWindowText(_myHwnd, title); - } - -//======================>>> vWindow::UpdateView <<<======================== - void vWindow::UpdateView(vWindow* sender, int hint, void* pHint) - { - // This is the overridable function called by the framwork to take - // action on changes which happened in the model (document). - // - // sender: Hint on which window caused the change in model - // hint: Enum defined in your derived app class. - // Hints about which kind of change is made, so that only - // appropriate action is taken on appropriate windows. - // pHint: This is normally a pointer to a object representing the - // document, or part of it. If the App has multiple open - // documents, and multiple views for each document, a - // typical use is to update only the views for the - // document, except the sender's. - } - -//======================>>> vWindow::WindowCommand <<<========================== - void vWindow::WindowCommand(ItemVal id, ItemVal retval, CmdType ctype) - { - - SysDebug1(CmdEvents,"vWindow::WindowCommand(id: %d)\n",id) - - theApp->AppCommand(this, id, retval, ctype); // Pass unprocessed cmds to app - } - -//===================>>> vWindow::MdiWindowProc <<<============================= - long vWindow::MdiWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) - { - - if (message == WM_SETFONT) - return 0; - else if (message == WM_INITDIALOG) - return TRUE; - - - switch (message) - { - case WM_ACTIVATE: - { - break; - } - - case WM_SETFOCUS: - { - if (theApp->ClipboardCheckText()) - theApp->SetValueAll(M_Paste,1,Sensitive); - else - theApp->SetValueAll(M_Paste,1,Sensitive); - if (_canvasPane) - _canvasPane->EnterEV(); - return 0; - } - - case WM_KILLFOCUS: - { - if (_canvasPane) - _canvasPane->LeaveEV(); - return 0; - } - - case WM_CREATE: - { - return 0; - } - - case WM_PAINT: - { - if (_canvasPane) - { - _canvasPane->ExposeEV(); - } - break; - } - case WM_ERASEBKGND: // when resized - { - return 1; - } - - case WM_SIZE: - { - - int width = LOWORD(lParam); - int height = HIWORD(lParam); - if (_canvasPane) - _canvasPane->ResizeEV(width,height); - break; // MUST also do default processing! - } - - case WM_RBUTTONDOWN: // Right mouse down - { - int x = (int)LOWORD(lParam); - int y = (int)HIWORD(lParam); - if (_canvasPane) - _canvasPane->MouseDown(x, y, 3); - return 0; - } - - case WM_RBUTTONUP: // Right mouse up - { - int x = (int)LOWORD(lParam); - int y = (int)HIWORD(lParam); - if (_canvasPane) - _canvasPane->MouseUp(x, y, 3); - return 0; - } - - case WM_RBUTTONDBLCLK: // Right double click - { - // int x = (int)LOWORD(lParam); - // int y = (int)HIWORD(lParam); - break; - } - - case WM_MBUTTONDOWN: // middle button - { - int x = (int)LOWORD(lParam); - int y = (int)HIWORD(lParam); - if (_canvasPane) - _canvasPane->MouseDown(x, y, 2); - return 0; - } - - case WM_MBUTTONUP: - { - int x = (int)LOWORD(lParam); - int y = (int)HIWORD(lParam); - if (_canvasPane) - _canvasPane->MouseUp(x, y, 2); - return 0; - } - - case WM_MBUTTONDBLCLK: - { - // int x = (int)LOWORD(lParam); - // int y = (int)HIWORD(lParam); - break; - } - - case WM_LBUTTONDOWN: // Left mouse down - { - // We want this to work like X. The first click in an MDI window - // without focus changes focus, AND sends the LBUTTONDOWN message. - // We don't want the focus message to go to the application, so - // this kludgy code prevents the focus click from heading to the - // canvas... - if (_justActivated && _prevWin != 0) - { - _justActivated = 0; - break; - } - int x = (int)LOWORD(lParam); - int y = (int)HIWORD(lParam); - _mouseDown = 1; - if (_canvasPane) - _canvasPane->MouseDown(x, y, 1); - return 0; - } - - case WM_LBUTTONUP: - { - int x = (int)LOWORD(lParam); - int y = (int)HIWORD(lParam); - if (_mouseDown && _canvasPane) - _canvasPane->MouseUp(x, y, 1); - _mouseDown = 0; - return 0; - } - - case WM_LBUTTONDBLCLK: - { - // int x = (int)LOWORD(lParam); - // int y = (int)HIWORD(lParam); - break; - } - - case WM_MOUSEMOVE: // Mouse move - { - int x = (int)LOWORD(lParam); - int y = (int)HIWORD(lParam); - ::SetCursor(_cursor); - int button = -1; - if (wParam & MK_LBUTTON) - { - if (_mouseDown) // can get a move if focus change - button = 1; - } - else if (wParam & MK_MBUTTON) - button = 2; - else if (wParam & MK_RBUTTON) - button = 3; - // To make this work like the X version, we don't want any mouse - // motion unless a button is down. - if (button < 0) - { - if (_canvasPane) - _canvasPane->MouseMotion(x,y); - else - break; - } - else if (_canvasPane) - _canvasPane->MouseMove(x, y, button); - return 0; - } - - case WM_DESTROY: - { - break; - } - - case WM_COMMAND: - { -#ifndef VWIN16 - WORD id = LOWORD(wParam); -// HWND hwnd = (HWND)lParam; -// WORD cmd = HIWORD(wParam); -#else - WORD id = wParam; -// HWND hwnd = (HWND)LOWORD(lParam) ; -// WORD cmd = HIWORD(lParam); -#endif - MenuCommand((ItemVal)id); - return 0; - } - - case WM_KEYDOWN: - { - if (wParam == VK_SHIFT || wParam == VK_CONTROL) - break; - // Handle only keystrokes that won't generate a WM_CHAR - else if ( (wParam <= VK_HELP && wParam != VK_CANCEL && - wParam != VK_ESCAPE && wParam != VK_SPACE && - wParam != VK_RETURN && wParam != VK_BACK && - wParam != VK_TAB) || - (wParam >= VK_F1 && wParam <= VK_F16) ) - { - KeyInEV((unsigned int)wParam, 1, 0); - return 0; - } - break; - } - - case WM_CHAR: // Always an ASCII character - { - KeyInEV((unsigned int)wParam, 0, (HIWORD(lParam) & KF_EXTENDED) != 0); - return 0; - } - - case WM_HSCROLL: - { - if (_canvasPane) - _canvasPane->HScrollEV(GET_WM_HSCROLL_CODE(wParam, lParam), - GET_WM_HSCROLL_POS(wParam, lParam), - GET_WM_HSCROLL_HWND (wParam, lParam)); - - return 0; - } - - case WM_VSCROLL: - { - - if (_canvasPane) - _canvasPane->VScrollEV(GET_WM_VSCROLL_CODE(wParam, lParam), - GET_WM_VSCROLL_POS(wParam, lParam), - GET_WM_VSCROLL_HWND (wParam, lParam)); - return 0; - } - - case WM_MDIACTIVATE: - { - // First, we have to change the main menu to ours - int activate; -#ifndef VWIN16 - /* This could be done with GET_WM_MDIACTIVATE_FACTIVATE, - but it doesn't seem to be in the windows 3.1 windowsx.h */ - activate = lParam == (LPARAM)hWnd; -#else - activate = wParam != 0; -#endif - - if (activate) // we are gaining focus! - { - if (theApp->InExit()) - break; - - HMENU popup = ::GetSubMenu(_menuBar,_WindowMenuIndex); // get 1st menu item - - - if (popup) // add the window list - { -#ifdef VWIN16 - BOOL refresh = 0; -#else - BOOL refresh = 1; -#endif - FORWARD_WM_MDISETMENU(theApp->_Client, refresh, - (HMENU) _menuBar, popup, ::SendMessage); - } - - _prevWin = _curWin; - _curWin = hWnd; - _justActivated = 1; - ::DrawMenuBar(theApp->_Frame); // Make menu change - theApp->selectCmdPanes(this); // Select our cmd bars - // now resize to be sure they are drawn. This only matters - // when the different child windows have different menus - // or menus set on or off - FORWARD_vWM_ResizeMDIClient(theApp->_Frame,SendMessage); - } - else // we are losing focus - { - HMENU appframe = theApp->AppFrameMenu(); - HMENU popup = GetSubMenu(appframe,0); -#ifdef VWIN16 - BOOL refresh = 0; -#else - BOOL refresh = 1; -#endif - FORWARD_WM_MDISETMENU(theApp->_Client, refresh, - appframe, popup, ::SendMessage); // Change to our menu - theApp->selectCmdPanes(this); // Need to select command bars - } - - return 0; - } - - case WM_DROPFILES: - { - break; - } - - case WM_QUERYENDSESSION: - { -// CloseWin(); - theApp->CloseAppWin(this); - return 0; - } - - case WM_CLOSE: - { -// CloseWin(); - theApp->CloseAppWin(this); - return 0; - } - - } - if (theApp->InExit()) return 0; // BEW: fix for 1.17 - return ::DefMDIChildProc(hWnd, message, wParam, lParam ); - } -//------------------------------------------------------------------------ diff --git a/v/srcwin/vwinprdc.cpp b/v/srcwin/vwinprdc.cpp deleted file mode 100644 index 9818129..0000000 --- a/v/srcwin/vwinprdc.cpp +++ /dev/null @@ -1,176 +0,0 @@ -//=============================================================== -// vWinPrinterC - a basic canvas for drawing -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - - -#include // for Win 32 stuff - -#include - - -#include -#include // need access to the app - -//----------------------------------------------------------------------- - -//================>>> vWinPrinterDC::vWinPrinterDC <<<======================== - vWinPrinterDC::vWinPrinterDC(const int scalePrinting) : vWinDC() - { - SysDebug(Constructor,"vWinPrinterDC::vWinPrinterDC() constructor\n") - - // _isPrinterDC is < 0 if we are scaling. For scaled printing, fonts - // get treated differently. If we aren't scaling, then we use the old - // default mode, which lets the GDI handle scaling. This is kind of - // messy, but it seemed the easiest way to patch things given that - // _isPrinterDC is really used by vWinDC. - - _isPrinterDC = scalePrinting ? -1 : 1; - _scalePrinting = scalePrinting; - } - -//================>>> vWinPrinterDC::~vWinPrinterDC <<<======================== - vWinPrinterDC::~vWinPrinterDC() - { - - SysDebug(Destructor,"vWinPrinterDC::~vWinPrinterDC() destructor\n") - - } - -//================>>> vWinPrinterDC::SetBackground <<<========================== - void vWinPrinterDC::SetBackground(VCONST vColor& color) - { - - _canvasBG = color.pixel(); // retrieve X pixel value - - GetHDC(); - ::SetBkColor(_hdc, _canvasBG); - ReleaseHDC(); - } - -//======================>>> vWinPrinterDC::SetFont <<<=========================== - void vWinPrinterDC::SetFont(VCONST vFont& vf) - { - // Change the font associated with this window. - - _font = vf; - } - -//================>>> vWinPrinterDC::BeginPrinting <<<======================== - int vWinPrinterDC::BeginPrinting() - { - - DOCINFO docinfo; - - if (!_printer.GetHDC()) // should not happen... - { - return 0; - } - - _pages = 0; - - docinfo.cbSize = sizeof(DOCINFO); // set this size... - docinfo.lpszDocName = "VPrintJob"; - docinfo.lpszOutput = 0; // no file output... -#ifndef VWIN16 - docinfo.lpszDatatype = 0; - docinfo.fwType = 0; -#endif - - if (::StartDoc(_printer.GetHDC(), &docinfo) <= 0) - { - DWORD retcode = ::GetLastError(); - return (retcode == 0); - } - - - BeginPage(); - - return 1; - - } - -//================>>> vWinPrinterDC::BeginPage <<<======================== - void vWinPrinterDC::BeginPage() - { - HDC pHDC = _printer.GetHDC(); - if (!pHDC) - return; - ++_pages; // bump number of pages so far - - ::StartPage(pHDC); - - // We will support two modes of printing - default and scaled. - // In scaled, it is up to the user to find the page size and scale - // things accordingly to make them fit. The fonts will be loaded differently - // depending on the mode. - - // The default mode produces output that closely matches the postscript - // printer output, but also scales line thickness, which can be bad! - // Scaled printing does not scale line thickness. - - if (!_scalePrinting) - { - int pixw = ::GetDeviceCaps(pHDC, HORZRES); - int pixh = ::GetDeviceCaps(pHDC, VERTRES); - // This scaling gives about the same proportions as the X version - int width = ::GetDeviceCaps(pHDC, HORZSIZE) * 3; - int height = ::GetDeviceCaps(pHDC,VERTSIZE) * 3; - - ::SetMapMode(pHDC, MM_ISOTROPIC); - ::SetWindowExt(pHDC,width,height); - ::SetViewportExt(pHDC,pixw,pixh); - } - else - { - ::SetMapMode(pHDC, MM_TEXT); - } - } - -//================>>> vWinPrinterDC::EndPage <<<======================== - void vWinPrinterDC::EndPage() - { - if (!_printer.GetHDC()) - return; - ::EndPage(_printer.GetHDC()); - } - -//================>>> vWinPrinterDC::EndPrinting <<<======================== - void vWinPrinterDC::EndPrinting() - { - if (!_printer.GetHDC()) - return; - - EndPage(); - - ::EndDoc(_printer.GetHDC()); - - } - -//=====================>>> vWinPrinterDC::SetPrinter <<<============================ - void vWinPrinterDC::SetPrinter(vPrinter& printer) - { - _printer = printer; - HDC pHDC = _printer.GetHDC(); - if (!pHDC) - return; - if (_scalePrinting) - { - _physHeight = ::GetDeviceCaps(pHDC, VERTRES); - _physWidth = ::GetDeviceCaps(pHDC, HORZRES); - } - else - { - _physHeight = _printer.GetHeight(); - _physWidth = _printer.GetWidth(); - } - - } - - diff --git a/v/srcwin/vwinprtr.cpp b/v/srcwin/vwinprtr.cpp deleted file mode 100644 index 9f6780b..0000000 --- a/v/srcwin/vwinprtr.cpp +++ /dev/null @@ -1,147 +0,0 @@ -//=============================================================== -// vwinprtr.cpp - Windows Printer class -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include -#include -#include - - - int vWinPrinter::_instances = 0; // reference counter for copy / assignment - -//================>>> vWinPrinter::vWinPrinter <<<======================== - vWinPrinter::vWinPrinter() - { - _name = 0; - _paperType = vPaperDefault; - _copies = 1; - _toFile = 1; - _width = 1; - _height = 1; - _portrait = 1; - _useColor = 0; - _printhDC = 0; - - ++_instances; // bump reference counter - } - -//================>>> vWinPrinter::vWinPrinter <<<======================== - vWinPrinter::vWinPrinter(const vWinPrinter& pr) - { - // copy constructor - _name = pr._name; - _width = pr._width; - _height = pr._height; - _portrait = pr._portrait; - _useColor = pr._useColor; - _paperType = pr._paperType; - _copies = pr._copies; - _toFile = pr._toFile; - _printhDC = pr._printhDC; - - ++_instances; // bump reference counter - } - -//================>>> vWinPrinter::= <<<======================== - vWinPrinter& vWinPrinter::operator =(const vWinPrinter& pr) - { - if (this == &pr) // to self? - return *this; - - if (_name) - delete [] _name; // free space before overwrite - - _name = pr._name; - _width = pr._width; - _height = pr._height; - _portrait = pr._portrait; - _useColor = pr._useColor; - _paperType = pr._paperType; - _copies = pr._copies; - _toFile = pr._toFile; - _printhDC = pr._printhDC; - - return *this; - } - -//================>>> vWinPrinter::~vWinPrinter <<<======================== - vWinPrinter::~vWinPrinter() - { - // We are using a reference count to track instances of printers. - // We want to allow the user to pass copies of the single printer - // around, but there should only be one name and one stream; - - --_instances; // not reference any more - - if (_instances > 0) - return; // don't do anything else - - if (_name) - delete [] _name; - - } - -//================>>> vWinPrinter::GetPaperName <<<======================== - char* vWinPrinter::GetPaperName() - { - if (_paperType == vPaperLetter) // we have (8.5x11) added... - return "Letter"; - else - return "Unknown"; - } - -//================>>> vWinPrinter::Setup <<<======================== - int vWinPrinter::Setup(VCONST char* fn) - { - // fn is an override default name - - PRINTDLG pd; - - if (_printhDC != 0) - return 0; - - pd.lStructSize = sizeof( PRINTDLG ); - pd.hwndOwner=NULL; - pd.hDevMode=(HANDLE)NULL; - pd.hDevNames=(HANDLE)NULL; - pd.Flags = PD_RETURNDC | PD_NOSELECTION | PD_NOPAGENUMS | - PD_HIDEPRINTTOFILE; - pd.nFromPage=0; - pd.nToPage=0; - pd.nMinPage=0; - pd.nMaxPage=0; - pd.nCopies=1; - pd.hInstance=(HINSTANCE)NULL; - pd.lCustData = (LPARAM)0; - pd.lpfnPrintHook = 0; - pd.lpfnSetupHook = 0; - pd.lpPrintTemplateName = (LPCSTR) 0; - pd.lpSetupTemplateName = (LPCSTR) 0; - pd.hPrintTemplate = (HGLOBAL)0; - pd.hSetupTemplate = (HGLOBAL)0; - if ( ::PrintDlg( &pd ) != 0 ) - { - int pixw, pixh; - _printhDC = pd.hDC; - pixw = ::GetDeviceCaps(_printhDC, HORZRES); - pixh = ::GetDeviceCaps(_printhDC, VERTRES); - // This scaling gives about the same proportions as the X version - _width = ::GetDeviceCaps(_printhDC, HORZSIZE) * 3; - _height = ::GetDeviceCaps(_printhDC,VERTSIZE) * 3; - -// ::SetMapMode(_printhDC, MM_ISOTROPIC); -// ::SetWindowExt(_printhDC,_width,_height); -// ::SetViewportExt(_printhDC,pixw,pixh); - } - - - return _printhDC != 0; - } diff --git a/v/srcwin/vynreply.cpp b/v/srcwin/vynreply.cpp deleted file mode 100644 index 3ef1ebc..0000000 --- a/v/srcwin/vynreply.cpp +++ /dev/null @@ -1,131 +0,0 @@ -//=============================================================== -// vynreply.cxx - vYNReplyDialog class functions - X11R5 -// -// Copyright (C) 1995,1996,1997,1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // for Win 32 stuff -#include // our header -#include -#include // for calc. of dialog position - TEH Dec97 - -// Define static data of the class - -#define prompt_width 32 -#define prompt_height 32 -static unsigned char prompt_bits[] = { - 0x01, 0x00, 0x00, 0x40, 0xf8, 0xff, 0xff, 0x9f, 0x05, 0x00, 0x00, 0x20, - 0xe4, 0xff, 0xff, 0xa7, 0x15, 0x00, 0x00, 0x28, 0x14, 0xc0, 0x01, 0xa8, - 0x15, 0xe0, 0x03, 0x28, 0x14, 0x30, 0x06, 0xa8, 0x15, 0x30, 0x06, 0x28, - 0x14, 0x00, 0x03, 0xa8, 0x15, 0x80, 0x01, 0x28, 0x14, 0xc0, 0x00, 0xa8, - 0x15, 0xc0, 0x00, 0x28, 0x14, 0xc0, 0x00, 0xa8, 0x15, 0xc0, 0x00, 0x28, - 0x14, 0x00, 0x00, 0xa8, 0x15, 0xc0, 0x00, 0x28, 0x14, 0x00, 0x00, 0xa8, - 0xe5, 0xff, 0xff, 0x27, 0x04, 0x00, 0x00, 0xa0, 0xf9, 0xff, 0xff, 0x1f, - 0xfe, 0xff, 0xff, 0x7f, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, - 0x02, 0x00, 0xe0, 0x47, 0x02, 0x00, 0x00, 0x40, 0xfa, 0xff, 0xff, 0x5f, - 0xae, 0xaa, 0xaa, 0x6a, 0x56, 0x55, 0x55, 0x55, 0xab, 0xaa, 0xaa, 0xea, - 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00}; - - static vIcon prompt(&prompt_bits[0], prompt_height, prompt_width); - // = - // { - // BitMap, prompt_height, prompt_width, 1, // type, h, w, depth - // (unsigned char*)&prompt_bits[0] - // }; - - CommandObject vYNReplyDialog::YNDialog[] = - { - // Modified: TEH 12/97 - // Changed "C_Label" to "C_Text" to allow for multiple line messages. - // Modified: TEH Jan98 - // Put icon + text in a frame so button is below frame. - // With many-line text displays, the button will always be below text. - // Also remove "Blanks" around buttons; not consistant with V look! - // Finally: made a member of vYNReplyDialog so is inheritable and - // modifiable (removed "static" modifier). - {C_Frame, 30, 0, "", - NoList, CA_NoSpace | CA_NoBorder, isSens, NoFrame, 0, 0}, - {C_Icon, 10, 0, "Pick?", - (void*)&prompt, CA_None, isSens, 30, 0, 0}, - {C_Text, 91, 0, "", - NoList, CA_MainMsg | CA_NoBorder, isSens, 30, 10, 0}, - - {C_Button, M_Yes, M_Yes, " Yes ", NoList, - CA_DefaultButton, isSens, NoFrame, 0, 30}, - {C_Button, M_No, M_No, " No ", - NoList, CA_None, isSens, NoFrame, M_Yes, 30}, - {C_Button, M_Cancel, M_Cancel, " Cancel ", NoList, - CA_None, isSens, NoFrame, M_No, 30}, - {C_EndOfList, 0, 0, 0, 0, CA_None, 0, 0, 0} - }; - - -//========================>>> vYNReplyDialog::AskYN <<<======================= - int vYNReplyDialog::AskYN(VCONST char* msg) - { - // Show a message, ask user Yes/No/Cancel - // returns < 0 for cancel, 0 for No, 1 for Yes - - int id, val; - - YNDialog[2].title = msg; // V:1.13 - if (!added) - { - AddDialogCmds(YNDialog); // Set up standard dialog - added = 1; - } - id = ShowModalDialog(msg, val); // show and wait - switch (id) // convert to our system - { - case M_Yes: - return 1; - - case M_No: - return 0; - - case M_Cancel: - return -1; - }; - return -1; - } - -//====================>>> vYNReplyDialog::DialogCommand <<<======================= - void vYNReplyDialog::DialogCommand(ItemVal id, ItemVal val, CmdType ctype) - { - vModalDialog::DialogCommand(id,val,ctype); - if (id == M_Yes || id == M_No) - CloseDialog(); - } - -// TEH Dec97 -// Added DialogDisplayed to handle the centering of the dialog in the app. -//====================>>> vYNReplyDialog::DialogDisplayed <<<======================= - void vYNReplyDialog::DialogDisplayed() - { - // center the dialog in the app window - RECT rctApp, rctDlg; // app and dialog corners - ::GetWindowRect(theApp->winHwnd(), &rctApp); - ::GetWindowRect(_wDialog, &rctDlg); - int widApp, htApp, widDlg, htDlg; // app and dialog dimensions - widApp = rctApp.right - rctApp.left; - htApp = rctApp.bottom - rctApp.top; - widDlg = rctDlg.right - rctDlg.left; - htDlg = rctDlg.bottom - rctDlg.top; - int left, top; // new dialog upper-left corner - if ( widApp > widDlg ) - left = /* rctApp.left */ (widApp - widDlg)/2; - else - left = rctApp.left; - if ( htApp > htDlg ) - top = /* rctApp.top + */ (htApp - htDlg)/2; - else - top = rctApp.top; - SetDialogPosition (left , top); // set the position - } - -// --------------------------------------------------------------------- diff --git a/v/srcx/Makefile b/v/srcx/Makefile deleted file mode 100644 index ea5c42c..0000000 --- a/v/srcx/Makefile +++ /dev/null @@ -1,436 +0,0 @@ -#=============================================================== -# V Libray Build Makefile - Version 1.25 - 22Sep00 -# -# Copyright (C) 1995-1999 Bruce E. Wampler -# -# This file is part of the V C++ GUI Framework, and is covered -# under the terms of the GNU Library General Public License, -# Version 2. This library has NO WARRANTY. See the source file -# vapp.cxx for more complete information about license terms. -#=============================================================== -# -# Available targets: -# -# default : vlib -# vlib : builds V library -# clean : removes backup stuff -# -#=============================================================== - -CONFIG = ../Config.mk -include $(CONFIG) - -#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -# -# fix library name and C/C++ compile options for the library build -# -#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - -ifeq ($(TOOLKIT),Athena) -ifeq ($(USE_3D),no) - CFLAGS += -DNO_V_3D -endif -endif - -#Added -fpermissive for gcc 4 -ifeq ($(Arch),linuxelf) - CXFLAGSLIB = -fpic -fpermissive -Wno-deprecated -Wno-write-strings $(CFLAGS) - CCFLAGSLIB = -fpic $(CFLAGS) -else - CXFLAGSLIB = -fpermissive -Wno-deprecated -Wno-write-strings $(CFLAGS) - CCFLAGSLIB = $(CFLAGS) -endif - - -#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -# -# Object and header file lists -# -#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - -LibGLObjs =\ - $(oDir)/vbglcnv.o \ - -LibObjs =\ - $(oDir)/vapp.o \ - $(oDir)/vawinfo.o \ - $(oDir)/vbaseitm.o \ - $(oDir)/vbasewin.o \ - $(oDir)/vbtncmd.o \ - $(oDir)/vcanvas.o \ - $(oDir)/canvas.o \ - $(oDir)/vcbtncmd.o \ - $(oDir)/vchkboxc.o \ - $(oDir)/vclabelc.o \ - $(oDir)/vcmd.o \ - $(oDir)/vcmdpane.o \ - $(oDir)/vcmdwin.o \ - $(oDir)/vcmdprnt.o \ - $(oDir)/vcolor.o \ - $(oDir)/vcomboc.o \ - $(oDir)/vcpdc.o \ - $(oDir)/vdebug.o \ - $(oDir)/vdialog.o \ - $(oDir)/vfilesel.o \ - $(oDir)/vfinddlg.o \ - $(oDir)/vfont.o \ - $(oDir)/vfontsel.o \ - $(oDir)/vframec.o \ - $(oDir)/vicon.o \ - $(oDir)/vlabelc.o \ - $(oDir)/vlistc.o \ - $(oDir)/vmemdc.o \ - $(oDir)/vmenu.o \ - $(oDir)/vmodald.o \ - $(oDir)/vnotice.o \ - $(oDir)/vos.o \ - $(oDir)/vpopmenu.o \ - $(oDir)/vpsprntr.o \ - $(oDir)/vprogrsc.o \ - $(oDir)/vpsdc.o \ - $(oDir)/vradioc.o \ - $(oDir)/vreply.o \ - $(oDir)/vrepldlg.o \ - $(oDir)/vsliderc.o \ - $(oDir)/vslist.o \ - $(oDir)/vspinc.o \ - $(oDir)/vstartup.o \ - $(oDir)/vstatusp.o \ - $(oDir)/vtextc.o \ - $(oDir)/vtextcnv.o \ - $(oDir)/vtexted.o \ - $(oDir)/vtextinc.o \ - $(oDir)/vtimer.o \ - $(oDir)/vtipwin.o \ - $(oDir)/vutil.o \ - $(oDir)/vwindow.o \ - $(oDir)/vxdc.o \ - $(oDir)/vx2vkey.o \ - $(oDir)/vynreply.o - -# Sorry, we MUST at least use the V versions of the 3D scroll bar and 3D slider -ifeq ($(USE_3D),no) -Lib3dObjs=\ - $(oDir)/aw3d.o \ - $(oDir)/awsim3d.o \ - $(oDir)/awscl3d.o \ - $(oDir)/awsld3d.o -endif - -ifeq ($(USE_3D),yes) -Lib3dObjs=\ - $(oDir)/aw3d.o \ - $(oDir)/awcmd3d.o \ - $(oDir)/awlbl3d.o \ - $(oDir)/awscl3d.o \ - $(oDir)/awsld3d.o \ - $(oDir)/awsim3d.o \ - $(oDir)/awtog3d.o -endif - -BASEDEP =\ - v_defs.h vbaseitm.h vbasewin.h vapp.h - -PANEDEP =\ - vpane.h vwindow.h - -CMDDEP =\ - v_defs.h vdialog.h vcmd.h vcmdprnt.h vxutil.h - -CMDS =\ - vbtncmd.h vcbtncmd.h vlabelc.h vframec.h vchkboxc.h vradioc.h \ - vprogrsc.h vsliderc.h vtextinc.h vlistc.h vcomboc.h vtextc.h \ - vcolor.h vpen.h vclabelc.h vspinc.h - -# cd iconed ; $(MAKE) ARCH=$@ ; cd .. - - -#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -# -# targets -# -#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - -.PHONY: default -#default: vlib vlibgl -default: vlib - -.PHONY: clean -clean: - -rm -f $(CLEANEXTS) - - -#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -# -# target for building the v library -# -#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - -.PHONY: vlibgl - -ifeq ($(Arch),linuxelf) -vlibgl: $(oDir) $(LibDir) $(LibDir)/$(LIBNAME)gl.so.$(VV) - -$(LibDir)/$(LIBNAME)gl.so.$(VV): $(LibGLObjs) - -rm -f $(LibDir)/$(LIBNAME)gl.so.$(VV) - -$(CXX) -shared -Wl,-soname,$(LIBNAME)gl.so.$(VV) \ - -o $(LibDir)/$(LIBNAME)gl.so.$(VV) $(LibGLObjs) - -(cd $(VLibDir); \ - -rm -f $(LIBNAME)gl.so; \ - -ln -s $(LIBNAME)gl.so.$(VV) $(LIBNAME).so) -else -vlibgl: $(LibDir)/$(LIBNAME)gl.a - -$(LibDir)/$(LIBNAME)gl.a: $(LibGLObjs) - -rm -f $(LibDir)/$(LIBNAME)gl.a - -$(AR) cr $(LibDir)/$(LIBNAME)gl.a $(LibGLObjs) - -$(RANLIB) $(LibDir)/$(LIBNAME)gl.a - -chmod 644 $(LibDir)/$(LIBNAME)gl.a -endif - -.PHONY: vlib - -ifeq ($(Arch),linuxelf) -vlib: $(oDir) $(LibDir) $(LibDir)/$(LIBNAME).so.$(VV) - -$(LibDir)/$(LIBNAME).so.$(VV): $(LibObjs) $(Lib3dObjs) - rm -f $(LibDir)/$(LIBNAME).so.$(VV) - $(CXX) -shared -Wl,-soname,$(LIBNAME).so.$(VV) \ - -o $(LibDir)/$(LIBNAME).so.$(VV) $(LibObjs) $(Lib3dObjs) - (cd $(VLibDir); \ - rm -f $(LIBNAME).so; \ - ln -s $(LIBNAME).so.$(VV) $(LIBNAME).so) -else -vlib: $(LibDir)/$(LIBNAME).a - -$(LibDir)/$(LIBNAME).a: $(LibObjs) $(Lib3dObjs) - rm -f $(LibDir)/$(LIBNAME).a - $(AR) cr $(LibDir)/$(LIBNAME).a $(LibObjs) $(Lib3dObjs) - $(RANLIB) $(LibDir)/$(LIBNAME).a - chmod 644 $(LibDir)/$(LIBNAME).a -endif - - -#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -# -# .o's for the library -# -# note: $@ gives target ($(oDir)/xx.o, -# $< gives first dependency (xx.cxx) -# $(CXX) -c $(CFLAGS) -o $@ $< -# -#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - -$(oDir)/vapp.o: vapp.cxx $(BASEDEP) vfont.h vawinfo.h vcmdwin.h vctlclrs.h - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vawinfo.o: vawinfo.cxx $(BASEDEP) vawinfo.h - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vbaseitm.o: vbaseitm.cxx vbaseitm.h v_defs.h - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vbasewin.o: vbasewin.cxx $(BASEDEP) - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vbglcnv.o: vbglcnv.cxx vbglcnv.h $(BASEDEP) $(PANEDEP) - -$(CXX) -c $(CXFLAGSLIB) -o $@ $< - @echo "************************************************************************************" - @echo "* PLEASE NOTE: To get OpenGL support for vbglcnv.cxx, you must have OpenGL or MESA *" - @echo "* installed. You may safely ignore the above errors if you don't have OpenGL. *" - @echo "************************************************************************************" - -$(oDir)/vbtncmd.o: vbtncmd.cxx vbtncmd.h vctlclrs.h awtog3d.h vicon.h $(CMDDEP) - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vcanvas.o: vcanvas.cxx vcanvas.h vfont.h vcpdc.h vbrush.h \ - vpen.h $(BASEDEP) $(PANEDEP) vctlclrs.h - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/canvas.o: canvas.c canvas.h canvasp.h - $(CC) -c $(CCFLAGSLIB) -o $@ $< - -$(oDir)/vcbtncmd.o: vcbtncmd.cxx vcbtncmd.h $(CMDDEP) - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vchkboxc.o: vchkboxc.cxx vchkboxc.h vctlclrs.h vicon.h $(CMDDEP) - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vclabelc.o: vclabelc.cxx vclabelc.h vicon.h $(CMDDEP) - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vcmd.o: vcmd.cxx vcmd.h $(BASEDEP) $(PANEDEP) - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vcmdpane.o: vcmdpane.cxx vcmdpane.h $(BASEDEP) $(PANEDEP) vctlclrs.h - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vcmdwin.o: vcmdwin.cxx $(BASEDEP) vwindow.h vpane.h \ - vcmdwin.h - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vcmdprnt.o: vcmdprnt.cxx $(BASEDEP) vcmdprnt.h $(CMDS) - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vcomboc.o: vcomboc.cxx vcomboc.h vctlclrs.h $(CMDDEP) - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vcolor.o: vcolor.cxx vcolor.h $(CMDDEP) - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vdebug.o: vdebug.cxx vdebug.h $(BASEDEP) vcmdprnt.h \ - vmodald.h - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vdialog.o: vdialog.cxx vdialog.h $(BASEDEP) vcmdprnt.h vctlclrs.h - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vcpdc.o: vcpdc.cxx vxdc.h vdc.h vcpdc.h vpen.h vpen.h canvas.h $(BASEDEP) - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vpsdc.o: vpsdc.cxx vdc.h vpsdc.h vprinter.h vpsprntr.h $(BASEDEP) - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vfilesel.o: vfilesel.cxx vfilesel.h $(BASEDEP) vcmdprnt.h \ - vmodald.h - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vfinddlg.o: vfinddlg.cpp vfinddlg.h $(BASEDEP) vcmdprnt.h \ - vmodald.h - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vfontsel.o: vfontsel.cxx vfontsel.h vfont.h $(BASEDEP) vcmdprnt.h \ - vmodald.h - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vfont.o: vfont.cxx vfont.h vfontlst.h $(BASEDEP) - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vframec.o: vframec.cxx vframec.h $(CMDDEP) vctlclrs.h - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vicon.o: vicon.cxx vicon.h $(CMDDEP) - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vlabelc.o: vlabelc.cxx vlabelc.h $(CMDDEP) vctlclrs.h vicon.h - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vlistc.o: vlistc.cxx vlistc.h $(CMDDEP) vctlclrs.h - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vslist.o: vslist.cpp vslist.h - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vmemdc.o: vmemdc.cxx vmemdc.h vxdc.h vdc.h vmemdc.h vpen.h vpen.h canvas.h $(BASEDEP) - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vmenu.o: vmenu.cxx vmenu.h $(BASEDEP) $(PANEDEP) vcmdwin.h vctlclrs.h - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vmodald.o: vmodald.cxx vmodald.h vdialog.h \ - $(BASEDEP) vcmdprnt.h - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vnotice.o: vnotice.cxx vnotice.h $(BASEDEP) vcmdprnt.h \ - vmodald.h - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vos.o: vos.cxx vos.h - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vpopmenu.o: vpopmenu.cxx vpopmenu.h $(BASEDEP) $(PANEDEP) vcmdwin.h - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vprogrsc.o: vprogrsc.cxx vprogrsc.h $(CMDDEP) awsld3d.h - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vpsprntr.o: vpsprntr.cxx vpsprntr.h vprinter.h $(BASEDEP) - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vradioc.o: vradioc.cxx vradioc.h vctlclrs.h vicon.h $(CMDDEP) - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vsliderc.o: vsliderc.cxx vsliderc.h $(CMDDEP) awsld3d.h vctlclrs.h - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vrepldlg.o: vrepldlg.cpp vrepldlg.h $(BASEDEP) vcmdprnt.h \ - vmodald.h - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vreply.o: vreply.cxx vreply.h $(BASEDEP) vcmdprnt.h \ - vmodald.h - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vspinc.o: vspinc.cxx vspinc.h vctlclrs.h $(CMDDEP) - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vstartup.o: vstartup.cxx vapp.h - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vstatusp.o: vstatusp.cxx vstatusp.h $(BASEDEP) $(PANEDEP) vctlclrs.h - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vtextc.o: vtextc.cxx vtextc.h $(CMDDEP) vctlclrs.h - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vtextcnv.o: vtextcnv.cxx vtextcnv.h vcanvas.h vcpdc.h \ - $(BASEDEP) $(PANEDEP) - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vtexted.o: ../srcwin/vtexted.cpp ../includew/v/vtexted.h vtextcnv.h vcanvas.h vcpdc.h \ - $(BASEDEP) $(PANEDEP) - $(CXX) -c $(CXFLAGSLIB) -I../includew/v -o $@ $< - -$(oDir)/vtextinc.o: vtextinc.cxx vtextinc.h $(CMDDEP) - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vtimer.o: vtimer.cxx vtimer.h vapp.h - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vtipwin.o: vtipwin.cxx vtipwin.h vapp.h - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vutil.o: vutil.cxx vutil.h - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vwindow.o: vwindow.cxx $(BASEDEP) vwindow.h vpane.h \ - vx2vkey.h vctlclrs.h - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vxdc.o: vxdc.cxx vxdc.h vdc.h vpen.h vpen.h canvas.h vicon.h $(BASEDEP) - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vx2vkey.o: vx2vkey.cxx vx2vkey.h v_defs.h - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - -$(oDir)/vynreply.o: vynreply.cxx vynreply.h $(BASEDEP) vcmdprnt.h \ - vmodald.h - $(CXX) -c $(CXFLAGSLIB) -o $@ $< - - -#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -# -# .o's for the 3d Library -# -#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - -$(oDir)/aw3d.o: aw3d.c aw3d.h aw3dp.h vctlclrs.h - $(CC) -c $(CCFLAGSLIB) -DUSEGRAY -o $@ $< - -$(oDir)/awcmd3d.o: awcmd3d.c awcmd3d.h awcmd3dp.h - $(CC) -c $(CCFLAGSLIB) -o $@ $< - -$(oDir)/awscl3d.o: awscl3d.c awscl3d.h awscl3dp.h - $(CC) -c $(CCFLAGSLIB) -o $@ $< - -$(oDir)/awsld3d.o: awsld3d.c awsld3d.h awsld3dp.h - $(CC) -c $(CCFLAGSLIB) -o $@ $< - -$(oDir)/awlbl3d.o: awlbl3d.c awlbl3d.h awlbl3dp.h - $(CC) -c $(CCFLAGSLIB) -o $@ $< - -$(oDir)/awsim3d.o: awsim3d.c awsim3d.h awsim3dp.h - $(CC) -c $(CCFLAGSLIB) -o $@ $< - -$(oDir)/awtog3d.o: awtog3d.c awtog3d.h awtog3dp.h - $(CC) -c $(CCFLAGSLIB) -o $@ $< diff --git a/v/srcx/aw3d.c b/v/srcx/aw3d.c deleted file mode 100644 index a3f3247..0000000 --- a/v/srcx/aw3d.c +++ /dev/null @@ -1,661 +0,0 @@ -/* -* $KK: ThreeD.c,v 0.3 92/11/04 xx:xx:xx keithley Exp $ -*/ - -/*********************************************************** -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, -and the Massachusetts Institute of Technology, Cambridge, Massachusetts. -Copyright 1992 by Kaleb Keithley - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the names of Digital, MIT, or Kaleb -Keithley not be used in advertising or publicity pertaining to distribution -of the software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ -/****************************************************************** -This code was taken directly from the Xaw3d distribution. -Several classes were used to make V look better. -The names of the classes have been changed to allow -standard Athena widgets to be used as well. - -I've not marked any of the changes specifically. -I hate to do this, but I included the contents of -directly because of C++ vs C problems. - -Bruce Wampler - March 1, 1996 -******************************************************************/ - - -#include -#include -#include -#include -#include - -#define VSHADOWS -/* -#ifdef VSHADOWS -#include -#endif -*/ - extern Pixel _vStatusBarBG; /* Background of status bar */ - extern Pixel _vDialogBG; /* Background for dialogs/command bar */ - extern Pixel _vMenuBarBG; /* Background for MenuBar */ - extern Pixel _vControlBG; /* Background for Controls */ - extern Pixel _vControlFace; /* Face of controls */ - extern Pixel _vLightControlShadow; /* light control shadow */ - extern Pixel _vDarkControlShadow; /* dark control shadow */ - -/* Initialization of defaults */ - -#define XtNtopShadowPixmap "topShadowPixmap" -#define XtCTopShadowPixmap "TopShadowPixmap" -#define XtNbottomShadowPixmap "bottomShadowPixmap" -#define XtCBottomShadowPixmap "BottomShadowPixmap" - -#define offset(field) XtOffsetOf(ThreeDRec, field) - -static XtResource resources[] = { - {XtNshadowWidth, XtCShadowWidth, XtRDimension, sizeof(Dimension), - offset(threeD.shadow_width), XtRImmediate, (XtPointer) 2}, - {XtNtopShadowPixel, XtCTopShadowPixel, XtRPixel, sizeof(Pixel), - offset(threeD.top_shadow_pixel), XtRString, XtDefaultForeground}, - {XtNbottomShadowPixel, XtCBottomShadowPixel, XtRPixel, sizeof(Pixel), - offset(threeD.bot_shadow_pixel), XtRString, XtDefaultForeground}, - {XtNtopShadowPixmap, XtCTopShadowPixmap, XtRPixmap, sizeof(Pixmap), - offset(threeD.top_shadow_pxmap), XtRImmediate, (XtPointer) NULL}, - {XtNbottomShadowPixmap, XtCBottomShadowPixmap, XtRPixmap, sizeof(Pixmap), - offset(threeD.bot_shadow_pxmap), XtRImmediate, (XtPointer) NULL}, - {XtNtopShadowContrast, XtCTopShadowContrast, XtRInt, sizeof(int), - offset(threeD.top_shadow_contrast), XtRImmediate, (XtPointer) 20}, - {XtNbottomShadowContrast, XtCBottomShadowContrast, XtRInt, sizeof(int), - offset(threeD.bot_shadow_contrast), XtRImmediate, (XtPointer) 40}, - {XtNuserData, XtCUserData, XtRPointer, sizeof(XtPointer), - offset(threeD.user_data), XtRPointer, (XtPointer) NULL}, - {XtNbeNiceToColormap, XtCBeNiceToColormap, XtRBoolean, sizeof(Boolean), - offset(threeD.be_nice_to_cmap), XtRImmediate, (XtPointer) False}, - {XtNborderWidth, XtCBorderWidth, XtRDimension, sizeof(Dimension), - XtOffsetOf(RectObjRec,rectangle.border_width), XtRImmediate, - (XtPointer)0}, - {XtNinvertBorder, XtCInvertBorder, XtRBoolean, sizeof(Boolean), - offset(threeD.invert_border), XtRImmediate, (XtPointer) False}, -}; - -#undef offset - -static void ClassPartInitialize(), Initialize(), Destroy(); -static void Redisplay(), Realize(); -static void _Xaw3dDrawShadows(), _Xaw3dDrawShadowSurroundedBox(); -static Boolean SetValues(); - -ThreeDClassRec threeDClassRec = { - { /* core fields */ - /* superclass */ (WidgetClass) &simple3dClassRec, - /* class_name */ "ThreeD", - /* widget_size */ sizeof(ThreeDRec), - /* class_initialize */ NULL, - /* class_part_initialize */ ClassPartInitialize, - /* class_inited */ FALSE, - /* initialize */ Initialize, - /* initialize_hook */ NULL, - /* realize */ Realize, - /* actions */ NULL, - /* num_actions */ 0, - /* resources */ resources, - /* resource_count */ XtNumber(resources), - /* xrm_class */ NULLQUARK, - /* compress_motion */ TRUE, - /* compress_exposure */ TRUE, - /* compress_enterleave */ TRUE, - /* visible_interest */ FALSE, - /* destroy */ Destroy, - /* resize */ XtInheritResize, - /* expose */ Redisplay, - /* set_values */ SetValues, - /* set_values_hook */ NULL, - /* set_values_almost */ XtInheritSetValuesAlmost, - /* get_values_hook */ NULL, - /* accept_focus */ NULL, - /* version */ XtVersion, - /* callback_private */ NULL, - /* tm_table */ NULL, - /* query_geometry */ XtInheritQueryGeometry, - /* display_accelerator */ XtInheritDisplayAccelerator, - /* extension */ NULL - }, - { /* simple fields */ - /* change_sensitive */ XtInheritChangeSensitive - }, - { /* threeD fields */ - /* shadowdraw */ _Xaw3dDrawShadows - } -}; - -WidgetClass threeDWidgetClass = (WidgetClass) &threeDClassRec; - -/**************************************************************** - * - * Private Procedures - * - ****************************************************************/ - -#define mbshadowpm_width 3 -#define mbshadowpm_height 3 -static unsigned char mbshadowpm_bits[] = { - 0xFF,0xFF,0xFF}; -/* 0x05, 0x03, 0x06}; */ -#define mtshadowpm_width 3 -#define mtshadowpm_height 3 -static char mtshadowpm_bits[] = { - 0x02, 0x04, 0x01}; -#define shadowpm_width 2 -#define shadowpm_height 2 -static char shadowpm_bits[] = { - 0x02, 0x01}; - -#ifdef USEGRAY -static XColor Gray = { - /* pixel */ 0, - /* red, green, blue */ 0,0,0, - /* flags */ 0, - /* pad */ 0 -}; -#define ALLOCGRAY { XColor exact; \ - (void) XAllocNamedColor(dpy, DefaultColormapOfScreen (scn), \ - "gray", &Gray,&exact);} /* Blindflug */ -#endif - - -/* ARGSUSED */ -static void AllocTopShadowGC (w) - Widget w; -{ - ThreeDWidget tdw = (ThreeDWidget) w; - Screen *scn = XtScreen (w); - XtGCMask valuemask; - XGCValues myXGCV; - - if (tdw->threeD.be_nice_to_cmap || DefaultDepthOfScreen (scn) == 1) { - valuemask = GCTile | GCFillStyle; - myXGCV.tile = tdw->threeD.top_shadow_pxmap; - myXGCV.fill_style = FillTiled; - } else { - valuemask = GCForeground; - myXGCV.foreground = tdw->threeD.top_shadow_pixel; - } - tdw->threeD.top_shadow_GC = XtGetGC(w, valuemask, &myXGCV); -} - -/* ARGSUSED */ -static void AllocBotShadowGC (w) - Widget w; -{ - ThreeDWidget tdw = (ThreeDWidget) w; - Screen *scn = XtScreen (w); - XtGCMask valuemask; - XGCValues myXGCV; - - if (tdw->threeD.be_nice_to_cmap || DefaultDepthOfScreen (scn) == 1) { - valuemask = GCTile | GCFillStyle; - myXGCV.tile = tdw->threeD.bot_shadow_pxmap; - myXGCV.fill_style = FillTiled; - } else { - valuemask = GCForeground; - myXGCV.foreground = tdw->threeD.bot_shadow_pixel; - } - tdw->threeD.bot_shadow_GC = XtGetGC(w, valuemask, &myXGCV); -} - -/* ARGSUSED */ -static void AllocTopShadowPixmap (new) - Widget new; -{ - ThreeDWidget tdw = (ThreeDWidget) new; - Display *dpy = XtDisplay (new); - Screen *scn = XtScreen (new); - unsigned long top_fg_pixel = 0, top_bg_pixel = 0; - char *pm_data = NULL; - Boolean create_pixmap = FALSE; - unsigned int pixmapSize = shadowpm_width; - - /* - * I know, we're going to create two pixmaps for each and every - * shadow'd widget. Yeuck. I'm semi-relying on server side - * pixmap cacheing. - */ - - if (DefaultDepthOfScreen (scn) == 1) - { - top_fg_pixel = BlackPixelOfScreen (scn); - top_bg_pixel = WhitePixelOfScreen (scn); - pm_data = (char*)mtshadowpm_bits; - create_pixmap = TRUE; - } - - if (create_pixmap) - tdw->threeD.top_shadow_pxmap = XCreatePixmapFromBitmapData (dpy, - RootWindowOfScreen (scn), - pm_data, - pixmapSize, - pixmapSize, - top_fg_pixel, - top_bg_pixel, - DefaultDepthOfScreen (scn)); - } - -/* ARGSUSED */ -static void AllocBotShadowPixmap (new) - Widget new; -{ - ThreeDWidget tdw = (ThreeDWidget) new; - Display *dpy = XtDisplay (new); - Screen *scn = XtScreen (new); - unsigned long bot_fg_pixel = 0, bot_bg_pixel = 0; - char *pm_data = NULL; - Boolean create_pixmap = FALSE; - unsigned int pixmapSize = shadowpm_width; - - if (DefaultDepthOfScreen (scn) == 1) { - bot_fg_pixel = BlackPixelOfScreen (scn); - bot_bg_pixel = WhitePixelOfScreen (scn); - pm_data = (char*)mbshadowpm_bits; - create_pixmap = TRUE; - } - if (create_pixmap) - tdw->threeD.bot_shadow_pxmap = XCreatePixmapFromBitmapData (dpy, - RootWindowOfScreen (scn), - pm_data, - pixmapSize, - pixmapSize, - bot_fg_pixel, - bot_bg_pixel, - DefaultDepthOfScreen (scn)); -} - -#ifndef VSHADOWS -/* ARGSUSED */ -void Xaw3dComputeTopShadowRGB (new, xcol_out) - Widget new; - XColor *xcol_out; -{ - if (XtIsSubclass (new, threeDWidgetClass)) { - ThreeDWidget tdw = (ThreeDWidget) new; - XColor get_c; - double contrast; - Display *dpy = XtDisplay (new); - Screen *scn = XtScreen (new); - Colormap cmap = DefaultColormapOfScreen (scn); - - get_c.pixel = tdw->core.background_pixel; - if (get_c.pixel == WhitePixelOfScreen (scn) || - get_c.pixel == BlackPixelOfScreen (scn)) { - contrast = (100 - tdw->threeD.top_shadow_contrast) / 100.0; - xcol_out->red = contrast * 65535.0; - xcol_out->green = contrast * 65535.0; - xcol_out->blue = contrast * 65535.0; - } else { - contrast = 1.0 + tdw->threeD.top_shadow_contrast / 100.0; - XQueryColor (dpy, cmap, &get_c); -#define MIN(x,y) (unsigned short) (x < y) ? x : y - xcol_out->red = MIN (65535, (int) (contrast * (double) get_c.red)); - xcol_out->green = MIN (65535, (int) (contrast * (double) get_c.green)); - xcol_out->blue = MIN (65535, (int) (contrast * (double) get_c.blue)); -#undef MIN - } - } else - xcol_out->red = xcol_out->green = xcol_out->blue = 0; -} -#endif - -/* ARGSUSED */ -static void AllocTopShadowPixel (new) - Widget new; -{ - XColor set_c; - ThreeDWidget tdw = (ThreeDWidget) new; - -#ifdef VSHADOWS - tdw->threeD.top_shadow_pixel = _vLightControlShadow; -#else - - Display *dpy = XtDisplay (new); - Screen *scn = XtScreen (new); - Colormap cmap = DefaultColormapOfScreen (scn); - - Xaw3dComputeTopShadowRGB (new, &set_c); - (void) XAllocColor (dpy, cmap, &set_c); - tdw->threeD.top_shadow_pixel = set_c.pixel; -#endif -} - -/* ARGSUSED */ -#ifndef VSHADOWS -void Xaw3dComputeBottomShadowRGB (new, xcol_out) - Widget new; - XColor *xcol_out; -{ - if (XtIsSubclass (new, threeDWidgetClass)) { - ThreeDWidget tdw = (ThreeDWidget) new; - XColor get_c; - double contrast; - Display *dpy = XtDisplay (new); - Screen *scn = XtScreen (new); - Colormap cmap = DefaultColormapOfScreen (scn); - - get_c.pixel = tdw->core.background_pixel; - if (get_c.pixel == WhitePixelOfScreen (scn) || - get_c.pixel == BlackPixelOfScreen (scn)) { - contrast = tdw->threeD.bot_shadow_contrast / 100.0; - xcol_out->red = contrast * 65535.0; - xcol_out->green = contrast * 65535.0; - xcol_out->blue = contrast * 65535.0; - } else { - XQueryColor (dpy, cmap, &get_c); - contrast = (100 - tdw->threeD.bot_shadow_contrast) / 100.0; - xcol_out->red = contrast * get_c.red; - xcol_out->green = contrast * get_c.green; - xcol_out->blue = contrast * get_c.blue; - } - } else - xcol_out->red = xcol_out->green = xcol_out->blue = 0; -} -#endif - -/* ARGSUSED */ -static void AllocBotShadowPixel (new) - Widget new; -{ - XColor set_c; - ThreeDWidget tdw = (ThreeDWidget) new; - -#ifdef VSHADOWS - tdw->threeD.bot_shadow_pixel = _vDarkControlShadow; -#else - Display *dpy = XtDisplay (new); - Screen *scn = XtScreen (new); - Colormap cmap = DefaultColormapOfScreen (scn); - - Xaw3dComputeBottomShadowRGB (new, &set_c); - (void) XAllocColor (dpy, cmap, &set_c); - tdw->threeD.bot_shadow_pixel = set_c.pixel; -#endif -} - - -/* ARGSUSED */ -static void ClassPartInitialize (wc) - WidgetClass wc; - -{ - ThreeDClassRec *tdwc = (ThreeDClassRec*) wc; - ThreeDClassRec *super = (ThreeDClassRec*) tdwc->core_class.superclass; - - if (tdwc->threeD_class.shadowdraw == XtInheritXaw3dShadowDraw) - tdwc->threeD_class.shadowdraw = super->threeD_class.shadowdraw; -} - - -/* ARGSUSED */ -static void Initialize (request, new, args, num_args) - Widget request, new; - ArgList args; - Cardinal *num_args; -{ - ThreeDWidget tdw = (ThreeDWidget) new; - Screen *scr = XtScreen (new); - - if (tdw->threeD.be_nice_to_cmap || DefaultDepthOfScreen (scr) == 1) { - AllocTopShadowPixmap (new); - AllocBotShadowPixmap (new); - } else { - if (tdw->threeD.top_shadow_pixel == tdw->threeD.bot_shadow_pixel) { - /* - Eeek. We're probably going to XQueryColor() twice - for each widget. Necessary because you can set the - top and bottom shadows independent of each other in - SetValues. Some cacheing would certainly help... - */ - AllocTopShadowPixel (new); - AllocBotShadowPixel (new); - } - tdw->threeD.top_shadow_pxmap = tdw->threeD.bot_shadow_pxmap = (Pixmap) 0; - } - AllocTopShadowGC (new); - AllocBotShadowGC (new); -} - -static void Realize (gw, valueMask, attrs) - Widget gw; - XtValueMask *valueMask; - XSetWindowAttributes *attrs; -{ - /* - * This is necessary because Simple3d doesn't have a realize method - * XtInheritRealize in the ThreeD class record doesn't work. This - * daisychains through Simple3d to the Core class realize method - */ - (*threeDWidgetClass->core_class.superclass->core_class.realize) - (gw, valueMask, attrs); -} - -static void Destroy (w) - Widget w; -{ - ThreeDWidget tdw = (ThreeDWidget) w; - XtReleaseGC (w, tdw->threeD.top_shadow_GC); - XtReleaseGC (w, tdw->threeD.bot_shadow_GC); - if (tdw->threeD.top_shadow_pxmap) - XFreePixmap (XtDisplay (w), tdw->threeD.top_shadow_pxmap); - if (tdw->threeD.bot_shadow_pxmap) - XFreePixmap (XtDisplay (w), tdw->threeD.bot_shadow_pxmap); -} - -/* ARGSUSED */ -static void Redisplay (w, event, region) - Widget w; - XEvent *event; /* unused */ - Region region; /* unused */ -{ - _Xaw3dDrawShadows (w, event, region, True); -} - -/* ARGSUSED */ -static Boolean SetValues (gcurrent, grequest, gnew, args, num_args) - Widget gcurrent, grequest, gnew; - ArgList args; - Cardinal *num_args; -{ - ThreeDWidget current = (ThreeDWidget) gcurrent; - ThreeDWidget new = (ThreeDWidget) gnew; - Boolean redisplay = FALSE; - Boolean alloc_top_pixel = FALSE; - Boolean alloc_bot_pixel = FALSE; - Boolean alloc_top_pxmap = FALSE; - Boolean alloc_bot_pxmap = FALSE; - - (*threeDWidgetClass->core_class.superclass->core_class.set_values) - (gcurrent, grequest, gnew, NULL, 0); - if (new->threeD.shadow_width != current->threeD.shadow_width) - redisplay = TRUE; - if (new->threeD.be_nice_to_cmap != current->threeD.be_nice_to_cmap) { - if (new->threeD.be_nice_to_cmap) { - alloc_top_pxmap = TRUE; - alloc_bot_pxmap = TRUE; - } else { - alloc_top_pixel = TRUE; - alloc_bot_pixel = TRUE; - } - redisplay = TRUE; - } - if (!new->threeD.be_nice_to_cmap && - new->threeD.top_shadow_contrast != current->threeD.top_shadow_contrast) - alloc_top_pixel = TRUE; - if (!new->threeD.be_nice_to_cmap && - new->threeD.bot_shadow_contrast != current->threeD.bot_shadow_contrast) - alloc_bot_pixel = TRUE; - if (alloc_top_pixel) - AllocTopShadowPixel (gnew); - if (alloc_bot_pixel) - AllocBotShadowPixel (gnew); - if (alloc_top_pxmap) - AllocTopShadowPixmap (gnew); - if (alloc_bot_pxmap) - AllocBotShadowPixmap (gnew); - if (!new->threeD.be_nice_to_cmap && - new->threeD.top_shadow_pixel != current->threeD.top_shadow_pixel) - alloc_top_pixel = TRUE; - if (!new->threeD.be_nice_to_cmap && - new->threeD.bot_shadow_pixel != current->threeD.bot_shadow_pixel) - alloc_bot_pixel = TRUE; - if (new->threeD.be_nice_to_cmap) { - if (alloc_top_pxmap) { - XtReleaseGC (gcurrent, current->threeD.top_shadow_GC); - AllocTopShadowGC (gnew); - redisplay = True; - } - if (alloc_bot_pxmap) { - XtReleaseGC (gcurrent, current->threeD.bot_shadow_GC); - AllocBotShadowGC (gnew); - redisplay = True; - } - } else { - if (alloc_top_pixel) { - if (new->threeD.top_shadow_pxmap) { - XFreePixmap (XtDisplay (gnew), new->threeD.top_shadow_pxmap); - new->threeD.top_shadow_pxmap = (Pixmap) NULL; - } - XtReleaseGC (gcurrent, current->threeD.top_shadow_GC); - AllocTopShadowGC (gnew); - redisplay = True; - } - if (alloc_bot_pixel) { - if (new->threeD.bot_shadow_pxmap) { - XFreePixmap (XtDisplay (gnew), new->threeD.bot_shadow_pxmap); - new->threeD.bot_shadow_pxmap = (Pixmap) NULL; - } - XtReleaseGC (gcurrent, current->threeD.bot_shadow_GC); - AllocBotShadowGC (gnew); - redisplay = True; - } - } - return (redisplay); -} - -/* ARGSUSED */ -static void -_Xaw3dDrawShadowSurroundedBox (gw, event, region, xtl, ytl, xbr, ybr, out) - Widget gw; - XEvent *event; - Region region; - Dimension xtl, ytl, xbr, ybr; /* INNER corners */ - Boolean out; -{ - XPoint pt[6]; - ThreeDWidget tdw = (ThreeDWidget) gw; - Dimension s = tdw->threeD.shadow_width; - - /* - * no point to do anything if the shadow_width is 0 or the - * widget has not been realized. - */ - if((s > 0) && XtIsRealized (gw)){ - - Dimension xms = xtl - s; - Dimension yms = ytl - s; - Dimension xps = xbr + s; - Dimension yps = ybr + s; - Display *dpy = XtDisplay (gw); - Window win = XtWindow (gw); - GC top, bot; - - if (out) { - top = tdw->threeD.top_shadow_GC; - bot = tdw->threeD.bot_shadow_GC; - } else { - top = tdw->threeD.bot_shadow_GC; - bot = tdw->threeD.top_shadow_GC; - } - /* Draw shadows. Points are numbered as follows: - * - * 1_________________________________ 2 - * | / /| - * | / / | - * | 4_________________________/ / | - * | | 3| | - * | | | | - * | | | | - * | | | | - * | |5_________________________| | - * | / / 4 | - * | / / | - * |/ /_______________________________| - * 3 1 - */ - - /* points common to top and bottom shadow */ - pt[0].x = xms; pt[0].y = yps; - pt[2].x = xps; pt[2].y = yms; - pt[3].x = xbr; pt[3].y = ytl; - pt[5].x = xtl; pt[5].y = ybr; - - /* top-left shadow */ - if ((region == NULL) || - (XRectInRegion (region, xms, yms, xps, ytl) != RectangleOut) || - (XRectInRegion (region, xms, yms, xtl, yps) != RectangleOut)) { - - pt[1].x = xms; pt[1].y = yms; - pt[4].x = xtl; pt[4].y = ytl; - XFillPolygon (dpy, win, top, pt, 6,Complex,CoordModeOrigin); - } - - /* bottom-right shadow */ - if ((region == NULL) || - (XRectInRegion (region, xms, ybr, xps, yps) != RectangleOut) || - (XRectInRegion (region, xbr, yms, xps, yps) != RectangleOut)) { - - /* swap points from top left to bottom right */ - pt[1].x = xps; pt[1].y = yps; - pt[4].x = xbr; pt[4].y = ybr; - XFillPolygon (dpy, win, bot, pt,6, Complex,CoordModeOrigin); - } - } -} - -/* ARGSUSED */ -static void -_Xaw3dDrawShadows (gw, event, region, out) - Widget gw; - XEvent *event; - Region region; - Boolean out; -{ - ThreeDWidget tdw = (ThreeDWidget) gw; - Dimension s = tdw->threeD.shadow_width; - /* - * draw the shadows using the core part width and height, - * and the threeD part shadow_width. - * - * no point to do anything if the shadow_width is 0 or the - * widget has not been realized. - */ - if(( s > 0) && XtIsRealized (gw)){ - _Xaw3dDrawShadowSurroundedBox (gw, event, region, - s, s, - tdw->core.width - s, tdw->core.height - s, - (out ^ tdw->threeD.invert_border) ); - } -} diff --git a/v/srcx/awcmd3d.c b/v/srcx/awcmd3d.c deleted file mode 100644 index a9f0be9..0000000 --- a/v/srcx/awcmd3d.c +++ /dev/null @@ -1,614 +0,0 @@ -/* $XConsortium: Command.c,v 1.79 94/04/17 20:11:58 kaleb Exp $ */ - -/*********************************************************** - -Copyright (c) 1987, 1988, 1994 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -/****************************************************************** -This code was taken directly from the Xaw3d distribution. -Several classes were used to make V look better. -The names of the classes have been changed to allow -standard Athena widgets to be used as well. - -I've not marked any of the changes specifically. - -Bruce Wampler - March 1, 1996 -******************************************************************/ -/* - * Command.c - Command button widget - */ - -#include -#include -#include -#include -#include -#include - -#define DEFAULT_HIGHLIGHT_THICKNESS 2 -#define DEFAULT_SHAPE_HIGHLIGHT 32767 - -/**************************************************************** - * - * Full class record constant - * - ****************************************************************/ - -/* Private Data */ - -static char defaultTranslations[] = - ": highlight() \n\ - : reset() \n\ - : set() \n\ - : notify() unset() "; - -#define offset(field) XtOffsetOf(Command3dRec, field) -static XtResource resources[] = { - {XtNcallback, XtCCallback, XtRCallback, sizeof(XtPointer), - offset(command3d.callbacks), XtRCallback, (XtPointer)NULL}, - {XtNhighlightThickness, XtCThickness, XtRDimension, sizeof(Dimension), - offset(command3d.highlight_thickness), XtRImmediate, - (XtPointer) DEFAULT_SHAPE_HIGHLIGHT}, - {XtNshapeStyle, XtCShapeStyle, XtRShapeStyle, sizeof(int), - offset(command3d.shape_style), XtRImmediate, (XtPointer)XawShapeRectangle}, - {XtNcornerRoundPercent, XtCCornerRoundPercent, - XtRDimension, sizeof(Dimension), - offset(command3d.corner_round), XtRImmediate, (XtPointer) 25}, - {XtNshadowWidth, XtCShadowWidth, XtRDimension, sizeof(Dimension), - offset(threeD.shadow_width), XtRImmediate, (XtPointer) 2}, - {XtNborderWidth, XtCBorderWidth, XtRDimension, sizeof(Dimension), - XtOffsetOf(RectObjRec,rectangle.border_width), XtRImmediate, - (XtPointer)0} -}; -#undef offset - -static Boolean SetValues(); -static void Initialize(), Redisplay(), Set(), Reset(), Notify(), Unset(); -static void Highlight(), Unhighlight(), Destroy(), PaintCommand3dWidget(); -static void ClassInitialize(); -static Boolean ShapeButton(); -static void Realize(), Resize(); - -static XtActionsRec actionsList[] = { - {"set", Set}, - {"notify", Notify}, - {"highlight", Highlight}, - {"reset", Reset}, - {"unset", Unset}, - {"unhighlight", Unhighlight} -}; - -#define SuperClass ((Label3dWidgetClass)&label3dClassRec) - -Command3dClassRec command3dClassRec = { - { - (WidgetClass) SuperClass, /* superclass */ - "Command3d", /* class_name */ - sizeof(Command3dRec), /* size */ - ClassInitialize, /* class_initialize */ - NULL, /* class_part_initialize */ - FALSE, /* class_inited */ - Initialize, /* initialize */ - NULL, /* initialize_hook */ - Realize, /* realize */ - actionsList, /* actions */ - XtNumber(actionsList), /* num_actions */ - resources, /* resources */ - XtNumber(resources), /* resource_count */ - NULLQUARK, /* xrm_class */ - FALSE, /* compress_motion */ - TRUE, /* compress_exposure */ - TRUE, /* compress_enterleave */ - FALSE, /* visible_interest */ - Destroy, /* destroy */ - Resize, /* resize */ - Redisplay, /* expose */ - SetValues, /* set_values */ - NULL, /* set_values_hook */ - XtInheritSetValuesAlmost, /* set_values_almost */ - NULL, /* get_values_hook */ - NULL, /* accept_focus */ - XtVersion, /* version */ - NULL, /* callback_private */ - defaultTranslations, /* tm_table */ - XtInheritQueryGeometry, /* query_geometry */ - XtInheritDisplayAccelerator, /* display_accelerator */ - NULL /* extension */ - }, /* CoreClass fields initialization */ - { - XtInheritChangeSensitive /* change_sensitive */ - }, /* Simple3d3dClass fields initialization */ - { - XtInheritXaw3dShadowDraw, /* shadowdraw */ - }, /* ThreeD Class fields initialization */ - { - 0, /* field not used */ - }, /* Label3dClass fields initialization */ - { - 0, /* field not used */ - }, /* Command3dClass fields initialization */ -}; - - /* for public consumption */ -WidgetClass command3dWidgetClass = (WidgetClass) &command3dClassRec; - -/**************************************************************** - * - * Private Procedures - * - ****************************************************************/ - -static GC -Get_GC(cbw, fg, bg) -Command3dWidget cbw; -Pixel fg, bg; -{ - XGCValues values; - - values.foreground = fg; - values.background = bg; - values.font = cbw->label3d.font->fid; - values.cap_style = CapProjecting; - - if (cbw->command3d.highlight_thickness > 1 ) - values.line_width = cbw->command3d.highlight_thickness; - else - values.line_width = 0; - - if ( cbw->simple3d.international == True ) - return XtAllocateGC((Widget)cbw, 0, - (GCForeground|GCBackground|GCLineWidth|GCCapStyle), - &values, GCFont, 0 ); - else - return XtGetGC((Widget)cbw, - (GCForeground|GCBackground|GCFont|GCLineWidth|GCCapStyle), - &values); -} - - -/* ARGSUSED */ -static void -Initialize(request, new, args, num_args) -Widget request, new; -ArgList args; /* unused */ -Cardinal *num_args; /* unused */ -{ - Command3dWidget cbw = (Command3dWidget) new; - int shape_event_base, shape_error_base; - - if (cbw->command3d.shape_style != XawShapeRectangle - && !XShapeQueryExtension(XtDisplay(new), &shape_event_base, - &shape_error_base)) - cbw->command3d.shape_style = XawShapeRectangle; - if (cbw->command3d.highlight_thickness == DEFAULT_SHAPE_HIGHLIGHT) { - if (cbw->command3d.shape_style != XawShapeRectangle) - cbw->command3d.highlight_thickness = 0; - else - cbw->command3d.highlight_thickness = DEFAULT_HIGHLIGHT_THICKNESS; - } - if (cbw->command3d.shape_style != XawShapeRectangle) { - cbw->threeD.shadow_width = 0; - cbw->core.border_width = 1; - } - - cbw->command3d.normal_GC = Get_GC(cbw, cbw->label3d.foreground, - cbw->core.background_pixel); - cbw->command3d.inverse_GC = Get_GC(cbw, cbw->core.background_pixel, - cbw->label3d.foreground); - XtReleaseGC(new, cbw->label3d.normal_GC); - cbw->label3d.normal_GC = cbw->command3d.normal_GC; - - cbw->command3d.set = FALSE; - cbw->command3d.highlighted = HighlightNone; -} - -static Region -HighlightRegion(cbw) -Command3dWidget cbw; -{ - static Region outerRegion = NULL, innerRegion, emptyRegion; - XRectangle rect; - - if (cbw->command3d.highlight_thickness == 0 || - cbw->command3d.highlight_thickness > - (Dimension) ((Dimension) Min(cbw->core.width, cbw->core.height)/2)) - return(NULL); - - if (outerRegion == NULL) { - /* save time by allocating scratch regions only once. */ - outerRegion = XCreateRegion(); - innerRegion = XCreateRegion(); - emptyRegion = XCreateRegion(); - } - - rect.x = rect.y = 0; - rect.width = cbw->core.width; - rect.height = cbw->core.height; - XUnionRectWithRegion( &rect, emptyRegion, outerRegion ); - rect.x = rect.y = cbw->command3d.highlight_thickness; - rect.width -= cbw->command3d.highlight_thickness * 2; - rect.height -= cbw->command3d.highlight_thickness * 2; - XUnionRectWithRegion( &rect, emptyRegion, innerRegion ); - XSubtractRegion( outerRegion, innerRegion, outerRegion ); - return outerRegion; -} - -/*************************** -* -* Action Procedures -* -***************************/ - -/* ARGSUSED */ -static void -Set(w,event,params,num_params) -Widget w; -XEvent *event; -String *params; /* unused */ -Cardinal *num_params; /* unused */ -{ - Command3dWidget cbw = (Command3dWidget)w; - - if (cbw->command3d.set) - return; - - cbw->command3d.set= TRUE; - if (XtIsRealized(w)) - PaintCommand3dWidget(w, event, (Region) NULL, TRUE); -} - -/* ARGSUSED */ -static void -Unset(w,event,params,num_params) -Widget w; -XEvent *event; -String *params; /* unused */ -Cardinal *num_params; -{ - Command3dWidget cbw = (Command3dWidget)w; - - if (!cbw->command3d.set) - return; - - cbw->command3d.set = FALSE; - if (XtIsRealized(w)) { - XClearWindow(XtDisplay(w), XtWindow(w)); - PaintCommand3dWidget(w, event, (Region) NULL, TRUE); - } -} - -/* ARGSUSED */ -static void -Reset(w,event,params,num_params) -Widget w; -XEvent *event; -String *params; /* unused */ -Cardinal *num_params; /* unused */ -{ - Command3dWidget cbw = (Command3dWidget)w; - - if (cbw->command3d.set) { - cbw->command3d.highlighted = HighlightNone; - Unset(w, event, params, num_params); - } else - Unhighlight(w, event, params, num_params); -} - -/* ARGSUSED */ -static void -Highlight(w,event,params,num_params) -Widget w; -XEvent *event; -String *params; -Cardinal *num_params; -{ - Command3dWidget cbw = (Command3dWidget)w; - - if ( *num_params == (Cardinal) 0) - cbw->command3d.highlighted = HighlightWhenUnset; - else { - if ( *num_params != (Cardinal) 1) - XtWarning("Too many parameters passed to highlight action table."); - switch (params[0][0]) { - case 'A': - case 'a': - cbw->command3d.highlighted = HighlightAlways; - break; - default: - cbw->command3d.highlighted = HighlightWhenUnset; - break; - } - } - - if (XtIsRealized(w)) - PaintCommand3dWidget(w, event, HighlightRegion(cbw), TRUE); -} - -/* ARGSUSED */ -static void -Unhighlight(w,event,params,num_params) -Widget w; -XEvent *event; -String *params; /* unused */ -Cardinal *num_params; /* unused */ -{ - Command3dWidget cbw = (Command3dWidget)w; - - cbw->command3d.highlighted = HighlightNone; - if (XtIsRealized(w)) - PaintCommand3dWidget(w, event, HighlightRegion(cbw), TRUE); -} - -/* ARGSUSED */ -static void -Notify(w,event,params,num_params) -Widget w; -XEvent *event; -String *params; /* unused */ -Cardinal *num_params; /* unused */ -{ - Command3dWidget cbw = (Command3dWidget)w; - - /* check to be sure state is still Set so that user can cancel - the action (e.g. by moving outside the window, in the default - bindings. - */ - if (cbw->command3d.set) - XtCallCallbackList(w, cbw->command3d.callbacks, (XtPointer) NULL); -} - -/* - * Repaint the widget window - */ - -/************************ -* -* REDISPLAY (DRAW) -* -************************/ - -/* ARGSUSED */ -static void -Redisplay(w, event, region) -Widget w; -XEvent *event; -Region region; -{ - PaintCommand3dWidget(w, event, region, FALSE); -} - -/* Function Name: PaintCommand3dWidget - * Description: Paints the command3d widget. - * Arguments: w - the command3d widget. - * region - region to paint (passed to the superclass). - * change - did it change either set or highlight state? - * Returns: none - */ - -static void -PaintCommand3dWidget(w, event, region, change) -Widget w; -XEvent *event; -Region region; -Boolean change; -{ - Command3dWidget cbw = (Command3dWidget) w; - Command3dWidgetClass cwclass = (Command3dWidgetClass) XtClass (w); - Boolean very_thick; - GC norm_gc, rev_gc; - Dimension s = cbw->threeD.shadow_width; - - very_thick = cbw->command3d.highlight_thickness > - (Dimension)((Dimension) Min(cbw->core.width, cbw->core.height)/2); - - if (cbw->command3d.set) { - cbw->label3d.normal_GC = cbw->command3d.inverse_GC; - XFillRectangle(XtDisplay(w), XtWindow(w), cbw->command3d.normal_GC, - s, s, cbw->core.width - 2 * s, cbw->core.height - 2 * s); - region = NULL; /* Force label3d to repaint text. */ - } - else - cbw->label3d.normal_GC = cbw->command3d.normal_GC; - - if (cbw->command3d.highlight_thickness <= 0) - { - (*SuperClass->core_class.expose) (w, event, region); - (*cwclass->threeD_class.shadowdraw) (w, event, region, !cbw->command3d.set); - return; - } - -/* - * If we are set then use the same colors as if we are not highlighted. - */ - - if (cbw->command3d.set == (cbw->command3d.highlighted == HighlightNone)) { - norm_gc = cbw->command3d.inverse_GC; - rev_gc = cbw->command3d.normal_GC; - } - else { - norm_gc = cbw->command3d.normal_GC; - rev_gc = cbw->command3d.inverse_GC; - } - - if ( !( (!change && (cbw->command3d.highlighted == HighlightNone)) || - ((cbw->command3d.highlighted == HighlightWhenUnset) && - (cbw->command3d.set))) ) { - if (very_thick) { - cbw->label3d.normal_GC = norm_gc; /* Give the label3d the right GC. */ - XFillRectangle(XtDisplay(w),XtWindow(w), rev_gc, - s, s, cbw->core.width - 2 * s, cbw->core.height - 2 * s); - } - else { - /* wide lines are centered on the path, so indent it */ - int offset = cbw->command3d.highlight_thickness/2; - XDrawRectangle(XtDisplay(w),XtWindow(w), rev_gc, s + offset, s + offset, - cbw->core.width - cbw->command3d.highlight_thickness - 2 * s, - cbw->core.height - cbw->command3d.highlight_thickness - 2 * s); - } - } - (*SuperClass->core_class.expose) (w, event, region); - (*cwclass->threeD_class.shadowdraw) (w, event, region, !cbw->command3d.set); -} - -static void -Destroy(w) -Widget w; -{ - Command3dWidget cbw = (Command3dWidget) w; - - /* so Label3d can release it */ - if (cbw->label3d.normal_GC == cbw->command3d.normal_GC) - XtReleaseGC( w, cbw->command3d.inverse_GC ); - else - XtReleaseGC( w, cbw->command3d.normal_GC ); -} - -/* - * Set specified arguments into widget - */ - -/* ARGSUSED */ -static Boolean -SetValues (current, request, new, args, num_args) -Widget current, request, new; -ArgList args; -Cardinal *num_args; -{ - Command3dWidget oldcbw = (Command3dWidget) current; - Command3dWidget cbw = (Command3dWidget) new; - Boolean redisplay = False; - - if ( oldcbw->core.sensitive != cbw->core.sensitive && !cbw->core.sensitive) { - /* about to become insensitive */ - cbw->command3d.set = FALSE; - cbw->command3d.highlighted = HighlightNone; - redisplay = TRUE; - } - - if ( (oldcbw->label3d.foreground != cbw->label3d.foreground) || - (oldcbw->core.background_pixel != cbw->core.background_pixel) || - (oldcbw->command3d.highlight_thickness != - cbw->command3d.highlight_thickness) || - (oldcbw->label3d.font != cbw->label3d.font) ) - { - if (oldcbw->label3d.normal_GC == oldcbw->command3d.normal_GC) - /* Label3d has release one of these */ - XtReleaseGC(new, cbw->command3d.inverse_GC); - else - XtReleaseGC(new, cbw->command3d.normal_GC); - - cbw->command3d.normal_GC = Get_GC(cbw, cbw->label3d.foreground, - cbw->core.background_pixel); - cbw->command3d.inverse_GC = Get_GC(cbw, cbw->core.background_pixel, - cbw->label3d.foreground); - XtReleaseGC(new, cbw->label3d.normal_GC); - cbw->label3d.normal_GC = (cbw->command3d.set - ? cbw->command3d.inverse_GC - : cbw->command3d.normal_GC); - - redisplay = True; - } - - if ( XtIsRealized(new) - && oldcbw->command3d.shape_style != cbw->command3d.shape_style - && !ShapeButton(cbw, TRUE)) - { - cbw->command3d.shape_style = oldcbw->command3d.shape_style; - } - - return (redisplay); -} - -static void ClassInitialize() -{ - XtSetTypeConverter( XtRString, XtRShapeStyle, XmuCvtStringToShapeStyle, - (XtConvertArgList)NULL, 0, XtCacheNone, (XtDestructor)NULL ); -} - - -static Boolean -ShapeButton(cbw, checkRectangular) -Command3dWidget cbw; -Boolean checkRectangular; -{ - Dimension corner_size = 0; - - if ( (cbw->command3d.shape_style == XawShapeRoundedRectangle) ) { - corner_size = (cbw->core.width < cbw->core.height) ? cbw->core.width - : cbw->core.height; - corner_size = (int) (corner_size * cbw->command3d.corner_round) / 100; - } - - if (checkRectangular || cbw->command3d.shape_style != XawShapeRectangle) { - if (!XmuReshapeWidget((Widget) cbw, cbw->command3d.shape_style, - corner_size, corner_size)) { - cbw->command3d.shape_style = XawShapeRectangle; - return(False); - } - } - return(TRUE); -} - -static void Realize(w, valueMask, attributes) - Widget w; - Mask *valueMask; - XSetWindowAttributes *attributes; -{ - (*command3dWidgetClass->core_class.superclass->core_class.realize) - (w, valueMask, attributes); - - ShapeButton( (Command3dWidget) w, FALSE); -} - -static void Resize(w) - Widget w; -{ - if (XtIsRealized(w)) - ShapeButton( (Command3dWidget) w, FALSE); - - (*command3dWidgetClass->core_class.superclass->core_class.resize)(w); -} diff --git a/v/srcx/awlbl3d.c b/v/srcx/awlbl3d.c deleted file mode 100644 index 9b9e260..0000000 --- a/v/srcx/awlbl3d.c +++ /dev/null @@ -1,812 +0,0 @@ -/* $XConsortium: Label.c,v 1.97 94/04/17 20:12:12 kaleb Exp $ */ - -/*********************************************************** - -Copyright (c) 1987, 1988, 1994 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -/****************************************************************** -This code was taken directly from the Xaw3d distribution. -Several classes were used to make V look better. -The names of the classes have been changed to allow -standard Athena widgets to be used as well. - -I've not marked any of the changes specifically. - -Bruce Wampler - March 1, 1996 -******************************************************************/ -/* - * Label.c - Label widget - * - */ - -#include -#include -#include -#include -#include -#include -#include - -/* needed for abs() */ -#ifndef X_NOT_STDC_ENV -#include -#else -int abs(); -#endif - -#define streq(a,b) (strcmp( (a), (b) ) == 0) - -#define MULTI_LINE_LABEL3d 32767 - -#ifdef CRAY -#define WORD64 -#endif - -/**************************************************************** - * - * Full class record constant - * - ****************************************************************/ - -/* Private Data */ - -#define offset(field) XtOffsetOf(Label3dRec, field) -static XtResource resources[] = { - {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), - offset(label3d.foreground), XtRString, XtDefaultForeground}, - {XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *), - offset(label3d.font),XtRString, XtDefaultFont}, - {XtNfontSet, XtCFontSet, XtRFontSet, sizeof(XFontSet ), - offset(label3d.fontset),XtRString, XtDefaultFontSet}, - {XtNlabel, XtCLabel, XtRString, sizeof(String), - offset(label3d.label3d), XtRString, NULL}, - {XtNencoding, XtCEncoding, XtRUnsignedChar, sizeof(unsigned char), - offset(label3d.encoding), XtRImmediate, (XtPointer)XawTextEncoding8bit}, - {XtNjustify, XtCJustify, XtRJustify, sizeof(XtJustify), - offset(label3d.justify), XtRImmediate, (XtPointer)XtJustifyCenter}, - {XtNinternalWidth, XtCWidth, XtRDimension, sizeof(Dimension), - offset(label3d.internal_width), XtRImmediate, (XtPointer)4}, - {XtNinternalHeight, XtCHeight, XtRDimension, sizeof(Dimension), - offset(label3d.internal_height), XtRImmediate, (XtPointer)2}, - {XtNleftBitmap, XtCLeftBitmap, XtRBitmap, sizeof(Pixmap), - offset(label3d.left_bitmap), XtRImmediate, (XtPointer) None}, - {XtNbitmap, XtCPixmap, XtRBitmap, sizeof(Pixmap), - offset(label3d.pixmap), XtRImmediate, (XtPointer)None}, - {XtNresize, XtCResize, XtRBoolean, sizeof(Boolean), - offset(label3d.resize), XtRImmediate, (XtPointer)True}, - {XtNshadowWidth, XtCShadowWidth, XtRDimension, sizeof(Dimension), - offset(threeD.shadow_width), XtRImmediate, (XtPointer) 0}, - {XtNborderWidth, XtCBorderWidth, XtRDimension, sizeof(Dimension), - XtOffsetOf(RectObjRec,rectangle.border_width), XtRImmediate, - (XtPointer)1} -}; -#undef offset - -static void Initialize(); -static void Resize(); -static void Redisplay(); -static Boolean SetValues(); -static void ClassInitialize(); -static void Destroy(); -static XtGeometryResult QueryGeometry(); - -Label3dClassRec label3dClassRec = { - { -/* core_class fields */ - /* superclass */ (WidgetClass) &threeDClassRec, - /* class_name */ "Label3d", - /* widget_size */ sizeof(Label3dRec), - /* class_initialize */ ClassInitialize, - /* class_part_initialize */ NULL, - /* class_inited */ FALSE, - /* initialize */ Initialize, - /* initialize_hook */ NULL, - /* realize */ XtInheritRealize, - /* actions */ NULL, - /* num_actions */ 0, - /* resources */ resources, - /* num_resources */ XtNumber(resources), - /* xrm_class */ NULLQUARK, - /* compress_motion */ TRUE, - /* compress_exposure */ TRUE, - /* compress_enterleave */ TRUE, - /* visible_interest */ FALSE, - /* destroy */ Destroy, - /* resize */ Resize, - /* expose */ Redisplay, - /* set_values */ SetValues, - /* set_values_hook */ NULL, - /* set_values_almost */ XtInheritSetValuesAlmost, - /* get_values_hook */ NULL, - /* accept_focus */ NULL, - /* version */ XtVersion, - /* callback_private */ NULL, - /* tm_table */ NULL, - /* query_geometry */ QueryGeometry, - /* display_accelerator */ XtInheritDisplayAccelerator, - /* extension */ NULL - }, -/* Simple3d class fields initialization */ - { - /* change_sensitive */ XtInheritChangeSensitive - }, -/* ThreeD class fields initialization */ - { - /* shadowdraw */ XtInheritXaw3dShadowDraw - }, -/* Label3d class fields initialization */ - { - /* ignore */ 0 - } -}; -WidgetClass label3dWidgetClass = (WidgetClass)&label3dClassRec; -/**************************************************************** - * - * Private Procedures - * - ****************************************************************/ - -static void ClassInitialize() -{ - XtAddConverter( XtRString, XtRJustify, XmuCvtStringToJustify, - (XtConvertArgList)NULL, 0 ); -} - -#ifndef WORD64 - -#define TXT16 XChar2b - -#else - -#define TXT16 char - -static XChar2b *buf2b; -static int buf2blen = 0; - -_XawLabel3dWidth16(fs, str, n) - XFontStruct *fs; - char *str; - int n; -{ - int i; - XChar2b *ptr; - - if (n > buf2blen) { - buf2b = (XChar2b *)XtRealloc((char *)buf2b, n * sizeof(XChar2b)); - buf2blen = n; - } - for (ptr = buf2b, i = n; --i >= 0; ptr++) { - ptr->byte1 = *str++; - ptr->byte2 = *str++; - } - return XTextWidth16(fs, buf2b, n); -} - -_XawLabel3dDraw16(dpy, d, gc, x, y, str, n) - Display *dpy; - Drawable d; - GC gc; - int x, y; - char *str; - int n; -{ - int i; - XChar2b *ptr; - - if (n > buf2blen) { - buf2b = (XChar2b *)XtRealloc((char *)buf2b, n * sizeof(XChar2b)); - buf2blen = n; - } - for (ptr = buf2b, i = n; --i >= 0; ptr++) { - ptr->byte1 = *str++; - ptr->byte2 = *str++; - } - XDrawString16(dpy, d, gc, x, y, buf2b, n); -} - -#define XTextWidth16 _XawLabel3dWidth16 -#define XDrawString16 _XawLabel3dDraw16 - -#endif /* WORD64 */ - -/* - * Calculate width and height of displayed text in pixels - */ - -static void SetTextWidthAndHeight(lw) - Label3dWidget lw; -{ - XFontStruct *fs = lw->label3d.font; - - char *nl; - - if (lw->label3d.pixmap != None) { - Window root; - int x, y; - unsigned int width, height, bw, depth; - if (XGetGeometry(XtDisplay(lw), lw->label3d.pixmap, &root, &x, &y, - &width, &height, &bw, &depth)) { - lw->label3d.label3d_height = height; - lw->label3d.label3d_width = width; - lw->label3d.label3d_len = depth; - return; - } - } - if ( lw->simple3d.international == True ) { - - XFontSet fset = lw->label3d.fontset; - XFontSetExtents *ext = XExtentsOfFontSet(fset); - - lw->label3d.label3d_height = ext->max_ink_extent.height; - if (lw->label3d.label3d == NULL) { - lw->label3d.label3d_len = 0; - lw->label3d.label3d_width = 0; - } - else if ((nl = index(lw->label3d.label3d, '\n')) != NULL) { - char *label3d; - lw->label3d.label3d_len = MULTI_LINE_LABEL3d; - lw->label3d.label3d_width = 0; - for (label3d = lw->label3d.label3d; nl != NULL; nl = index(label3d, '\n')) { - int width = XmbTextEscapement(fset, label3d, (int)(nl - label3d)); - - if (width > (int)lw->label3d.label3d_width) - lw->label3d.label3d_width = width; - label3d = nl + 1; - if (*label3d) - lw->label3d.label3d_height += - ext->max_ink_extent.height; - } - if (*label3d) { - int width = XmbTextEscapement(fset, label3d, strlen(label3d)); - - if (width > (int) lw->label3d.label3d_width) - lw->label3d.label3d_width = width; - } - } else { - lw->label3d.label3d_len = strlen(lw->label3d.label3d); - lw->label3d.label3d_width = - XmbTextEscapement(fset, lw->label3d.label3d, (int) lw->label3d.label3d_len); - } - - } else { - - lw->label3d.label3d_height = fs->max_bounds.ascent + fs->max_bounds.descent; - if (lw->label3d.label3d == NULL) { - lw->label3d.label3d_len = 0; - lw->label3d.label3d_width = 0; - } - else if ((nl = index(lw->label3d.label3d, '\n')) != NULL) { - char *label3d; - lw->label3d.label3d_len = MULTI_LINE_LABEL3d; - lw->label3d.label3d_width = 0; - for (label3d = lw->label3d.label3d; nl != NULL; nl = index(label3d, '\n')) { - int width; - - if (lw->label3d.encoding) - width = XTextWidth16(fs, (TXT16*)label3d, (int)(nl - label3d)/2); - else - width = XTextWidth(fs, label3d, (int)(nl - label3d)); - if (width > (int)lw->label3d.label3d_width) - lw->label3d.label3d_width = width; - label3d = nl + 1; - if (*label3d) - lw->label3d.label3d_height += - fs->max_bounds.ascent + fs->max_bounds.descent; - } - if (*label3d) { - int width = XTextWidth(fs, label3d, strlen(label3d)); - - if (lw->label3d.encoding) - width = XTextWidth16(fs, (TXT16*)label3d, (int)strlen(label3d)/2); - else - width = XTextWidth(fs, label3d, strlen(label3d)); - if (width > (int) lw->label3d.label3d_width) - lw->label3d.label3d_width = width; - } - } else { - lw->label3d.label3d_len = strlen(lw->label3d.label3d); - if (lw->label3d.encoding) - lw->label3d.label3d_width = - XTextWidth16(fs, (TXT16*)lw->label3d.label3d, - (int) lw->label3d.label3d_len/2); - else - lw->label3d.label3d_width = - XTextWidth(fs, lw->label3d.label3d, (int) lw->label3d.label3d_len); - } - - } -} - -static void GetnormalGC(lw) - Label3dWidget lw; -{ - XGCValues values; - - values.foreground = lw->label3d.foreground; - values.background = lw->core.background_pixel; - values.font = lw->label3d.font->fid; - values.graphics_exposures = False; - - if ( lw->simple3d.international == True ) - /* Since Xmb/wcDrawString eats the font, I must use XtAllocateGC. */ - lw->label3d.normal_GC = XtAllocateGC( - (Widget)lw, 0, - (unsigned) GCForeground | GCBackground | GCGraphicsExposures, - &values, GCFont, 0 ); - else - lw->label3d.normal_GC = XtGetGC( - (Widget)lw, - (unsigned) GCForeground | GCBackground | GCFont | GCGraphicsExposures, - &values); -} - -static void GetgrayGC(lw) - Label3dWidget lw; -{ - XGCValues values; - - values.foreground = lw->label3d.foreground; - values.background = lw->core.background_pixel; - values.font = lw->label3d.font->fid; - values.fill_style = FillTiled; - values.tile = XmuCreateStippledPixmap(XtScreen((Widget)lw), - lw->label3d.foreground, - lw->core.background_pixel, - lw->core.depth); - values.graphics_exposures = False; - - lw->label3d.stipple = values.tile; - if ( lw->simple3d.international == True ) - /* Since Xmb/wcDrawString eats the font, I must use XtAllocateGC. */ - lw->label3d.gray_GC = XtAllocateGC((Widget)lw, 0, - (unsigned) GCForeground | GCBackground | - GCTile | GCFillStyle | - GCGraphicsExposures, - &values, GCFont, 0); - else - lw->label3d.gray_GC = XtGetGC((Widget)lw, - (unsigned) GCForeground | GCBackground | - GCFont | GCTile | GCFillStyle | - GCGraphicsExposures, - &values); -} - -static void compute_bitmap_offsets (lw) - Label3dWidget lw; -{ - /* - * bitmap will be eventually be displayed at - * (internal_width, internal_height + lbm_y) - */ - if (lw->label3d.lbm_height != 0) { - lw->label3d.lbm_y = (lw->core.height - - (lw->threeD.shadow_width * 2 + - lw->label3d.internal_height * 2 + - lw->label3d.lbm_height)) / 2; - } else { - lw->label3d.lbm_y = 0; - } -} - - -static void set_bitmap_info (lw) - Label3dWidget lw; -{ - Window root; - int x, y; - unsigned int bw, depth; - - if (!(lw->label3d.left_bitmap && - XGetGeometry (XtDisplay(lw), lw->label3d.left_bitmap, &root, &x, &y, - &lw->label3d.lbm_width, &lw->label3d.lbm_height, - &bw, &depth))) { - lw->label3d.lbm_width = lw->label3d.lbm_height = 0; - } - compute_bitmap_offsets (lw); -} - - - -/* ARGSUSED */ -static void Initialize(request, new, args, num_args) - Widget request, new; - ArgList args; - Cardinal *num_args; -{ - Label3dWidget lw = (Label3dWidget) new; - - if (lw->label3d.label3d == NULL) - lw->label3d.label3d = XtNewString(lw->core.name); - else { - lw->label3d.label3d = XtNewString(lw->label3d.label3d); - } - - GetnormalGC(lw); - GetgrayGC(lw); - - SetTextWidthAndHeight(lw); - - if (lw->core.height == 0) - lw->core.height = lw->label3d.label3d_height + - 2 * lw->label3d.internal_height + - 2 * lw->threeD.shadow_width; - - set_bitmap_info (lw); /* need core.height */ - - if (lw->core.width == 0) /* need label3d.lbm_width */ - lw->core.width = (lw->label3d.label3d_width + - 2 * lw->label3d.internal_width + - 2 * lw->threeD.shadow_width + - LEFT_OFFSET(lw)); - - lw->label3d.label3d_x = lw->label3d.label3d_y = 0; - (*XtClass(new)->core_class.resize) ((Widget)lw); - -} /* Initialize */ - -/* - * Repaint the widget window - */ - -/* ARGSUSED */ -static void Redisplay(gw, event, region) - Widget gw; - XEvent *event; - Region region; -{ - extern WidgetClass command3dWidgetClass; - Label3dWidget w = (Label3dWidget) gw; - Label3dWidgetClass lwclass = (Label3dWidgetClass) XtClass (gw); - GC gc; - - /* - * Don't draw shadows if command is going to redraw them. - * The shadow draw method is region aware, but since 99% of - * all label3ds don't have shadows, we'll check for a shadow - * before we incur the function call overhead. - */ - if (!XtIsSubclass (gw, command3dWidgetClass) && w->threeD.shadow_width > 0) - (*lwclass->threeD_class.shadowdraw) (gw, event, region, True); - - /* - * now we'll see if we need to draw the rest of the label3d - */ - if (region != NULL) { - int x = w->label3d.label3d_x; - unsigned int width = w->label3d.label3d_width; - if (w->label3d.lbm_width) { - if (w->label3d.label3d_x > (x = w->label3d.internal_width)) - width += w->label3d.label3d_x - x; - } - if (XRectInRegion(region, x, w->label3d.label3d_y, - width, w->label3d.label3d_height) == RectangleOut){ - return; - } - } - - gc = XtIsSensitive(gw) ? w->label3d.normal_GC : w->label3d.gray_GC; -#ifdef notdef - if (region != NULL) - XSetRegion(XtDisplay(gw), gc, region); -#endif /*notdef*/ - - if (w->label3d.pixmap == None) { - int len = w->label3d.label3d_len; - char *label3d = w->label3d.label3d; - Position y = w->label3d.label3d_y + w->label3d.font->max_bounds.ascent; - Position ksy = w->label3d.label3d_y; - - /* display left bitmap */ - if (w->label3d.left_bitmap && w->label3d.lbm_width != 0) { - XCopyPlane (XtDisplay(gw), w->label3d.left_bitmap, XtWindow(gw), gc, - 0, 0, w->label3d.lbm_width, w->label3d.lbm_height, - (int) w->label3d.internal_width - + w->threeD.shadow_width, - (int) w->label3d.internal_height - + w->threeD.shadow_width - + w->label3d.lbm_y, - (unsigned long) 1L); - } - - if ( w->simple3d.international == True ) { - - XFontSetExtents *ext = XExtentsOfFontSet(w->label3d.fontset); - - ksy += abs(ext->max_ink_extent.y); - - if (len == MULTI_LINE_LABEL3d) { - char *nl; - while ((nl = index(label3d, '\n')) != NULL) { - XmbDrawString(XtDisplay(w), XtWindow(w), w->label3d.fontset, gc, - w->label3d.label3d_x, ksy, label3d, (int)(nl - label3d)); - ksy += ext->max_ink_extent.height; - label3d = nl + 1; - } - len = strlen(label3d); - } - if (len) - XmbDrawString(XtDisplay(w), XtWindow(w), w->label3d.fontset, gc, - w->label3d.label3d_x, ksy, label3d, len); - - } else { /*international false, so use R5 routine */ - - if (len == MULTI_LINE_LABEL3d) { - char *nl; - while ((nl = index(label3d, '\n')) != NULL) { - if (w->label3d.encoding) - XDrawString16(XtDisplay(gw), XtWindow(gw), gc, - w->label3d.label3d_x, y, - (TXT16*)label3d, (int)(nl - label3d)/2); - else - XDrawString(XtDisplay(gw), XtWindow(gw), gc, - w->label3d.label3d_x, y, label3d, (int)(nl - label3d)); - y += w->label3d.font->max_bounds.ascent + - w->label3d.font->max_bounds.descent; - label3d = nl + 1; - } - len = strlen(label3d); - } - if (len) { - if (w->label3d.encoding) - XDrawString16(XtDisplay(gw), XtWindow(gw), gc, - w->label3d.label3d_x, y, (TXT16*)label3d, len/2); - else - XDrawString(XtDisplay(gw), XtWindow(gw), gc, - w->label3d.label3d_x, y, label3d, len); - } - - } /*endif international*/ - - } else if (w->label3d.label3d_len == 1) { /* depth */ - XCopyPlane(XtDisplay(gw), w->label3d.pixmap, XtWindow(gw), gc, - 0, 0, w->label3d.label3d_width, w->label3d.label3d_height, - w->label3d.label3d_x, w->label3d.label3d_y, 1L); - } else { - XCopyArea(XtDisplay(gw), w->label3d.pixmap, XtWindow(gw), gc, - 0, 0, w->label3d.label3d_width, w->label3d.label3d_height, - w->label3d.label3d_x, w->label3d.label3d_y); - } - -#ifdef notdef - if (region != NULL) - XSetClipMask(XtDisplay(gw), gc, (Pixmap)None); -#endif /* notdef */ -} - -static void _Reposition(lw, width, height, dx, dy) - Label3dWidget lw; - Dimension width, height; - Position *dx, *dy; -{ - Position newPos; - Position leftedge = lw->label3d.internal_width + LEFT_OFFSET(lw); - - switch (lw->label3d.justify) { - - case XtJustifyLeft : - newPos = leftedge; - break; - - case XtJustifyRight : - newPos = width - - (lw->label3d.label3d_width - + lw->label3d.internal_width - + lw->threeD.shadow_width); - break; - - case XtJustifyCenter : - default: - newPos = (int)(width - lw->label3d.label3d_width) / 2; - break; - } - if (newPos < (Position)leftedge) - newPos = leftedge; - *dx = newPos - lw->label3d.label3d_x; - lw->label3d.label3d_x = newPos; - *dy = (newPos = (int)(height - lw->label3d.label3d_height) / 2) - - lw->label3d.label3d_y; - lw->label3d.label3d_y = newPos; - return; -} - -static void Resize(w) - Widget w; -{ - Label3dWidget lw = (Label3dWidget)w; - Position dx, dy; - - _Reposition(lw, w->core.width, w->core.height, &dx, &dy); - compute_bitmap_offsets (lw); -} - -/* - * Set specified arguments into widget - */ - -#define PIXMAP 0 -#define WIDTH 1 -#define HEIGHT 2 -#define NUM_CHECKS 3 - -static Boolean SetValues(current, request, new, args, num_args) - Widget current, request, new; - ArgList args; - Cardinal *num_args; -{ - Label3dWidget curlw = (Label3dWidget) current; - Label3dWidget reqlw = (Label3dWidget) request; - Label3dWidget newlw = (Label3dWidget) new; - int i; - Boolean was_resized = False, redisplay = False, checks[NUM_CHECKS]; - - for (i = 0; i < NUM_CHECKS; i++) - checks[i] = FALSE; - - for (i = 0; i < *num_args; i++) { - if (streq(XtNbitmap, args[i].name)) - checks[PIXMAP] = TRUE; - if (streq(XtNwidth, args[i].name)) - checks[WIDTH] = TRUE; - if (streq(XtNheight, args[i].name)) - checks[HEIGHT] = TRUE; - } - - if (newlw->label3d.label3d == NULL) { - newlw->label3d.label3d = newlw->core.name; - } - - /* - * resize on bitmap change - */ - if (curlw->label3d.left_bitmap != newlw->label3d.left_bitmap) { - was_resized = True; - } - - if (curlw->label3d.encoding != newlw->label3d.encoding) - was_resized = True; - - if ( (curlw->label3d.fontset != newlw->label3d.fontset) && - curlw->simple3d.international ){ - was_resized = True; - } - if (curlw->label3d.label3d != newlw->label3d.label3d) { - if (curlw->label3d.label3d != curlw->core.name) - XtFree( (char *)curlw->label3d.label3d ); - - if (newlw->label3d.label3d != newlw->core.name) { - newlw->label3d.label3d = XtNewString( newlw->label3d.label3d ); - } - was_resized = True; - } - - if (was_resized || (curlw->label3d.font != newlw->label3d.font) || - (curlw->label3d.justify != newlw->label3d.justify) || checks[PIXMAP]) { - - SetTextWidthAndHeight(newlw); - was_resized = True; - } - - /* recalculate the window size if something has changed. */ - if (newlw->label3d.resize && was_resized) { - if ((curlw->core.height == reqlw->core.height) && !checks[HEIGHT]) - newlw->core.height = (newlw->label3d.label3d_height + - 2 * newlw->label3d.internal_height + - 2 * newlw->threeD.shadow_width); - - set_bitmap_info (newlw); - - if ((curlw->core.width == reqlw->core.width) && !checks[WIDTH]) - newlw->core.width = (newlw->label3d.label3d_width + - LEFT_OFFSET(newlw) + - 2 * newlw->label3d.internal_width + - 2 * newlw->threeD.shadow_width); - } - - if (curlw->label3d.foreground != newlw->label3d.foreground - || curlw->core.background_pixel != newlw->core.background_pixel - || curlw->label3d.font->fid != newlw->label3d.font->fid ) { - - /* The Fontset is not in the GC - don't make a new GC if FS changes! */ - - XtReleaseGC(new, curlw->label3d.normal_GC); - XtReleaseGC(new, curlw->label3d.gray_GC); - XmuReleaseStippledPixmap( XtScreen(current), curlw->label3d.stipple ); - GetnormalGC(newlw); - GetgrayGC(newlw); - redisplay = True; - } - - if ((curlw->label3d.internal_width != newlw->label3d.internal_width) - || (curlw->label3d.internal_height != newlw->label3d.internal_height) - || was_resized) { - /* Resize() will be called if geometry changes succeed */ - Position dx, dy; - _Reposition(newlw, curlw->core.width, curlw->core.height, &dx, &dy); - } - - return was_resized || redisplay || - XtIsSensitive(current) != XtIsSensitive(new); -} - -static void Destroy(w) - Widget w; -{ - Label3dWidget lw = (Label3dWidget)w; - - if ( lw->label3d.label3d != lw->core.name ) - XtFree( lw->label3d.label3d ); - XtReleaseGC( w, lw->label3d.normal_GC ); - XtReleaseGC( w, lw->label3d.gray_GC); - XmuReleaseStippledPixmap( XtScreen(w), lw->label3d.stipple ); -} - - -static XtGeometryResult QueryGeometry(w, intended, preferred) - Widget w; - XtWidgetGeometry *intended, *preferred; -{ - Label3dWidget lw = (Label3dWidget)w; - - preferred->request_mode = CWWidth | CWHeight; - preferred->width = (lw->label3d.label3d_width + - 2 * lw->label3d.internal_width + - 2 * lw->threeD.shadow_width + - LEFT_OFFSET(lw)); - preferred->height = lw->label3d.label3d_height + - 2 * lw->label3d.internal_height + - 2 * lw->threeD.shadow_width; - if ( ((intended->request_mode & (CWWidth | CWHeight)) - == (CWWidth | CWHeight)) && - intended->width == preferred->width && - intended->height == preferred->height) - return XtGeometryYes; - else if (preferred->width == w->core.width && - preferred->height == w->core.height) - return XtGeometryNo; - else - return XtGeometryAlmost; -} diff --git a/v/srcx/awscl3d.c b/v/srcx/awscl3d.c deleted file mode 100644 index cbdf8a7..0000000 --- a/v/srcx/awscl3d.c +++ /dev/null @@ -1,1226 +0,0 @@ -/* MODIFIED ATHENA SCROLLBAR3d (USING ARROWHEADS AT ENDS OF TRAVEL) */ -/* Modifications Copyright 1992 by Mitch Trachtenberg */ -/* Rights, permissions, and disclaimer of warranty are as in the */ -/* DEC and MIT notice below. */ -/* $XConsortium: Scrollbar3d.c,v 1.72 94/04/17 20:12:40 kaleb Exp $ */ - -/*********************************************************** - -Copyright (c) 1987, 1988, 1994 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ -/****************************************************************** -This code was taken directly from the Xaw3d distribution. -Several classes were used to make V look better. -The names of the classes have been changed to allow -standard Athena widgets to be used as well. - -I've not marked any of the changes specifically. - -Bruce Wampler - March 1, 1996 -******************************************************************/ - -/* ScrollBar3d.c */ -/* created by weissman, Mon Jul 7 13:20:03 1986 */ -/* converted by swick, Thu Aug 27 1987 */ - -#include -#include - -#include - -#include - -/* Private definitions. */ -#define V_TRANSLATIONS - -#ifdef V_TRANSLATIONS -static char defaultTranslations[] = - ": NotifyScroll()\n\ - : MoveThumb() NotifyThumb() \n\ - : NotifyScroll()\n\ - : MoveThumb() \n\ - : MoveThumb() \n\ - : MoveThumb() \n\ - : HandleThumb() EndScroll()"; - -/* : NotifyThumb() EndScroll()"; */ - - -#else -static char defaultTranslations[] = - ": NotifyScroll()\n\ - : MoveThumb() NotifyThumb() \n\ - : NotifyScroll()\n\ - : HandleThumb() \n\ - : HandleThumb() \n\ - : MoveThumb() NotifyThumb() \n\ - : EndScroll()"; -#endif - -static float floatZero = 0.0; - -#define Offset(field) XtOffsetOf(Scrollbar3dRec, field) - - -static XtResource resources[] = { - {XtNscrollVCursor, XtCCursor, XtRCursor, sizeof(Cursor), - Offset(scrollbar3d.verCursor), XtRString, "sb_v_double_arrow"}, - {XtNscrollHCursor, XtCCursor, XtRCursor, sizeof(Cursor), - Offset(scrollbar3d.horCursor), XtRString, "sb_h_double_arrow"}, - {XtNlength, XtCLength, XtRDimension, sizeof(Dimension), - Offset(scrollbar3d.length), XtRImmediate, (XtPointer) 1}, - {XtNthickness, XtCThickness, XtRDimension, sizeof(Dimension), - Offset(scrollbar3d.thickness), XtRImmediate, (XtPointer) 14}, - {XtNorientation, XtCOrientation, XtROrientation, sizeof(XtOrientation), - Offset(scrollbar3d.orientation), XtRImmediate, (XtPointer) XtorientVertical}, - {XtNscrollProc, XtCCallback, XtRCallback, sizeof(XtPointer), - Offset(scrollbar3d.scrollProc), XtRCallback, NULL}, - {XtNthumbProc, XtCCallback, XtRCallback, sizeof(XtPointer), - Offset(scrollbar3d.thumbProc), XtRCallback, NULL}, - {XtNjumpProc, XtCCallback, XtRCallback, sizeof(XtPointer), - Offset(scrollbar3d.jumpProc), XtRCallback, NULL}, - {XtNthumb, XtCThumb, XtRBitmap, sizeof(Pixmap), - Offset(scrollbar3d.thumb), XtRImmediate, (XtPointer) XtUnspecifiedPixmap}, - {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), - Offset(scrollbar3d.foreground), XtRString, XtDefaultForeground}, - {XtNscrollbar3dBackground, XtCScrollbar3dBackground, XtRPixel, sizeof(Pixel), - Offset(scrollbar3d.background), XtRString, XtDefaultForeground}, - {XtNshown, XtCShown, XtRFloat, sizeof(float), - Offset(scrollbar3d.shown), XtRFloat, (XtPointer)&floatZero}, - {XtNtopOfThumb, XtCTopOfThumb, XtRFloat, sizeof(float), - Offset(scrollbar3d.top), XtRFloat, (XtPointer)&floatZero}, - {XtNpickTop, XtCPickTop, XtRBoolean, sizeof(Boolean), - Offset(scrollbar3d.pick_top), XtRImmediate, (XtPointer) False}, - {XtNminimumThumb, XtCMinimumThumb, XtRDimension, sizeof(Dimension), - Offset(scrollbar3d.min_thumb), XtRImmediate, (XtPointer) 7}, - {XtNpushThumb, XtCPushThumb, XtRBoolean, sizeof(Boolean), - Offset(scrollbar3d.push_thumb), XtRImmediate, (XtPointer) True} -}; -#undef Offset - -static void ClassInitialize(); -static void Initialize(); -static void Destroy(); -static void Realize(); -static void Resize(); -static void Redisplay(); -static Boolean SetValues(); - -static void HandleThumb(); -static void MoveThumb(); -static void NotifyThumb(); -static void NotifyScroll(); -static void EndScroll(); - -static XtActionsRec actions[] = { - {"HandleThumb", HandleThumb}, - {"MoveThumb", MoveThumb}, - {"NotifyThumb", NotifyThumb}, - {"NotifyScroll", NotifyScroll}, - {"EndScroll", EndScroll} -}; - - -Scrollbar3dClassRec scrollbar3dClassRec = { - { /* core fields */ - /* superclass */ (WidgetClass) &threeDClassRec, - /* class_name */ "Scrollbar3d", - /* size */ sizeof(Scrollbar3dRec), - /* class_initialize */ ClassInitialize, - /* class_part_init */ NULL, - /* class_inited */ FALSE, - /* initialize */ Initialize, - /* initialize_hook */ NULL, - /* realize */ Realize, - /* actions */ actions, - /* num_actions */ XtNumber(actions), - /* resources */ resources, - /* num_resources */ XtNumber(resources), - /* xrm_class */ NULLQUARK, - /* compress_motion */ TRUE, - /* compress_exposure*/ TRUE, - /* compress_enterleave*/ TRUE, - /* visible_interest */ FALSE, - /* destroy */ Destroy, - /* resize */ Resize, - /* expose */ Redisplay, - /* set_values */ SetValues, - /* set_values_hook */ NULL, - /* set_values_almost */ XtInheritSetValuesAlmost, - /* get_values_hook */ NULL, - /* accept_focus */ NULL, - /* version */ XtVersion, - /* callback_private */ NULL, - /* tm_table */ defaultTranslations, - /* query_geometry */ XtInheritQueryGeometry, - /* display_accelerator*/ XtInheritDisplayAccelerator, - /* extension */ NULL - }, - { /* simple fields */ - /* change_sensitive */ XtInheritChangeSensitive - }, - { /* threeD fields */ - /* shadowdraw */ XtInheritXaw3dShadowDraw - }, - { /* scrollbar3d fields */ - /* ignore */ 0 - } - -}; - -WidgetClass scrollbar3dWidgetClass = (WidgetClass)&scrollbar3dClassRec; - -#define NoButton -1 -#define PICKLENGTH(widget, x, y) \ - ((widget->scrollbar3d.orientation == XtorientHorizontal) ? (x) : (y)) -#define MIN(x,y) ((x) < (y) ? (x) : (y)) -#define MAX(x,y) ((x) > (y) ? (x) : (y)) - -static void ClassInitialize() -{ - XtAddConverter( XtRString, XtROrientation, XmuCvtStringToOrientation, - (XtConvertArgList)NULL, (Cardinal)0 ); -} - -#define MARGIN(sbw) (sbw)->scrollbar3d.thickness - -/* - Used to swap X and Y coordinates when the scrollbar3d is horizontal. - */ -static void swap(a, b) - Dimension *a, *b; -{ - Dimension tmp = *a; - *a = *b; - *b = tmp; -} - -/* - Paint the thumb in the area specified by sbw->top and sbw->shown. - The old area is erased. No special tricks, draws the entire scollbar - over every time but doesn't draw the same region twice during a - single call to PaintThumb so there shouldn't be any flicker. - Draws the thumb "pressed in" when pressed = 1. - */ - -static void PaintThumb (sbw, pressed) - Scrollbar3dWidget sbw; - int pressed; -{ - Dimension margin, tzl; - Position floor; - Position top, bot; - Dimension x, y; /* upper-left corner of rectangle */ - Dimension w, h; /* size of rectangle */ - Dimension sw = sbw->threeD.shadow_width; - Dimension th = sbw->scrollbar3d.thickness; - XPoint ipoint[4],opoint[4]; /* inner and outer points of thumb */ - XPoint point[4]; /* points used for drawing */ - GC top_shadow_GC, bot_shadow_GC; - double thumb_len; - - margin = MARGIN (sbw); - tzl = sbw->scrollbar3d.length - 2*margin; - floor = sbw->scrollbar3d.length - margin; - - top = margin + (int)(tzl * sbw->scrollbar3d.top); - thumb_len = tzl * sbw->scrollbar3d.shown; - bot = top + (int)thumb_len; - if ( thumb_len-(int)thumb_len > 0.5 ) ++bot; - - if (bot < top + (int)sbw->scrollbar3d.min_thumb + - 2 * (int)sbw->threeD.shadow_width) - bot = top + sbw->scrollbar3d.min_thumb + - 2 * sbw->threeD.shadow_width; - - if ( bot >= floor ) { - top = floor-(bot-top)+1; - bot = floor; - } - - sbw->scrollbar3d.topLoc = top; - sbw->scrollbar3d.shownLength = bot - top; - -/* -// This pressed in look looks like crap, and doesn't -// get fixed, so take it out. BEW -// if (pressed && sbw->scrollbar3d.push_thumb) { -// top_shadow_GC = sbw->threeD.bot_shadow_GC; -// bot_shadow_GC = sbw->threeD.top_shadow_GC; -// } -// else { -*/ - top_shadow_GC = sbw->threeD.top_shadow_GC; - bot_shadow_GC = sbw->threeD.bot_shadow_GC; -/* -// } -*/ - - if (XtIsRealized ((Widget) sbw)) { - /* the space above the thumb */ - x = sw; - y = margin; - w = th - sw * 2; - h = top - y; - if (sbw->scrollbar3d.orientation == XtorientHorizontal) { - swap(&x, &y); - swap(&w, &h); - } - XFillRectangle(XtDisplay((Widget) sbw), XtWindow((Widget) sbw), - sbw->scrollbar3d.bgc, x, y, - (unsigned int) w, (unsigned int) h); - /* the space below the thumb */ - x = sw; - y = bot; - w = th - sw * 2; - h = tzl + margin - bot; - if (sbw->scrollbar3d.orientation == XtorientHorizontal) { - swap(&x, &y); - swap(&w, &h); - } - XFillRectangle(XtDisplay((Widget) sbw), XtWindow((Widget) sbw), - sbw->scrollbar3d.bgc, x, y, - (unsigned int) w, (unsigned int) h); - /* the thumb itself */ - x = sw * 2; - y = top + sw; - w = th - sw * 4; - h = bot - top - 2 * sw; - if (sbw->scrollbar3d.orientation == XtorientHorizontal) { - swap(&x, &y); - swap(&w, &h); - } - /* we can't use "w > 0" and "h > 0" because they are - usually unsigned quantities */ - if (th - sw * 4 > 0 && bot - top - 2 * sw > 0) - XFillRectangle(XtDisplay((Widget) sbw), XtWindow((Widget) sbw), - sbw->scrollbar3d.gc, x, y, - (unsigned int) w, (unsigned int) h); - /* the shades around the thumb - - o0 o3 - +--------------+ - |\ i0 i3 /| - | +----------+ | - | | | | - | | | | - | | | | - | +----------+ | - |/ i1 i2 \| - +--------------+ - o1 o2 - - */ - - opoint[0].x = opoint[1].x = sw; - opoint[0].y = opoint[3].y = top; - opoint[2].x = opoint[3].x = th - sw; - opoint[2].y = opoint[1].y = bot; - - ipoint[0].x = ipoint[1].x = opoint[0].x + sw; - ipoint[0].y = ipoint[3].y = opoint[0].y + sw; - ipoint[2].x = ipoint[3].x = opoint[2].x - sw; - ipoint[2].y = ipoint[1].y = opoint[2].y - sw; - - /* make sure shades don't overlap */ - if (ipoint[0].x > ipoint[3].x) - ipoint[3].x = ipoint[2].x = ipoint[1].x = ipoint[0].x - = (ipoint[0].x + ipoint[3].x) / 2; - if (ipoint[0].y > ipoint[1].y) - ipoint[3].y = ipoint[2].y = ipoint[1].y = ipoint[0].y - = (ipoint[0].y + ipoint[1].y) / 2; - if (sbw->scrollbar3d.orientation == XtorientHorizontal) { - int n; - for (n = 0; n < 4; n++) { - swap(&ipoint[n].x, &ipoint[n].y); - swap(&opoint[n].x, &opoint[n].y); - } - } - /* left */ - point[0] = opoint[0]; - point[1] = opoint[1]; - point[2] = ipoint[1]; - point[3] = ipoint[0]; - XFillPolygon (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), - top_shadow_GC, point, 4, Convex, CoordModeOrigin); - /* top */ - point[0] = opoint[0]; - point[1] = opoint[3]; - point[2] = ipoint[3]; - point[3] = ipoint[0]; - XFillPolygon (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), - top_shadow_GC, point, 4, Convex, CoordModeOrigin); - /* bottom */ - point[0] = opoint[1]; - point[1] = opoint[2]; - point[2] = ipoint[2]; - point[3] = ipoint[1]; - XFillPolygon (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), - bot_shadow_GC, point, 4, Convex, CoordModeOrigin); - /* right */ - point[0] = opoint[3]; - point[1] = opoint[2]; - point[2] = ipoint[2]; - point[3] = ipoint[3]; - XFillPolygon (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), - bot_shadow_GC, point, 4, Convex, CoordModeOrigin); - } -} - -/* - Draw the arrows for scrollbar3d. - Draw the corresponding arrow "pressed in" if - toppressed or botpressed is 1. - */ -static void PaintArrows (sbw, toppressed, botpressed) - Scrollbar3dWidget sbw; - int toppressed, botpressed; -{ - XPoint ipoint[6], opoint[6]; /* inner and outer points */ - XPoint rpoint[4]; /* the rectangle around arrows */ - XPoint tpoint[6]; /* temporary for args to XFillPolygon */ - Dimension sw = sbw->threeD.shadow_width; - Dimension th = sbw->scrollbar3d.thickness; - Dimension len = sbw->scrollbar3d.length; - GC top_shadow_GC, bot_shadow_GC; - - if (XtIsRealized ((Widget) sbw)) { - /* 3D arrows? - */ - if (sw) { - /* - The points are numbered like this: - - r0 r3 - +---------+ - | ^ o2 | - | /|\ | a = i0 - | /c^ \ | b = i1 - | / / \ \ | c = i2 - |/a<--->b\| - o0 +---------+ o1 - | | - | | - o3 +---------+ o4 - |\d<--->e/| - | \ \ / / | d = i3 - | \fv / | e = i4 - | \|/ | f = i5 - | v o5 | - +---------+ - r1 r2 - - */ - - rpoint[0].x = rpoint[1].x = opoint[0].x = opoint[3].x = sw; - ipoint[0].x = ipoint[3].x = sw * 2.5; - opoint[2].x = opoint[5].x = ipoint[2].x = ipoint[5].x = th / 2; - ipoint[1].x = ipoint[4].x = th - (int)(sw * 2.5); - rpoint[2].x = rpoint[3].x = opoint[1].x = opoint[4].x = th - sw; - - rpoint[0].y = rpoint[3].y = opoint[2].y = sw; - ipoint[2].y = sw * 3.2; - ipoint[0].y = ipoint[1].y = th - sw; - opoint[0].y = opoint[1].y = th; - opoint[3].y = opoint[4].y = len - th; - ipoint[3].y = ipoint[4].y = len - th + sw; - ipoint[5].y = len - (int)(sw * 3.2); - rpoint[1].y = rpoint[2].y = opoint[5].y = len - sw; - - /* some ugly kludges to make them look right */ - opoint[2].y--; - opoint[0].x--; - ipoint[2].y--; - ipoint[0].x--; - - /* make sure shades don't overlap */ - if (ipoint[0].x > ipoint[1].x) - ipoint[4].x = ipoint[3].x = ipoint[1].x = ipoint[0].x - = (ipoint[0].x + ipoint[1].x) / 2; - if (ipoint[0].y < ipoint[2].y) { - ipoint[2].y = ipoint[1].y = ipoint[0].y - = (ipoint[0].y + ipoint[2].y) / 2; - ipoint[5].y = ipoint[4].y = ipoint[3].y - = (ipoint[3].y + ipoint[5].y) / 2; - } - - /* horizontal arrows require that x and y coordinates be swapped */ - if (sbw->scrollbar3d.orientation == XtorientHorizontal) { - int n; - for (n = 0; n < 6; n++) { - swap(&ipoint[n].x, &ipoint[n].y); - swap(&opoint[n].x, &opoint[n].y); - } - for (n = 0; n < 4; n++) - swap(&rpoint[n].x, &rpoint[n].y); - } - /* draw the up/left arrow */ - if (toppressed) { - top_shadow_GC = sbw->threeD.bot_shadow_GC; - bot_shadow_GC = sbw->threeD.top_shadow_GC; - } - else { - top_shadow_GC = sbw->threeD.top_shadow_GC; - bot_shadow_GC = sbw->threeD.bot_shadow_GC; - } - /* top-left background */ - tpoint[0] = rpoint[0]; - tpoint[1] = opoint[0]; - tpoint[2] = opoint[2]; - XFillPolygon (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), - sbw->scrollbar3d.bgc, - tpoint, 3, - Convex, CoordModeOrigin); - /* top-right background */ - tpoint[0] = rpoint[3]; - tpoint[1] = opoint[2]; - tpoint[2] = opoint[1]; - XFillPolygon (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), - sbw->scrollbar3d.bgc, - tpoint, 3, - Convex, CoordModeOrigin); - /* the right shade */ - tpoint[0] = opoint[1]; - tpoint[1] = opoint[2]; - tpoint[2] = ipoint[2]; - tpoint[3] = ipoint[1]; - XFillPolygon (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), - bot_shadow_GC, - tpoint, 4, - Convex, CoordModeOrigin); - /* the left shade */ - tpoint[0] = opoint[2]; - tpoint[1] = opoint[0]; - tpoint[2] = ipoint[0]; - tpoint[3] = ipoint[2]; - XFillPolygon (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), - top_shadow_GC, - tpoint, 4, - Convex, CoordModeOrigin); - /* the bottom shade */ - tpoint[0] = opoint[0]; - tpoint[1] = opoint[1]; - tpoint[2] = ipoint[1]; - tpoint[3] = ipoint[0]; - XFillPolygon (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), - bot_shadow_GC, - tpoint, 4, - Convex, CoordModeOrigin); - /* the arrow itself */ - XFillPolygon (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), - sbw->scrollbar3d.gc, - ipoint, 3, - Convex, CoordModeOrigin); - - /* draw the down/right arrow */ - if (botpressed) { - top_shadow_GC = sbw->threeD.bot_shadow_GC; - bot_shadow_GC = sbw->threeD.top_shadow_GC; - } - else { - top_shadow_GC = sbw->threeD.top_shadow_GC; - bot_shadow_GC = sbw->threeD.bot_shadow_GC; - } - /* bottom-left background */ - tpoint[0] = rpoint[1]; - tpoint[1] = opoint[5]; - tpoint[2] = opoint[3]; - XFillPolygon (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), - sbw->scrollbar3d.bgc, - tpoint, 3, - Convex, CoordModeOrigin); - /* bottom-right background */ - tpoint[0] = rpoint[2]; - tpoint[1] = opoint[4]; - tpoint[2] = opoint[5]; - XFillPolygon (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), - sbw->scrollbar3d.bgc, - tpoint, 3, - Convex, CoordModeOrigin); - /* the left shade */ - tpoint[0] = opoint[3]; - tpoint[1] = opoint[5]; - tpoint[2] = ipoint[5]; - tpoint[3] = ipoint[3]; - XFillPolygon (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), - top_shadow_GC, - tpoint, 4, - Convex, CoordModeOrigin); - /* the right shade */ - tpoint[0] = opoint[5]; - tpoint[1] = opoint[4]; - tpoint[2] = ipoint[4]; - tpoint[3] = ipoint[5]; - XFillPolygon (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), - bot_shadow_GC, - tpoint, 4, - Convex, CoordModeOrigin); - /* the top shade */ - tpoint[0] = opoint[4]; - tpoint[1] = opoint[3]; - tpoint[2] = ipoint[3]; - tpoint[3] = ipoint[4]; - XFillPolygon (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), - top_shadow_GC, - tpoint, 4, - Convex, CoordModeOrigin); - /* the arrow itself */ - XFillPolygon (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), - sbw->scrollbar3d.gc, - ipoint+3, 3, - Convex, CoordModeOrigin); - } else { - tpoint[0] = opoint[0]; - tpoint[1] = opoint[1]; - tpoint[2] = opoint[2]; - tpoint[3] = opoint[3]; - tpoint[4] = opoint[4]; - tpoint[5] = opoint[5]; - - /* horizontal arrows require that x and y coordinates be swapped */ - if (sbw->scrollbar3d.orientation == XtorientHorizontal) { - int n; - for (n = 0; n < 6; n++) - swap(&tpoint[n].x, &tpoint[n].y); - } - /* draw the up/left arrow */ - XFillPolygon (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), - sbw->scrollbar3d.gc, - tpoint, 3, - Convex, CoordModeOrigin); - /* draw the down/right arrow */ - XFillPolygon (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), - sbw->scrollbar3d.gc, - tpoint+3, 3, - Convex, CoordModeOrigin); - } - } -} - -/* Function Name: Destroy - * Description: Called as the scrollbar3d is going away... - * Arguments: w - the scrollbar3d. - * Returns: nonw - */ -static void Destroy (w) - Widget w; -{ - Scrollbar3dWidget sbw = (Scrollbar3dWidget) w; - if(sbw->scrollbar3d.timer_id != (XtIntervalId) 0) - XtRemoveTimeOut (sbw->scrollbar3d.timer_id); - XtReleaseGC (w, sbw->scrollbar3d.gc); - XtReleaseGC (w, sbw->scrollbar3d.bgc); -} - -/* Function Name: CreateGC - * Description: Creates the GC. - * Arguments: w - the scrollbar3d widget. - * Returns: none. - */ - -static void CreateGC (w) - Widget w; -{ - Scrollbar3dWidget sbw = (Scrollbar3dWidget) w; - XGCValues gcValues; - XtGCMask mask; - unsigned int depth = 1; - - /* make GC for scrollbar3d background */ - if (sbw->threeD.be_nice_to_cmap || - DefaultDepthOfScreen (XtScreen(w)) == 1) { - mask = GCTile | GCFillStyle; - gcValues.tile = sbw->threeD.bot_shadow_pxmap; - gcValues.fill_style = FillTiled; - } else { - mask = GCForeground; - gcValues.foreground = sbw->scrollbar3d.background; - } - sbw->scrollbar3d.bgc = XtGetGC(w, mask, &gcValues); - - /* make GC for scrollbar3d foreground */ - if (sbw->scrollbar3d.thumb == XtUnspecifiedPixmap) { - sbw->scrollbar3d.thumb = XmuCreateStippledPixmap (XtScreen(w), - (Pixel) 0, (Pixel) 0, depth); - } else if (sbw->scrollbar3d.thumb != None) { - Window root; - int x, y; - unsigned int width, height, bw; - if (XGetGeometry (XtDisplay(w), sbw->scrollbar3d.thumb, &root, &x, &y, - &width, &height, &bw, &depth) == 0) { - XtAppError (XtWidgetToApplicationContext (w), - "Scrollbar3d Widget: Could not get geometry of thumb pixmap."); - } - } - - gcValues.foreground = sbw->scrollbar3d.foreground; - gcValues.background = sbw->core.background_pixel; - mask = GCForeground | GCBackground; - - if (sbw->scrollbar3d.thumb != None) { - if (depth == 1) { - gcValues.fill_style = FillOpaqueStippled; - gcValues.stipple = sbw->scrollbar3d.thumb; - mask |= GCFillStyle | GCStipple; - } - else { - gcValues.fill_style = FillTiled; - gcValues.tile = sbw->scrollbar3d.thumb; - mask |= GCFillStyle | GCTile; - } - } - /* the creation should be non-caching, because */ - /* we now set and clear clip masks on the gc returned */ - sbw->scrollbar3d.gc = XtGetGC (w, mask, &gcValues); - gcValues.foreground = sbw->scrollbar3d.foreground; - gcValues.background = sbw->core.background_pixel; - mask = GCForeground | GCBackground; -} - -static void SetDimensions (sbw) - Scrollbar3dWidget sbw; -{ - if (sbw->scrollbar3d.orientation == XtorientVertical) { - sbw->scrollbar3d.length = sbw->core.height; - sbw->scrollbar3d.thickness = sbw->core.width; - } else { - sbw->scrollbar3d.length = sbw->core.width; - sbw->scrollbar3d.thickness = sbw->core.height; - } -} - -/* ARGSUSED */ -static void Initialize( request, new, args, num_args ) - Widget request; /* what the client asked for */ - Widget new; /* what we're going to give him */ - ArgList args; - Cardinal *num_args; -{ - Scrollbar3dWidget sbw = (Scrollbar3dWidget) new; - - CreateGC (new); - - if (sbw->core.width == 0) - sbw->core.width = (sbw->scrollbar3d.orientation == XtorientVertical) - ? sbw->scrollbar3d.thickness : sbw->scrollbar3d.length; - - if (sbw->core.height == 0) - sbw->core.height = (sbw->scrollbar3d.orientation == XtorientHorizontal) - ? sbw->scrollbar3d.thickness : sbw->scrollbar3d.length; - - SetDimensions (sbw); - sbw->scrollbar3d.scroll_mode = 0; - sbw->scrollbar3d.timer_id = (XtIntervalId)0; - sbw->scrollbar3d.topLoc = 0; - sbw->scrollbar3d.shownLength = sbw->scrollbar3d.min_thumb; -} - -static void Realize (w, valueMask, attributes) - Widget w; - Mask *valueMask; - XSetWindowAttributes *attributes; -{ - Scrollbar3dWidget sbw = (Scrollbar3dWidget) w; - sbw->scrollbar3d.inactiveCursor = - (sbw->scrollbar3d.orientation == XtorientVertical) - ? sbw->scrollbar3d.verCursor - : sbw->scrollbar3d.horCursor; - - XtVaSetValues (w, XtNcursor, sbw->scrollbar3d.inactiveCursor, NULL); - /* - * The Simple3d widget actually stuffs the value in the valuemask. - */ - - (*scrollbar3dWidgetClass->core_class.superclass->core_class.realize) - (w, valueMask, attributes); -} - -/* ARGSUSED */ -static Boolean SetValues (current, request, desired, args, num_args) - Widget current, /* what I am */ - request, /* what he wants me to be */ - desired; /* what I will become */ - ArgList args; - Cardinal *num_args; -{ - Scrollbar3dWidget sbw = (Scrollbar3dWidget) current; - Scrollbar3dWidget dsbw = (Scrollbar3dWidget) desired; - Boolean redraw = FALSE; - -/* - * If these values are outside the acceptable range ignore them... - */ - - if (dsbw->scrollbar3d.top < 0.0 || dsbw->scrollbar3d.top > 1.0) - dsbw->scrollbar3d.top = sbw->scrollbar3d.top; - - if (dsbw->scrollbar3d.shown < 0.0 || dsbw->scrollbar3d.shown > 1.0) - dsbw->scrollbar3d.shown = sbw->scrollbar3d.shown; - -/* - * Change colors and stuff... - */ - if (XtIsRealized (desired)) { - if (sbw->scrollbar3d.foreground != dsbw->scrollbar3d.foreground || - sbw->core.background_pixel != dsbw->core.background_pixel || - sbw->scrollbar3d.background != dsbw->scrollbar3d.background) { - XtReleaseGC (desired, sbw->scrollbar3d.gc); - XtReleaseGC (desired, sbw->scrollbar3d.bgc); - CreateGC (desired); - redraw = TRUE; - } - if (sbw->scrollbar3d.top != dsbw->scrollbar3d.top || - sbw->scrollbar3d.shown != dsbw->scrollbar3d.shown) - redraw = TRUE; - } - return redraw; -} - -static void Resize (w) - Widget w; -{ - /* ForgetGravity has taken care of background, but thumb may - * have to move as a result of the new size. */ - SetDimensions ((Scrollbar3dWidget) w); - Redisplay (w, (XEvent*) NULL, (Region)NULL); -} - - -/* ARGSUSED */ -static void Redisplay (w, event, region) - Widget w; - XEvent *event; - Region region; -{ - Scrollbar3dWidget sbw = (Scrollbar3dWidget) w; - Scrollbar3dWidgetClass swclass = (Scrollbar3dWidgetClass) XtClass (w); - int x, y; - unsigned int width, height; - - (*swclass->threeD_class.shadowdraw) (w, event, region, FALSE); - x = y = 1; - width = sbw->core.width - 2; - height = sbw->core.height - 2; - if (region == NULL || - XRectInRegion (region, x, y, width, height) != RectangleOut) { - /* Forces entire thumb to be painted. */ - sbw->scrollbar3d.topLoc = -(sbw->scrollbar3d.length + 1); - PaintThumb (sbw, 0); - } - /* we'd like to be region aware here!!!! */ - PaintArrows (sbw, 0, 0); -} - -static Boolean CompareEvents (oldEvent, newEvent) - XEvent *oldEvent, *newEvent; -{ -#define Check(field) if (newEvent->field != oldEvent->field) return False; - - Check(xany.display); - Check(xany.type); - Check(xany.window); - - switch (newEvent->type) { - case MotionNotify: - Check(xmotion.state); - break; - case ButtonPress: - case ButtonRelease: - Check(xbutton.state); - Check(xbutton.button); - break; - case KeyPress: - case KeyRelease: - Check(xkey.state); - Check(xkey.keycode); - break; - case EnterNotify: - case LeaveNotify: - Check(xcrossing.mode); - Check(xcrossing.detail); - Check(xcrossing.state); - break; - } -#undef Check - - return True; -} - -struct EventData { - XEvent *oldEvent; - int count; -}; - -static Bool PeekNotifyEvent (dpy, event, args) - Display *dpy; - XEvent *event; - char *args; -{ - struct EventData *eventData = (struct EventData*)args; - - return ((++eventData->count == QLength(dpy)) /* since PeekIf blocks */ - || CompareEvents(event, eventData->oldEvent)); -} - - -static Boolean LookAhead (w, event) - Widget w; - XEvent *event; -{ - XEvent newEvent; - struct EventData eventData; - - if (QLength (XtDisplay (w)) == 0) return False; - - eventData.count = 0; - eventData.oldEvent = event; - - XPeekIfEvent (XtDisplay (w), &newEvent, PeekNotifyEvent, (char*)&eventData); - - return CompareEvents (event, &newEvent); -} - - -static void ExtractPosition (event, x, y) - XEvent *event; - Position *x, *y; /* RETURN */ -{ - switch( event->type ) { - case MotionNotify: - *x = event->xmotion.x; - *y = event->xmotion.y; - break; - case ButtonPress: - case ButtonRelease: - *x = event->xbutton.x; - *y = event->xbutton.y; - break; - case KeyPress: - case KeyRelease: - *x = event->xkey.x; - *y = event->xkey.y; - break; - case EnterNotify: - case LeaveNotify: - *x = event->xcrossing.x; - *y = event->xcrossing.y; - break; - default: - *x = 0; *y = 0; - } -} - -/* ARGSUSED */ -static void HandleThumb (w, event, params, num_params) - Widget w; - XEvent *event; - String *params; /* unused */ - Cardinal *num_params; /* unused */ -{ - Position x,y; - Scrollbar3dWidget sbw = (Scrollbar3dWidget) w; - - ExtractPosition( event, &x, &y ); - /* if the motion event puts the pointer in thumb, call Move and Notify */ - /* also call Move and Notify if we're already in continuous scroll mode */ - if (sbw->scrollbar3d.scroll_mode == 2 || - (PICKLENGTH (sbw,x,y) >= sbw->scrollbar3d.topLoc && - PICKLENGTH (sbw,x,y) <= (sbw->scrollbar3d.topLoc + - sbw->scrollbar3d.shownLength))){ - XtCallActionProc(w, "MoveThumb", event, params, *num_params); - XtCallActionProc(w, "NotifyThumb", event, params, *num_params); - } -} - -static void RepeatNotify (client_data, idp) - XtPointer client_data; - XtIntervalId *idp; -{ -#define A_FEW_PIXELS 5 - Scrollbar3dWidget sbw = (Scrollbar3dWidget) client_data; - int call_data; - - if (sbw->scrollbar3d.scroll_mode != 1 && sbw->scrollbar3d.scroll_mode != 3) { - sbw->scrollbar3d.timer_id = (XtIntervalId) 0; - return; - } - call_data = MAX (A_FEW_PIXELS, sbw->scrollbar3d.length / 20); - if (sbw->scrollbar3d.scroll_mode == 1) - call_data = -call_data; - XtCallCallbacks((Widget)sbw, XtNscrollProc, (XtPointer) call_data); - sbw->scrollbar3d.timer_id = - XtAppAddTimeOut(XtWidgetToApplicationContext((Widget)sbw), - (unsigned long) 150, - RepeatNotify, - client_data); -} - -/* - * Same as above, but for floating numbers. - */ - -static float FloatInRange(num, small, big) - float num, small, big; -{ - return (num < small) ? small : ((num > big) ? big : num); -} - - -static void NotifyScroll (w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; -{ - Scrollbar3dWidget sbw = (Scrollbar3dWidget) w; - int call_data; - Position x, y; - - if (sbw->scrollbar3d.scroll_mode == 2) return; /* if scroll continuous */ - - if (LookAhead (w, event)) return; - - ExtractPosition (event, &x, &y); - - if (PICKLENGTH (sbw,x,y) < sbw->scrollbar3d.thickness) { - /* handle first arrow zone */ - call_data = MAX (A_FEW_PIXELS, sbw->scrollbar3d.length / 20); - XtCallCallbacks (w, XtNscrollProc, (XtPointer)(-call_data)); - /* establish autoscroll */ - sbw->scrollbar3d.timer_id = - XtAppAddTimeOut (XtWidgetToApplicationContext (w), - (unsigned long) 300, RepeatNotify, (XtPointer)w); - sbw->scrollbar3d.scroll_mode = 1; - PaintArrows (sbw, 1, 0); - return; - } else if (PICKLENGTH (sbw,x,y) > sbw->scrollbar3d.length - - sbw->scrollbar3d.thickness) { - /* handle last arrow zone */ - call_data = MAX (A_FEW_PIXELS, sbw->scrollbar3d.length / 20); - XtCallCallbacks (w, XtNscrollProc, (XtPointer)(call_data)); - /* establish autoscroll */ - sbw->scrollbar3d.timer_id = - XtAppAddTimeOut (XtWidgetToApplicationContext (w), - (unsigned long) 300, RepeatNotify, (XtPointer)w); - sbw->scrollbar3d.scroll_mode = 3; - PaintArrows (sbw, 0, 1); - return; - } - else if (PICKLENGTH (sbw, x, y) < sbw->scrollbar3d.topLoc) { - /* handle zone "above" the thumb */ - call_data = -(sbw->scrollbar3d.length); -/* XtCallCallbacks (w, XtNscrollProc, (XtPointer)(call_data)) */ - return; - } else if (PICKLENGTH (sbw, x, y) > sbw->scrollbar3d.topLoc + - sbw->scrollbar3d.shownLength) { - /* handle zone "below" the thumb */ - call_data = sbw->scrollbar3d.length; -/* XtCallCallbacks (w, XtNscrollProc, (XtPointer)(call_data)) */ - return; - } else { - /* handle the thumb in the motion notify action */ - /* but we need to re-paint it "pressed in" here */ - PaintThumb (sbw, 1); - return; - } -} - -/* ARGSUSED */ -static void EndScroll(w, event, params, num_params ) - Widget w; - XEvent *event; /* unused */ - String *params; /* unused */ - Cardinal *num_params; /* unused */ -{ - Scrollbar3dWidget sbw = (Scrollbar3dWidget) w; - - sbw->scrollbar3d.scroll_mode = 0; - /* no need to remove any autoscroll timeout; it will no-op */ - /* because the scroll_mode is 0 */ - /* but be sure to remove timeout in destroy proc */ - /* release all buttons */ - PaintArrows (sbw, 0, 0); - PaintThumb (sbw, 0); -} - -static float FractionLoc (sbw, x, y) - Scrollbar3dWidget sbw; - int x, y; -{ - float result; - int margin; - float height, width; - - margin = MARGIN (sbw); - x -= margin; - y -= margin; - height = sbw->core.height - 2 * margin; - width = sbw->core.width - 2 * margin; - result = PICKLENGTH (sbw, x / width, y / height); - return FloatInRange(result, 0.0, 1.0); -} - - -static void MoveThumb (w, event, params, num_params) - Widget w; - XEvent *event; - String *params; /* unused */ - Cardinal *num_params; /* unused */ -{ - Scrollbar3dWidget sbw = (Scrollbar3dWidget) w; - Position x, y; - float loc, t, s; - - if (LookAhead (w, event)) return; - - if (!event->xmotion.same_screen) return; - - ExtractPosition (event, &x, &y); - loc = FractionLoc (sbw, x, y); - - /* This mod prevents motions in the arrows from doing anything */ - if (PICKLENGTH (sbw,x,y) < sbw->scrollbar3d.thickness) { - /* handle first arrow zone */ - return; - } else if (PICKLENGTH (sbw,x,y) > sbw->scrollbar3d.length - - sbw->scrollbar3d.thickness) { - /* handle last arrow zone */ - return; - } - - t = sbw->scrollbar3d.top; - s = sbw->scrollbar3d.shown; - if (sbw->scrollbar3d.scroll_mode != 2 ) - /* initialize picked position */ - sbw->scrollbar3d.picked = (FloatInRange(loc, t, t+s) - t); - if (sbw->scrollbar3d.pick_top) - sbw->scrollbar3d.top = loc; - else { - sbw->scrollbar3d.top = loc - sbw->scrollbar3d.picked; - if (sbw->scrollbar3d.top < 0.0) sbw->scrollbar3d.top = 0.0; - } - /* don't allow scrollbar3d to shrink at end */ - if (sbw->scrollbar3d.top + sbw->scrollbar3d.shown > 1.0) - sbw->scrollbar3d.top = 1.0 - sbw->scrollbar3d.shown + 0.001; - sbw->scrollbar3d.scroll_mode = 2; /* indicate continuous scroll */ - PaintThumb (sbw, 1); - XFlush (XtDisplay (w)); /* re-draw it before Notifying */ -} - -/* ARGSUSED */ -static void NotifyThumb (w, event, params, num_params ) - Widget w; - XEvent *event; - String *params; /* unused */ - Cardinal *num_params; /* unused */ -{ - Scrollbar3dWidget sbw = (Scrollbar3dWidget) w; - float top = sbw->scrollbar3d.top; - - - if (LookAhead (w, event)) return; - - /* thumbProc is not pretty, but is necessary for backwards - compatibility on those architectures for which it work{s,ed}; - the intent is to pass a (truncated) float by value. */ - /* This corrects for rounding errors: If the thumb is moved to the end of - the scrollable area sometimes the last line/column is not displayed. - This can happen when the integer number of the top line or leftmost - column to be be displayed is calculated from the float value - sbw->scrollbar3d.top. The numerical error of this rounding problem is - very small. We therefore add a small value which then forces the - next line/column (the correct one) to be used. Since we can expect - that the resolution of display screens will not be higher then - 10000 text lines/columns we add 1/10000 to the top position. The - intermediate variable `top' is used to avoid erroneous summing up - corrections (can this happen at all?). If the arrows are not displayed - there is no problem since in this case there is always a constant - integer number of pixels the thumb must be moved in order to scroll - to the next line/column. */ - top += 0.0001; - XtCallCallbacks (w, XtNthumbProc, *(XtPointer*)&top); - XtCallCallbacks (w, XtNjumpProc, (XtPointer)&top); -} - - - -/************************************************************ - * - * Public routines. - * - ************************************************************/ - -/* Set the scroll bar to the given location. */ - -#if NeedFunctionPrototypes -void XawScrollbar3dSetThumb (Widget w, -#if NeedWidePrototypes - double top, double shown) -#else - float top, float shown) -#endif -#else -void XawScrollbar3dSetThumb (w, top, shown) - Widget w; - float top, shown; -#endif -{ - Scrollbar3dWidget sbw = (Scrollbar3dWidget) w; - - if (sbw->scrollbar3d.scroll_mode == (char) 2) return; /* if still thumbing */ - - sbw->scrollbar3d.top = (top > 1.0) ? 1.0 : - (top >= 0.0) ? top : sbw->scrollbar3d.top; - - sbw->scrollbar3d.shown = (shown > 1.0) ? 1.0 : - (shown >= 0.0) ? shown : sbw->scrollbar3d.shown; - - /* don't allow scrollbar3d to shrink at end */ - if (sbw->scrollbar3d.top + sbw->scrollbar3d.shown > 1.0) - sbw->scrollbar3d.top = 1.0 - sbw->scrollbar3d.shown + 0.001; - - PaintThumb (sbw, 0); -} diff --git a/v/srcx/awsim3d.c b/v/srcx/awsim3d.c deleted file mode 100644 index b9f8ea2..0000000 --- a/v/srcx/awsim3d.c +++ /dev/null @@ -1,301 +0,0 @@ -/* $XConsortium: Simple.c,v 1.36 94/04/17 20:12:43 kaleb Exp $ */ - -/*********************************************************** - -Copyright (c) 1987, 1988, 1994 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ -/****************************************************************** -This code was taken directly from the Xaw3d distribution. -Several classes were used to make V look better. -The names of the classes have been changed to allow -standard Athena widgets to be used as well. - -I've not marked any of the changes specifically. - -Bruce Wampler - March 1, 1996 -******************************************************************/ - -#include -#include -#include -#include - -#define offset(field) XtOffsetOf(Simple3dRec, simple3d.field) - -static XtResource resources[] = { - {XtNcursor, XtCCursor, XtRCursor, sizeof(Cursor), - offset(cursor), XtRImmediate, (XtPointer) None}, - {XtNinsensitiveBorder, XtCInsensitive, XtRPixmap, sizeof(Pixmap), - offset(insensitive_border), XtRImmediate, (XtPointer) NULL}, - {XtNpointerColor, XtCForeground, XtRPixel, sizeof(Pixel), - offset(pointer_fg), XtRString, XtDefaultForeground}, - {XtNpointerColorBackground, XtCBackground, XtRPixel, sizeof(Pixel), - offset(pointer_bg), XtRString, XtDefaultBackground}, - {XtNcursorName, XtCCursor, XtRString, sizeof(String), - offset(cursor_name), XtRString, NULL}, - {XtNinternational, XtCInternational, XtRBoolean, sizeof(Boolean), - offset(international), XtRImmediate, (XtPointer) FALSE}, -#undef offset -}; - -static void ClassPartInitialize(), ClassInitialize(),Realize(),ConvertCursor(); -static Boolean SetValues(), ChangeSensitive(); - -Simple3dClassRec simple3dClassRec = { - { /* core fields */ - /* superclass */ (WidgetClass) &widgetClassRec, - /* class_name */ "Simple3d", - /* widget_size */ sizeof(Simple3dRec), - /* class_initialize */ ClassInitialize, - /* class_part_initialize */ ClassPartInitialize, - /* class_inited */ FALSE, - /* initialize */ NULL, - /* initialize_hook */ NULL, - /* realize */ Realize, - /* actions */ NULL, - /* num_actions */ 0, - /* resources */ resources, - /* num_resources */ XtNumber(resources), - /* xrm_class */ NULLQUARK, - /* compress_motion */ TRUE, - /* compress_exposure */ TRUE, - /* compress_enterleave */ TRUE, - /* visible_interest */ FALSE, - /* destroy */ NULL, - /* resize */ NULL, - /* expose */ NULL, - /* set_values */ SetValues, - /* set_values_hook */ NULL, - /* set_values_almost */ XtInheritSetValuesAlmost, - /* get_values_hook */ NULL, - /* accept_focus */ NULL, - /* version */ XtVersion, - /* callback_private */ NULL, - /* tm_table */ NULL, - /* query_geometry */ XtInheritQueryGeometry, - /* display_accelerator */ XtInheritDisplayAccelerator, - /* extension */ NULL - }, - { /* simple3d fields */ - /* change_sensitive */ ChangeSensitive - } -}; - -WidgetClass simple3dWidgetClass = (WidgetClass)&simple3dClassRec; - -static void ClassInitialize() -{ - static XtConvertArgRec convertArg[] = { - {XtWidgetBaseOffset, (XtPointer) XtOffsetOf(WidgetRec, core.screen), - sizeof(Screen *)}, - {XtResourceString, (XtPointer) XtNpointerColor, sizeof(Pixel)}, - {XtResourceString, (XtPointer) XtNpointerColorBackground, - sizeof(Pixel)}, - {XtWidgetBaseOffset, (XtPointer) XtOffsetOf(WidgetRec, core.colormap), - sizeof(Colormap)} - }; - - XtSetTypeConverter( XtRString, XtRColorCursor, XmuCvtStringToColorCursor, - convertArg, XtNumber(convertArg), - XtCacheByDisplay, (XtDestructor)NULL); -} - -static void ClassPartInitialize(class) - WidgetClass class; -{ - Simple3dWidgetClass c = (Simple3dWidgetClass) class; - Simple3dWidgetClass super = (Simple3dWidgetClass) - c->core_class.superclass; - - if (c->simple3d_class.change_sensitive == NULL) { - char buf[256]; - - (void) sprintf(buf, - "%s Widget: The Simple3d Widget class method 'change_sensitive' is undefined.\nA function must be defined or inherited.", - c->core_class.class_name); - XtWarning(buf); - c->simple3d_class.change_sensitive = ChangeSensitive; - } - - if (c->simple3d_class.change_sensitive == XtInheritChangeSensitive) - c->simple3d_class.change_sensitive = super->simple3d_class.change_sensitive; -} - -static void Realize(w, valueMask, attributes) - Widget w; - Mask *valueMask; - XSetWindowAttributes *attributes; -{ - Pixmap border_pixmap = 0; - if (!XtIsSensitive(w)) { - /* change border to gray; have to remember the old one, - * so XtDestroyWidget deletes the proper one */ - if (((Simple3dWidget)w)->simple3d.insensitive_border == None) - ((Simple3dWidget)w)->simple3d.insensitive_border = - XmuCreateStippledPixmap(XtScreen(w), - w->core.border_pixel, - w->core.background_pixel, - w->core.depth); - border_pixmap = w->core.border_pixmap; - attributes->border_pixmap = - w->core.border_pixmap = ((Simple3dWidget)w)->simple3d.insensitive_border; - - *valueMask |= CWBorderPixmap; - *valueMask &= ~CWBorderPixel; - } - - ConvertCursor(w); - - if ((attributes->cursor = ((Simple3dWidget)w)->simple3d.cursor) != None) - *valueMask |= CWCursor; - - XtCreateWindow( w, (unsigned int)InputOutput, (Visual *)CopyFromParent, - *valueMask, attributes ); - - if (!XtIsSensitive(w)) - w->core.border_pixmap = border_pixmap; -} - -/* Function Name: ConvertCursor - * Description: Converts a name to a new cursor. - * Arguments: w - the simple3d widget. - * Returns: none. - */ - -static void -ConvertCursor(w) -Widget w; -{ - Simple3dWidget simple3d = (Simple3dWidget) w; - XrmValue from, to; - Cursor cursor; - - if (simple3d->simple3d.cursor_name == NULL) - return; - - from.addr = (XPointer) simple3d->simple3d.cursor_name; - from.size = strlen((char *) from.addr) + 1; - - to.size = sizeof(Cursor); - to.addr = (XPointer) &cursor; - - if (XtConvertAndStore(w, XtRString, &from, XtRColorCursor, &to)) { - if ( cursor != None) - simple3d->simple3d.cursor = cursor; - } - else { - XtAppErrorMsg(XtWidgetToApplicationContext(w), - "convertFailed","ConvertCursor","XawError", - "Simple3d: ConvertCursor failed.", - (String *)NULL, (Cardinal *)NULL); - } -} - - -/* ARGSUSED */ -static Boolean SetValues(current, request, new, args, num_args) - Widget current, request, new; - ArgList args; - Cardinal *num_args; -{ - Simple3dWidget s_old = (Simple3dWidget) current; - Simple3dWidget s_new = (Simple3dWidget) new; - Boolean new_cursor = FALSE; - - /* this disables user changes after creation*/ - s_new->simple3d.international = s_old->simple3d.international; - - if ( XtIsSensitive(current) != XtIsSensitive(new) ) - (*((Simple3dWidgetClass)XtClass(new))-> - simple3d_class.change_sensitive) ( new ); - - if (s_old->simple3d.cursor != s_new->simple3d.cursor) { - new_cursor = TRUE; - } - -/* - * We are not handling the string cursor_name correctly here. - */ - - if ( (s_old->simple3d.pointer_fg != s_new->simple3d.pointer_fg) || - (s_old->simple3d.pointer_bg != s_new->simple3d.pointer_bg) || - (s_old->simple3d.cursor_name != s_new->simple3d.cursor_name) ) { - ConvertCursor(new); - new_cursor = TRUE; - } - - if (new_cursor && XtIsRealized(new)) - XDefineCursor(XtDisplay(new), XtWindow(new), s_new->simple3d.cursor); - - return False; -} - - -static Boolean ChangeSensitive(w) - Widget w; -{ - if (XtIsRealized(w)) { - if (XtIsSensitive(w)) - if (w->core.border_pixmap != XtUnspecifiedPixmap) - XSetWindowBorderPixmap( XtDisplay(w), XtWindow(w), - w->core.border_pixmap ); - else - XSetWindowBorder( XtDisplay(w), XtWindow(w), - w->core.border_pixel ); - else { - if (((Simple3dWidget)w)->simple3d.insensitive_border == None) - ((Simple3dWidget)w)->simple3d.insensitive_border = - XmuCreateStippledPixmap(XtScreen(w), - w->core.border_pixel, - w->core.background_pixel, - w->core.depth); - XSetWindowBorderPixmap( XtDisplay(w), XtWindow(w), - ((Simple3dWidget)w)-> - simple3d.insensitive_border ); - } - } - return False; -} diff --git a/v/srcx/awsld3d.c b/v/srcx/awsld3d.c deleted file mode 100644 index 005e34f..0000000 --- a/v/srcx/awsld3d.c +++ /dev/null @@ -1,975 +0,0 @@ - -/* MODIFIED ATHENA SCROLLBAR (USING ARROWHEADS AT ENDS OF TRAVEL) */ -/* Modifications Copyright 1992 by Mitch Trachtenberg */ -/* Rights, permissions, and disclaimer of warranty are as in the */ -/* DEC and MIT notice below. */ -/* $XConsortium: Slider3d.c,v 1.72 94/04/17 20:12:40 kaleb Exp $ */ - -/*********************************************************** - -Copyright (c) 1987, 1988, 1994 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ -/****************************************************************** -This code was taken directly from the Xaw3d distribution. -Several classes were used to make V look better. -The names of the classes have been changed to allow -standard Athena widgets to be used as well. - -I've not marked any of the changes specifically. - -This new widget is a combination slider and progress bar modified -from the original scrollbar. I'm combining them so that V will -still work with vanilla Athena widgets. - -Bruce Wampler - March 1, 1996 -******************************************************************/ - - -#include -#include - -#include - -#include - -/* Private definitions. */ - -static char defaultTranslations[] = - ": StartScroll(Forward) \n\ - : NotifyScroll(Proportional) EndScroll()"; - -static float floatZero = 0.0; - -#define Offset(field) XtOffsetOf(Slider3dRec, field) - -static XtResource resources[] = { - {XtNscrollVCursor, XtCCursor, XtRCursor, sizeof(Cursor), - Offset(slider3d.verCursor), XtRString, "sb_v_double_arrow"}, - {XtNscrollHCursor, XtCCursor, XtRCursor, sizeof(Cursor), - Offset(slider3d.horCursor), XtRString, "sb_h_double_arrow"}, - {XtNlength, XtCLength, XtRDimension, sizeof(Dimension), - Offset(slider3d.length), XtRImmediate, (XtPointer) 1}, - {XtNthickness, XtCThickness, XtRDimension, sizeof(Dimension), - Offset(slider3d.thickness), XtRImmediate, (XtPointer) 14}, - {XtNorientation, XtCOrientation, XtROrientation, sizeof(XtOrientation), - Offset(slider3d.orientation), XtRImmediate, (XtPointer) XtorientVertical}, - {XtNscrollProc, XtCCallback, XtRCallback, sizeof(XtPointer), - Offset(slider3d.scrollProc), XtRCallback, NULL}, - {XtNthumbProc, XtCCallback, XtRCallback, sizeof(XtPointer), - Offset(slider3d.thumbProc), XtRCallback, NULL}, - {XtNjumpProc, XtCCallback, XtRCallback, sizeof(XtPointer), - Offset(slider3d.jumpProc), XtRCallback, NULL}, - {XtNthumb, XtCThumb, XtRBitmap, sizeof(Pixmap), - Offset(slider3d.thumb), XtRImmediate, (XtPointer) XtUnspecifiedPixmap}, - {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), - Offset(slider3d.foreground), XtRString, XtDefaultForeground}, - {XtNslider3dBackground, XtCSlider3dBackground, XtRPixel, sizeof(Pixel), - Offset(slider3d.background), XtRString, XtDefaultForeground}, - {XtNshown, XtCShown, XtRFloat, sizeof(float), - Offset(slider3d.shown), XtRFloat, (XtPointer)&floatZero}, - {XtNtopOfThumb, XtCTopOfThumb, XtRFloat, sizeof(float), - Offset(slider3d.top), XtRFloat, (XtPointer)&floatZero}, - {XtNminimumThumb, XtCMinimumThumb, XtRDimension, sizeof(Dimension), - Offset(slider3d.min_thumb), XtRImmediate, (XtPointer) 0}, - {XtNprogressVal, XtCProgressVal, XtRDimension, sizeof(Dimension), - Offset(slider3d.progressVal), XtRImmediate, (XtPointer) 1}, - {XtNisProgress, XtCIsProgress, XtRBoolean, sizeof(Boolean), - Offset(slider3d.isProgress), XtRImmediate, (XtPointer) False}, - {XtNshowProgressVal, XtCShowProgressVal, XtRBoolean, sizeof(Boolean), - Offset(slider3d.showProgressVal), XtRImmediate, (XtPointer) True}, - {XtNusePercent, XtCUsePercent, XtRBoolean, sizeof(Boolean), - Offset(slider3d.usePercent), XtRImmediate, (XtPointer) True}, -}; -#undef Offset - -static void ClassInitialize(); -static void Initialize(); -static void Destroy(); -static void Realize(); -static void Resize(); -static void Redisplay(); -static Boolean SetValues(); - -static void StartScroll(); -static void MoveThumb(); -static void NotifyThumb(); -static void NotifyScroll(); -static void EndScroll(); - -static XtActionsRec actions[] = { - {"StartScroll", StartScroll}, - {"MoveThumb", MoveThumb}, - {"NotifyThumb", NotifyThumb}, - {"NotifyScroll", NotifyScroll}, - {"EndScroll", EndScroll} -}; - - -Slider3dClassRec slider3dClassRec = { - { /* core fields */ - /* superclass */ (WidgetClass) &threeDClassRec, - /* class_name */ "Slider3d", - /* size */ sizeof(Slider3dRec), - /* class_initialize */ ClassInitialize, - /* class_part_init */ NULL, - /* class_inited */ FALSE, - /* initialize */ Initialize, - /* initialize_hook */ NULL, - /* realize */ Realize, - /* actions */ actions, - /* num_actions */ XtNumber(actions), - /* resources */ resources, - /* num_resources */ XtNumber(resources), - /* xrm_class */ NULLQUARK, - /* compress_motion */ TRUE, - /* compress_exposure*/ TRUE, - /* compress_enterleave*/ TRUE, - /* visible_interest */ FALSE, - /* destroy */ Destroy, - /* resize */ Resize, - /* expose */ Redisplay, - /* set_values */ SetValues, - /* set_values_hook */ NULL, - /* set_values_almost */ XtInheritSetValuesAlmost, - /* get_values_hook */ NULL, - /* accept_focus */ NULL, - /* version */ XtVersion, - /* callback_private */ NULL, - /* tm_table */ defaultTranslations, - /* query_geometry */ XtInheritQueryGeometry, - /* display_accelerator*/ XtInheritDisplayAccelerator, - /* extension */ NULL - }, - { /* simple fields */ - /* change_sensitive */ XtInheritChangeSensitive - }, - { /* threeD fields */ - /* shadowdraw */ XtInheritXaw3dShadowDraw - }, - { /* slider3d fields */ - /* ignore */ 0 - } - -}; - -WidgetClass slider3dWidgetClass = (WidgetClass)&slider3dClassRec; - -#define NoButton -1 -#define PICKLENGTH(widget, x, y) \ - ((widget->slider3d.orientation == XtorientHorizontal) ? (x) : (y)) -#define MIN(x,y) ((x) < (y) ? (x) : (y)) -#define MAX(x,y) ((x) > (y) ? (x) : (y)) - -static void ClassInitialize() -{ - XtAddConverter( XtRString, XtROrientation, XmuCvtStringToOrientation, - (XtConvertArgList)NULL, (Cardinal)0 ); -} - -#define MARGIN(sbw) (sbw)->threeD.shadow_width - -/* - Used to swap X and Y coordinates when the slider3d is horizontal. - */ -static void swap(a, b) - Dimension *a, *b; -{ - Dimension tmp = *a; - *a = *b; - *b = tmp; -} - -/* - Paint the thumb in the area specified by sbw->top and sbw->shown. - The old area is erased. No special tricks, draws the entire scollbar - over every time but doesn't draw the same region twice during a - single call to PaintThumb so there shouldn't be any flicker. - */ - -static void PaintThumb (sbw, pressed) - Slider3dWidget sbw; - int pressed; -{ - Dimension margin, tzl; - Position floor; - Position top, bot; - Dimension x, y; /* upper-left corner of rectangle */ - Dimension w, h; /* size of rectangle */ - Dimension sw = sbw->threeD.shadow_width; - Dimension th = sbw->slider3d.thickness; - XPoint ipoint[4],opoint[4]; /* inner and outer points of thumb */ - XPoint point[4]; /* points used for drawing */ - GC top_shadow_GC, bot_shadow_GC; - double thumb_len; - - int lblx, lbly, lblw, lblh; - - margin = MARGIN (sbw); - tzl = sbw->slider3d.length - 2*margin; - floor = sbw->slider3d.length - margin; - - top = margin + (int)(tzl * sbw->slider3d.top); - thumb_len = tzl * sbw->slider3d.shown; - bot = top + (int)thumb_len; - if ( thumb_len-(int)thumb_len > 0.5 ) ++bot; - - if (bot < top + (int)sbw->slider3d.min_thumb + - 2 * (int)sbw->threeD.shadow_width) - bot = top + sbw->slider3d.min_thumb + - 2 * sbw->threeD.shadow_width; - - if ( bot >= floor ) { - top = floor-(bot-top)+1; - bot = floor; - } - - sbw->slider3d.topLoc = top; - sbw->slider3d.shownLength = bot - top; - - top_shadow_GC = sbw->threeD.top_shadow_GC; - bot_shadow_GC = sbw->threeD.bot_shadow_GC; - - if (XtIsRealized ((Widget) sbw)) { - /* the space above the thumb */ - x = sw; - y = margin; - w = th - sw * 2; - h = top - y; - if (sbw->slider3d.orientation == XtorientHorizontal) { - swap(&x, &y); - swap(&w, &h); - } - lblx = x; lbly = y; lblw = w; lblh = tzl; - XFillRectangle(XtDisplay((Widget) sbw), XtWindow((Widget) sbw), - sbw->slider3d.bgc, x, y, - (unsigned int) w, (unsigned int) h); - /* the space below the thumb */ - x = sw; - y = bot; - w = th - sw * 2; - h = tzl + margin - bot; - if (sbw->slider3d.orientation == XtorientHorizontal) { - swap(&x, &y); - swap(&w, &h); - } - XFillRectangle(XtDisplay((Widget) sbw), XtWindow((Widget) sbw), - sbw->slider3d.bgc, x, y, - (unsigned int) w, (unsigned int) h); - - - /* the thumb itself */ - x = sw * 2; - y = top + sw; - w = th - sw * 4; - h = bot - top - 2 * sw; - if (sbw->slider3d.orientation == XtorientHorizontal) { - swap(&x, &y); - swap(&w, &h); - } - /* we can't use "w > 0" and "h > 0" because they are - usually unsigned quantities */ - if (th - sw * 4 > 0 && bot - top - 2 * sw > 0) - { - XFillRectangle(XtDisplay((Widget) sbw), XtWindow((Widget) sbw), - sbw->slider3d.gc, x, y, - (unsigned int) w, (unsigned int) h); - } - - - /* This code draws the little indent on sliders BEW 3/2/96 */ - - if (!sbw->slider3d.isProgress) - { - if (sbw->slider3d.orientation == XtorientHorizontal) - { - XFillRectangle(XtDisplay((Widget) sbw), XtWindow((Widget) sbw), - bot_shadow_GC, x+(w/2)-1, y+1, 1, h-2); - XFillRectangle(XtDisplay((Widget) sbw), XtWindow((Widget) sbw), - top_shadow_GC, x+(w/2), y+1, 1, h-2); - } - else - { - XFillRectangle(XtDisplay((Widget) sbw), XtWindow((Widget) sbw), - bot_shadow_GC, x+1, y+(h/2)-1, w-2, 1); - XFillRectangle(XtDisplay((Widget) sbw), XtWindow((Widget) sbw), - top_shadow_GC, x+1, y+(h/2), w-2, 1); - } - } -#ifdef DRAWPROGRESSVALUES - /* This is the start of the code needed to draw a text value - in a scroll bar, but it just doesn't look good yet. Maybe - someday I'll finish this... BEW 3/2/96 */ - else if (sbw->slider3d.showProgressVal) /* is progress - show it? */ - { - if (sbw->slider3d.orientation == XtorientHorizontal) - { - XDrawImageString(XtDisplay((Widget) sbw), XtWindow((Widget) sbw), - top_shadow_GC, lblx+(lblh/2)-10, lbly+10, "100%",4); - } - else - { - XDrawImageString(XtDisplay((Widget) sbw), XtWindow((Widget) sbw), - top_shadow_GC, lblx, lbly+(lblh/2)+5, "100%",4); - } - } -#endif - - /* the shades around the thumb - - o0 o3 - +--------------+ - |\ i0 i3 /| - | +----------+ | - | | | | - | | | | - | | | | - | +----------+ | - |/ i1 i2 \| - +--------------+ - o1 o2 - - */ - - opoint[0].x = opoint[1].x = sw; - opoint[0].y = opoint[3].y = top; - opoint[2].x = opoint[3].x = th - sw; - opoint[2].y = opoint[1].y = bot; - - ipoint[0].x = ipoint[1].x = opoint[0].x + sw; - ipoint[0].y = ipoint[3].y = opoint[0].y + sw; - ipoint[2].x = ipoint[3].x = opoint[2].x - sw; - ipoint[2].y = ipoint[1].y = opoint[2].y - sw; - - /* make sure shades don't overlap */ - if (ipoint[0].x > ipoint[3].x) - ipoint[3].x = ipoint[2].x = ipoint[1].x = ipoint[0].x - = (ipoint[0].x + ipoint[3].x) / 2; - if (ipoint[0].y > ipoint[1].y) - ipoint[3].y = ipoint[2].y = ipoint[1].y = ipoint[0].y - = (ipoint[0].y + ipoint[1].y) / 2; - if (sbw->slider3d.orientation == XtorientHorizontal) { - int n; - for (n = 0; n < 4; n++) { - swap(&ipoint[n].x, &ipoint[n].y); - swap(&opoint[n].x, &opoint[n].y); - } - } - /* left */ - point[0] = opoint[0]; - point[1] = opoint[1]; - point[2] = ipoint[1]; - point[3] = ipoint[0]; - if (sbw->slider3d.shown == 0.0) - XFillPolygon (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), - sbw->slider3d.bgc, point, 4, Convex, CoordModeOrigin); - else - XFillPolygon (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), - top_shadow_GC, point, 4, Convex, CoordModeOrigin); - /* top */ - point[0] = opoint[0]; - point[1] = opoint[3]; - point[2] = ipoint[3]; - point[3] = ipoint[0]; - if (sbw->slider3d.shown == 0.0) - XFillPolygon (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), - sbw->slider3d.bgc, point, 4, Convex, CoordModeOrigin); - else - XFillPolygon (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), - top_shadow_GC, point, 4, Convex, CoordModeOrigin); - /* bottom */ - point[0] = opoint[1]; - point[1] = opoint[2]; - point[2] = ipoint[2]; - point[3] = ipoint[1]; - if (sbw->slider3d.shown == 0.0) - XFillPolygon (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), - sbw->slider3d.bgc, point, 4, Convex, CoordModeOrigin); - else - XFillPolygon (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), - bot_shadow_GC, point, 4, Convex, CoordModeOrigin); - /* right */ - point[0] = opoint[3]; - point[1] = opoint[2]; - point[2] = ipoint[2]; - point[3] = ipoint[3]; - if (sbw->slider3d.shown == 0.0) - XFillPolygon (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), - sbw->slider3d.bgc, point, 4, Convex, CoordModeOrigin); - else - XFillPolygon (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), - bot_shadow_GC, point, 4, Convex, CoordModeOrigin); - } -} - -/* Function Name: Destroy - * Description: Called as the slider3d is going away... - * Arguments: w - the slider3d. - * Returns: nonw - */ -static void Destroy (w) - Widget w; -{ - Slider3dWidget sbw = (Slider3dWidget) w; - XtReleaseGC (w, sbw->slider3d.gc); - XtReleaseGC (w, sbw->slider3d.bgc); -} - -/* Function Name: CreateGC - * Description: Creates the GC. - * Arguments: w - the slider3d widget. - * Returns: none. - */ - -static void CreateGC (w) - Widget w; -{ - Slider3dWidget sbw = (Slider3dWidget) w; - XGCValues gcValues; - XtGCMask mask; - unsigned int depth = 1; - - /* make GC for slider3d background */ - if (sbw->threeD.be_nice_to_cmap || - DefaultDepthOfScreen (XtScreen(w)) == 1) { - mask = GCTile | GCFillStyle; - gcValues.tile = sbw->threeD.bot_shadow_pxmap; - gcValues.fill_style = FillTiled; - } else { - mask = GCForeground; - gcValues.foreground = sbw->slider3d.background; - } - sbw->slider3d.bgc = XtGetGC(w, mask, &gcValues); - - /* make GC for slider3d foreground */ - if (sbw->slider3d.thumb == XtUnspecifiedPixmap) { - sbw->slider3d.thumb = XmuCreateStippledPixmap (XtScreen(w), - (Pixel) 0, (Pixel) 0, depth); - } else if (sbw->slider3d.thumb != None) { - Window root; - int x, y; - unsigned int width, height, bw; - if (XGetGeometry (XtDisplay(w), sbw->slider3d.thumb, &root, &x, &y, - &width, &height, &bw, &depth) == 0) { - XtAppError (XtWidgetToApplicationContext (w), - "Slider3d Widget: Could not get geometry of thumb pixmap."); - } - } - - gcValues.foreground = sbw->slider3d.foreground; - gcValues.background = sbw->core.background_pixel; - mask = GCForeground | GCBackground; - - if (sbw->slider3d.thumb != None) { - if (depth == 1) { - gcValues.fill_style = FillOpaqueStippled; - gcValues.stipple = sbw->slider3d.thumb; - mask |= GCFillStyle | GCStipple; - } - else { - gcValues.fill_style = FillTiled; - gcValues.tile = sbw->slider3d.thumb; - mask |= GCFillStyle | GCTile; - } - } - /* the creation should be non-caching, because */ - /* we now set and clear clip masks on the gc returned */ - sbw->slider3d.gc = XtGetGC (w, mask, &gcValues); - gcValues.foreground = sbw->slider3d.foreground; - gcValues.background = sbw->core.background_pixel; - mask = GCForeground | GCBackground; -} - -static void SetDimensions (sbw) - Slider3dWidget sbw; -{ - if (sbw->slider3d.orientation == XtorientVertical) { - sbw->slider3d.length = sbw->core.height; - sbw->slider3d.thickness = sbw->core.width; - } else { - sbw->slider3d.length = sbw->core.width; - sbw->slider3d.thickness = sbw->core.height; - } -} - -/* ARGSUSED */ -static void Initialize( request, new, args, num_args ) - Widget request; /* what the client asked for */ - Widget new; /* what we're going to give him */ - ArgList args; - Cardinal *num_args; -{ - Slider3dWidget sbw = (Slider3dWidget) new; - - CreateGC (new); - - if (sbw->core.width == 0) - sbw->core.width = (sbw->slider3d.orientation == XtorientVertical) - ? sbw->slider3d.thickness : sbw->slider3d.length; - - if (sbw->core.height == 0) - sbw->core.height = (sbw->slider3d.orientation == XtorientHorizontal) - ? sbw->slider3d.thickness : sbw->slider3d.length; - - SetDimensions (sbw); - sbw->slider3d.topLoc = 0; - sbw->slider3d.shownLength = sbw->slider3d.min_thumb; -} - -static void Realize (w, valueMask, attributes) - Widget w; - Mask *valueMask; - XSetWindowAttributes *attributes; -{ - Slider3dWidget sbw = (Slider3dWidget) w; - - sbw->slider3d.inactiveCursor = - (sbw->slider3d.orientation == XtorientVertical) - ? sbw->slider3d.verCursor - : sbw->slider3d.horCursor; - - XtVaSetValues (w, XtNcursor, sbw->slider3d.inactiveCursor, NULL); - /* - * The Simple3d widget actually stuffs the value in the valuemask. - */ - - (*slider3dWidgetClass->core_class.superclass->core_class.realize) - (w, valueMask, attributes); -} - -/* ARGSUSED */ -static Boolean SetValues (current, request, desired, args, num_args) - Widget current, /* what I am */ - request, /* what he wants me to be */ - desired; /* what I will become */ - ArgList args; - Cardinal *num_args; -{ - Slider3dWidget sbw = (Slider3dWidget) current; - Slider3dWidget dsbw = (Slider3dWidget) desired; - Boolean redraw = FALSE; - -/* - * If these values are outside the acceptable range ignore them... - */ - - if (dsbw->slider3d.top < 0.0 || dsbw->slider3d.top > 1.0) - dsbw->slider3d.top = sbw->slider3d.top; - - if (dsbw->slider3d.shown < 0.0 || dsbw->slider3d.shown > 1.0) - dsbw->slider3d.shown = sbw->slider3d.shown; - -/* - * Change colors and stuff... - */ - if (XtIsRealized (desired)) { - if (sbw->slider3d.foreground != dsbw->slider3d.foreground || - sbw->core.background_pixel != dsbw->core.background_pixel || - sbw->slider3d.background != dsbw->slider3d.background) { - XtReleaseGC (desired, sbw->slider3d.gc); - XtReleaseGC (desired, sbw->slider3d.bgc); - CreateGC (desired); - redraw = TRUE; - } - if (sbw->slider3d.top != dsbw->slider3d.top || - sbw->slider3d.shown != dsbw->slider3d.shown) - redraw = TRUE; - } - return redraw; -} - -static void Resize (w) - Widget w; -{ - /* ForgetGravity has taken care of background, but thumb may - * have to move as a result of the new size. */ - SetDimensions ((Slider3dWidget) w); - Redisplay (w, (XEvent*) NULL, (Region)NULL); -} - - -/* ARGSUSED */ -static void Redisplay (w, event, region) - Widget w; - XEvent *event; - Region region; -{ - Slider3dWidget sbw = (Slider3dWidget) w; - Slider3dWidgetClass swclass = (Slider3dWidgetClass) XtClass (w); - int x, y; - unsigned int width, height; - - (*swclass->threeD_class.shadowdraw) (w, event, region, FALSE); - x = y = 1; - width = sbw->core.width - 2; - height = sbw->core.height - 2; - if (region == NULL || - XRectInRegion (region, x, y, width, height) != RectangleOut) { - /* Forces entire thumb to be painted. */ - sbw->slider3d.topLoc = -(sbw->slider3d.length + 1); - PaintThumb (sbw, 0); - } -} - -static Boolean CompareEvents (oldEvent, newEvent) - XEvent *oldEvent, *newEvent; -{ -#define Check(field) if (newEvent->field != oldEvent->field) return False; - - Check(xany.display); - Check(xany.type); - Check(xany.window); - - switch (newEvent->type) { - case MotionNotify: - Check(xmotion.state); - break; - case ButtonPress: - case ButtonRelease: - Check(xbutton.state); - Check(xbutton.button); - break; - case KeyPress: - case KeyRelease: - Check(xkey.state); - Check(xkey.keycode); - break; - case EnterNotify: - case LeaveNotify: - Check(xcrossing.mode); - Check(xcrossing.detail); - Check(xcrossing.state); - break; - } -#undef Check - - return True; -} - -struct EventData { - XEvent *oldEvent; - int count; -}; - -static Bool PeekNotifyEvent (dpy, event, args) - Display *dpy; - XEvent *event; - char *args; -{ - struct EventData *eventData = (struct EventData*)args; - - return ((++eventData->count == QLength(dpy)) /* since PeekIf blocks */ - || CompareEvents(event, eventData->oldEvent)); -} - - -static Boolean LookAhead (w, event) - Widget w; - XEvent *event; -{ - XEvent newEvent; - struct EventData eventData; - - if (QLength (XtDisplay (w)) == 0) return False; - - eventData.count = 0; - eventData.oldEvent = event; - - XPeekIfEvent (XtDisplay (w), &newEvent, PeekNotifyEvent, (char*)&eventData); - - return CompareEvents (event, &newEvent); -} - - -static void ExtractPosition (event, x, y) - XEvent *event; - Position *x, *y; /* RETURN */ -{ - switch( event->type ) { - case MotionNotify: - *x = event->xmotion.x; - *y = event->xmotion.y; - break; - case ButtonPress: - case ButtonRelease: - *x = event->xbutton.x; - *y = event->xbutton.y; - break; - case KeyPress: - case KeyRelease: - *x = event->xkey.x; - *y = event->xkey.y; - break; - case EnterNotify: - case LeaveNotify: - *x = event->xcrossing.x; - *y = event->xcrossing.y; - break; - default: - *x = 0; *y = 0; - } -} - -/* ARGSUSED */ -static void StartScroll (w, event, params, num_params ) - Widget w; - XEvent *event; - String *params; /* direction: Back|Forward|Smooth */ - Cardinal *num_params; /* we only support 1 */ -{ - Slider3dWidget sbw = (Slider3dWidget) w; - Cursor cursor; - char direction; - - if (sbw->slider3d.direction != 0) return; /* if we're already scrolling */ - if (*num_params > 0) - direction = *params[0]; - else - direction = 'C'; - - sbw->slider3d.direction = direction; - - cursor = (sbw->slider3d.orientation == XtorientVertical) - ? sbw->slider3d.verCursor - : sbw->slider3d.horCursor; - - XtVaSetValues (w, XtNcursor, cursor, NULL); - XFlush (XtDisplay (w)); -} - -/* - * Make sure the first number is within the range specified by the other - * two numbers. - */ - -static int InRange(num, small, big) - int num, small, big; -{ - return (num < small) ? small : ((num > big) ? big : num); -} - -/* - * Same as above, but for floating numbers. - */ - -static float FloatInRange(num, small, big) - float num, small, big; -{ - return (num < small) ? small : ((num > big) ? big : num); -} - - -static void NotifyScroll (w, event, params, num_params) - Widget w; - XEvent *event; - String *params; /* style: Proportional|FullLength */ - Cardinal *num_params; /* we only support 1 */ -{ - Slider3dWidget sbw = (Slider3dWidget) w; - int call_data; - char style; - Position x, y; - - if (sbw->slider3d.direction == 0) return; /* if no StartScroll */ - if (LookAhead (w, event)) return; - if (*num_params > 0) - style = *params[0]; - else - style = 'P'; - - switch (style) { - case 'P': /* Proportional */ - case 'p': - ExtractPosition (event, &x, &y); - call_data = - InRange (PICKLENGTH (sbw, x, y), 0, (int) sbw->slider3d.length); - break; - - case 'F': /* FullLength */ - case 'f': - call_data = sbw->slider3d.length; - break; - } - switch (sbw->slider3d.direction) { - case 'B': - case 'b': - call_data = -call_data; - /* fall through */ - - case 'F': - case 'f': - XtCallCallbacks (w, XtNscrollProc, (XtPointer)call_data); - break; - - case 'C': - case 'c': - /* NotifyThumb has already called the thumbProc(s) */ - break; - } -} - -/* ARGSUSED */ -static void EndScroll(w, event, params, num_params ) - Widget w; - XEvent *event; /* unused */ - String *params; /* unused */ - Cardinal *num_params; /* unused */ -{ - Slider3dWidget sbw = (Slider3dWidget) w; - - XtVaSetValues (w, XtNcursor, sbw->slider3d.inactiveCursor, NULL); - XFlush (XtDisplay (w)); - sbw->slider3d.direction = 0; -} - -static float FractionLoc (sbw, x, y) - Slider3dWidget sbw; - int x, y; -{ - float result; - int margin; - float height, width; - - margin = MARGIN (sbw); - x -= margin; - y -= margin; - height = sbw->core.height - 2 * margin; - width = sbw->core.width - 2 * margin; - result = PICKLENGTH (sbw, x / width, y / height); - return FloatInRange(result, 0.0, 1.0); -} - - -static void MoveThumb (w, event, params, num_params) - Widget w; - XEvent *event; - String *params; /* unused */ - Cardinal *num_params; /* unused */ -{ - Slider3dWidget sbw = (Slider3dWidget) w; - Position x, y; - float loc, t, s; - - if (sbw->slider3d.direction == 0) return; /* if no StartScroll */ - - if (LookAhead (w, event)) return; - - if (!event->xmotion.same_screen) return; - - ExtractPosition (event, &x, &y); - loc = FractionLoc (sbw, x, y); - t = sbw->slider3d.top; - s = sbw->slider3d.shown; - sbw->slider3d.picked = 0.5 * s; - sbw->slider3d.top = loc - sbw->slider3d.picked; - if (sbw->slider3d.top < 0.0) sbw->slider3d.top = 0.0; - - /* don't allow slider3d to shrink at end */ - if (sbw->slider3d.top + sbw->slider3d.shown > 1.0) - sbw->slider3d.top = 1.0 - sbw->slider3d.shown + 0.001; - PaintThumb (sbw, 1); - XFlush (XtDisplay (w)); /* re-draw it before Notifying */ -} - -/* ARGSUSED */ -static void NotifyThumb (w, event, params, num_params ) - Widget w; - XEvent *event; - String *params; /* unused */ - Cardinal *num_params; /* unused */ -{ - Slider3dWidget sbw = (Slider3dWidget) w; - float top = sbw->slider3d.top; - - if (sbw->slider3d.direction == 0) return; /* if no StartScroll */ - - if (LookAhead (w, event)) return; - - /* thumbProc is not pretty, but is necessary for backwards - compatibility on those architectures for which it work{s,ed}; - the intent is to pass a (truncated) float by value. */ - XtCallCallbacks (w, XtNthumbProc, *(XtPointer*)&top); - XtCallCallbacks (w, XtNjumpProc, (XtPointer)&top); -} - - - -/************************************************************ - * - * Public routines. - * - ************************************************************/ - -/* Set the scroll bar to the given location. */ - -#if NeedFunctionPrototypes -void XawSlider3dSetThumb (Widget w, -#if NeedWidePrototypes - double top, double shown) -#else - float top, float shown) -#endif -#else -void XawSlider3dSetThumb (w, top, shown) - Widget w; - float top, shown; -#endif -{ - Slider3dWidget sbw = (Slider3dWidget) w; - - if (sbw->slider3d.direction == 'c') return; /* if still thumbing */ - - sbw->slider3d.top = (top > 1.0) ? 1.0 : - (top >= 0.0) ? top : sbw->slider3d.top; - - sbw->slider3d.shown = (shown > 1.0) ? 1.0 : - (shown >= 0.0) ? shown : sbw->slider3d.shown; - - /* don't allow slider3d to shrink at end */ - if (sbw->slider3d.top + sbw->slider3d.shown > 1.0) - sbw->slider3d.top = 1.0 - sbw->slider3d.shown + 0.001; - - PaintThumb (sbw, 0); -} diff --git a/v/srcx/awtog3d.c b/v/srcx/awtog3d.c deleted file mode 100644 index 7c64e35..0000000 --- a/v/srcx/awtog3d.c +++ /dev/null @@ -1,305 +0,0 @@ -/* $XConsortium: Toggle.c,v 1.28 94/04/17 20:13:17 kaleb Exp $ */ - -/* - -Copyright (c) 1989, 1994 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - - */ - -/* - * Toggle.c - Toggle button widget - * - * Author: Chris D. Peterson - * MIT X Consortium - * kit@expo.lcs.mit.edu - * - * Date: January 12, 1989 - * - */ - -#include -#include -#include -#include -#include - -/**************************************************************** - * - * Full class record constant - * - ****************************************************************/ - -/* Private Data */ - -/* - * The order of toggle and notify are important, as the state has - * to be set when we call the notify proc. - */ - -static char defaultTranslations[] = - ": highlight(Always) \n\ - : unhighlight() \n\ - ,: toggle() notify()"; - -#define offset(field) XtOffsetOf(Toggle3dRec, field) - -static XtResource resources[] = { - {XtNstate, XtCState, XtRBoolean, sizeof(Boolean), - offset(command3d.set), XtRString, "off"}, -}; - -#undef offset - - -static void Toggle(), Initialize(), Notify(), ToggleSet(); -static void ToggleDestroy(), ClassInit(); -static Boolean SetValues(); - -static XtActionsRec actionsList[] = -{ - {"toggle", Toggle}, - {"notify", Notify}, - {"set", ToggleSet}, -}; - -#define SuperClass ((Command3dWidgetClass)&command3dClassRec) - -Toggle3dClassRec toggle3dClassRec = { - { - (WidgetClass) SuperClass, /* superclass */ - "Toggle3d", /* class_name */ - sizeof(Toggle3dRec), /* size */ - ClassInit, /* class_initialize */ - NULL, /* class_part_initialize */ - FALSE, /* class_inited */ - Initialize, /* initialize */ - NULL, /* initialize_hook */ - XtInheritRealize, /* realize */ - actionsList, /* actions */ - XtNumber(actionsList), /* num_actions */ - resources, /* resources */ - XtNumber(resources), /* resource_count */ - NULLQUARK, /* xrm_class */ - FALSE, /* compress_motion */ - TRUE, /* compress_exposure */ - TRUE, /* compress_enterleave */ - FALSE, /* visible_interest */ - NULL, /* destroy */ - XtInheritResize, /* resize */ - XtInheritExpose, /* expose */ - SetValues, /* set_values */ - NULL, /* set_values_hook */ - XtInheritSetValuesAlmost, /* set_values_almost */ - NULL, /* get_values_hook */ - NULL, /* accept_focus */ - XtVersion, /* version */ - NULL, /* callback_private */ - defaultTranslations, /* tm_table */ - XtInheritQueryGeometry, /* query_geometry */ - XtInheritDisplayAccelerator, /* display_accelerator */ - NULL /* extension */ - }, /* CoreClass fields initialization */ - { - XtInheritChangeSensitive /* change_sensitive */ - }, /* SimpleClass fields initialization */ - { - XtInheritXaw3dShadowDraw /* shadowdraw */ - }, /* ThreeDClass fields initialization */ - { - 0 /* field not used */ - }, /* LabelClass fields initialization */ - { - 0 /* field not used */ - }, /* CommandClass fields initialization */ - { - NULL, /* Set Procedure. */ - NULL, /* Unset Procedure. */ - NULL /* extension. */ - } /* ToggleClass fields initialization */ -}; - - /* for public consumption */ -WidgetClass toggle3dWidgetClass = (WidgetClass) &toggle3dClassRec; - -/**************************************************************** - * - * Private Procedures - * - ****************************************************************/ - -static void -ClassInit() -{ - XtActionList actions; - Cardinal num_actions; - Cardinal i; - Toggle3dWidgetClass class = (Toggle3dWidgetClass) toggle3dWidgetClass; - static XtConvertArgRec parentCvtArgs[] = { - {XtBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.parent), - sizeof(Widget)} - }; - - XawInitializeWidgetSet(); - XtSetTypeConverter(XtRString, XtRWidget, XmuNewCvtStringToWidget, - parentCvtArgs, XtNumber(parentCvtArgs), XtCacheNone, - (XtDestructor)NULL); -/* - * Find the set and unset actions in the command widget's action table. - */ - - XtGetActionList(command3dWidgetClass, &actions, &num_actions); - - for (i = 0 ; i < num_actions ; i++) { - if (streq(actions[i].string, "set")) - class->toggle3d_class.Set = actions[i].proc; - if (streq(actions[i].string, "unset")) - class->toggle3d_class.Unset = actions[i].proc; - - if ( (class->toggle3d_class.Set != NULL) && - (class->toggle3d_class.Unset != NULL) ) { - XtFree((char *) actions); - return; - } - } - -/* We should never get here. */ - XtError("Aborting, due to errors resolving bindings in the Toggle widget."); -} - -/*ARGSUSED*/ -static void Initialize(request, new, args, num_args) - Widget request, new; - ArgList args; - Cardinal *num_args; -{ - Toggle3dWidget tw = (Toggle3dWidget) new; - Toggle3dWidget tw_req = (Toggle3dWidget) request; - - XtAddCallback(new, XtNdestroyCallback, ToggleDestroy, (XtPointer)NULL); - -/* - * Command widget assumes that the widget is unset, so we only - * have to handle the case where it needs to be set. - * - * If this widget is in a radio group then it may cause another - * widget to be unset, thus calling the notify proceedure. - * - * I want to set the toggle if the user set the state to "On" in - * the resource group, reguardless of what my ancestors did. - */ - - if (tw_req->command3d.set) - ToggleSet(new, (XEvent *)NULL, (String *)NULL, (Cardinal *)0); -} - -/************************************************************ - * - * Action Procedures - * - ************************************************************/ - -/* ARGSUSED */ -static void -ToggleSet(w,event,params,num_params) -Widget w; -XEvent *event; -String *params; /* unused */ -Cardinal *num_params; /* unused */ -{ - Toggle3dWidgetClass class = (Toggle3dWidgetClass) w->core.widget_class; - - class->toggle3d_class.Set(w, event, NULL, 0); -} - -/* ARGSUSED */ -static void -Toggle(w,event,params,num_params) -Widget w; -XEvent *event; -String *params; /* unused */ -Cardinal *num_params; /* unused */ -{ - Toggle3dWidget tw = (Toggle3dWidget)w; - Toggle3dWidgetClass class = (Toggle3dWidgetClass) w->core.widget_class; - - if (tw->command3d.set) - class->toggle3d_class.Unset(w, event, NULL, 0); - else - ToggleSet(w, event, params, num_params); -} - -/* ARGSUSED */ -static void Notify(w,event,params,num_params) -Widget w; -XEvent *event; -String *params; /* unused */ -Cardinal *num_params; /* unused */ -{ - Toggle3dWidget tw = (Toggle3dWidget) w; - long antilint = tw->command3d.set; - - XtCallCallbacks( w, XtNcallback, (XtPointer) antilint ); -} - -/************************************************************ - * - * Set specified arguments into widget - * - ***********************************************************/ - -/* ARGSUSED */ -static Boolean -SetValues (current, request, new, args, num_args) -Widget current, request, new; -ArgList args; -Cardinal *num_args; -{ - Toggle3dWidget oldtw = (Toggle3dWidget) current; - Toggle3dWidget tw = (Toggle3dWidget) new; - Toggle3dWidget rtw = (Toggle3dWidget) request; - - if (!tw->core.sensitive && oldtw->core.sensitive && rtw->command3d.set) - tw->command3d.set = True; - - if (oldtw->command3d.set != tw->command3d.set) { - tw->command3d.set = oldtw->command3d.set; - Toggle(new, (XEvent *)NULL, (String *)NULL, (Cardinal *)0); - } - return(FALSE); -} - -/* Function Name: ToggleDestroy - * Description: Destroy Callback for toggle widget. - * Arguments: w - the toggle widget that is being destroyed. - * junk, grabage - not used. - * Returns: none. - */ - -/* ARGSUSED */ -static void -ToggleDestroy(w, junk, garbage) -Widget w; -XtPointer junk, garbage; -{ -} diff --git a/v/srcx/canvas.c b/v/srcx/canvas.c deleted file mode 100644 index a764d1f..0000000 --- a/v/srcx/canvas.c +++ /dev/null @@ -1,354 +0,0 @@ -/* ============================================================= - * canvas.c - canvas composite widget - * - * Copyright (C) 1995 Bruce E. Wampler - * - * This file is part of the V C++ GUI Framework, and is covered - * under the terms of the GNU Library General Public License, - * Version 2. This library has NO WARRANTY. See the source file - * vapp.cxx for more complete information about license terms. - * ============================================================== */ - -#include -#include - -#include - -#define INITIAL_WIDTH 200 -#define INITIAL_HEIGHT 100 - -/**************************************************************** - * - * canvas Resources - * - ****************************************************************/ - - static XtResource resources[] = - { - {XtNhSpace, XtCHSpace, XtRDimension, sizeof(Dimension), - XtOffset(CanvasWidget, canvas.h_space), XtRImmediate, (XtPointer)4}, - - {XtNvSpace, XtCVSpace, XtRDimension, sizeof(Dimension), - XtOffset(CanvasWidget, canvas.v_space), XtRImmediate, (XtPointer)4}, - - {XtNcallback, XtCCallback, XtRCallback, sizeof(XtPointer), - XtOffset(CanvasWidget, canvas.callback), XtRCallback, NULL}, - }; - -/**************************************************************** - * - * Full class record constant - * - ****************************************************************/ - -static void Initialize(); -static void Resize(); -static Boolean SetValues(); -static void ChangeManaged(); -static XtGeometryResult QueryGeometry(), GeometryManager(); -static void RefigureLocations(CanvasWidget w); - -CanvasClassRec canvasClassRec = { - { -/* core_class fields */ - /* superclass */ (WidgetClass) &compositeClassRec, - /* class_name */ "canvas", - /* widget_size */ sizeof(CanvasRec), - /* class_initialize */ NULL, - /* class_part_init */ NULL, - /* class_inited */ FALSE, - /* initialize */ Initialize, - /* initialize_hook */ NULL, - /* realize */ XtInheritRealize, - /* actions */ NULL, - /* num_actions */ 0, - /* resources */ resources, - /* num_resources */ XtNumber(resources), - /* xrm_class */ NULLQUARK, - /* compress_motion */ TRUE, - /* compress_exposure */ TRUE, - /* compress_enterleave*/ TRUE, - /* visible_interest */ FALSE, - /* destroy */ NULL, - /* resize */ Resize, - /* expose */ NULL, - /* set_values */ SetValues, - /* set_values_hook */ NULL, - /* set_values_almost */ XtInheritSetValuesAlmost, - /* get_values_hook */ NULL, - /* accept_focus */ NULL, - /* version */ XtVersion, - /* callback_private */ NULL, - /* tm_table */ NULL, - /* query_geometry */ QueryGeometry, - /* display_accelerator*/ XtInheritDisplayAccelerator, - /* extension */ NULL - },{ -/* composite_class fields */ - /* geometry_manager */ GeometryManager, - /* change_managed */ ChangeManaged, - /* insert_child */ XtInheritInsertChild, - /* delete_child */ XtInheritDeleteChild, - /* extension */ NULL - },{ -/* canvas class fields */ - /* empty */ 0, - } -}; - -WidgetClass canvasWidgetClass = (WidgetClass)&canvasClassRec; - - -/**************************************************************** - * - * Private Routines - * - ****************************************************************/ - -/* - * Do a layout, either actually assigning positions, or just - * calculating size. - */ - -/* ARGSUSED */ - static void DoLayout(CanvasWidget w, Boolean doit) - { - CanvasWidget sbw = w; - - Widget main, vscroll, hscroll; - Dimension mw, mh; /* main window */ - Dimension vh; /* vertical scrollbar length (height) */ - Dimension hw; /* horizontal scrollbar length (width) */ - Position vx; - Position hy; - - int vManaged, hManaged; - - int i; - - if (sbw->composite.num_children != 3) - { - XtAppError(XtWidgetToApplicationContext((Widget)sbw), - "Canvas: must manage exactly three widgets."); - } - - vManaged = 1; - hManaged = 1; /* assume all managed */ - - /* - * Child one is the main window, two is the vertical scrollbar, - * and three is the horizontal scrollbar. - */ - main = sbw->composite.children[0]; - vscroll = sbw->composite.children[1]; - hscroll = sbw->composite.children[2]; - - if (!XtIsManaged(main)) - { - XtAppError(XtWidgetToApplicationContext((Widget)sbw), - "Canvas: Draw area must be managed."); - } - - if (!XtIsManaged(vscroll)) - vManaged = 0; - - if (!XtIsManaged(hscroll)) - hManaged = 0; - - /* - * Size all three widgets so that space is fully utilized. - */ - if (vManaged) - { - mw = sbw->core.width - (2 * sbw->canvas.h_space) - - vscroll->core.width - (2 * vscroll->core.border_width) - - (2 * main->core.border_width); - - vx = main->core.x + mw + sbw->canvas.h_space + main->core.border_width + - vscroll->core.border_width; - - } - else - { - mw = sbw->core.width - /* (2 * sbw->canvas.h_space) - */ - (2 * main->core.border_width); - vx = 0; - } - - if (hManaged) - { - mh = sbw->core.height - (2 * sbw->canvas.v_space) - - hscroll->core.height - (2 * hscroll->core.border_width) - - (2 * main->core.border_width); - - hy = main->core.y + mh + sbw->canvas.v_space + main->core.border_width + - hscroll->core.border_width; - - } - else - { - mh = sbw->core.height - /* (2 * sbw->canvas.v_space) - */ - (2 * main->core.border_width); - - hy = 0; - } - - if (mh < 2) mh = 2; - if (mw < 2) mw = 2; - - vh = mh; /* scrollbars are always same length as main window */ - hw = mw; - - if (doit) - { - XtResizeWidget(main, mw, mh, 1); - - if (vManaged) - { - XtResizeWidget(vscroll, vscroll->core.width, vh, 1); - XtMoveWidget(vscroll, vx, vscroll->core.y); - } - - if (hManaged) - { - XtResizeWidget(hscroll, hw, hscroll->core.height, 1); - XtMoveWidget(hscroll, hscroll->core.x, hy); - } - } - } - -/* ARGSUSED */ - static XtGeometryResult GeometryManager(Widget w, - XtWidgetGeometry* request, XtWidgetGeometry* reply) - { - XtWidgetGeometry allowed; - - if (request->request_mode & ~(XtCWQueryOnly | CWWidth | CWHeight)) - return XtGeometryNo; - - if (request->request_mode & CWWidth) - allowed.width = request->width; - else - allowed.width = w->core.width; - - if (request->request_mode & CWHeight) - allowed.height = request->height; - else - allowed.height = w->core.height; - - if (allowed.width == w->core.width && allowed.height == w->core.height) - return XtGeometryNo; - - if (!(request->request_mode & XtCWQueryOnly)) - { - RefigureLocations((CanvasWidget)w); - } - return XtGeometryYes; - } - - static void RefigureLocations(CanvasWidget sbw) - { - DoLayout(sbw, False); - } - - -/* - * Calculate preferred size. We can't just use the current sizes - * of the children, because that calculation would always end up with - * our current size. Could query each child, and use that size to - * recalculate a size for us, then if it ends up being larger - * than width and height passed in, accept bounding box. - * However, we know our children and they don't have any particular - * preferred geometry, except the bigger the better. - * Therefore, if the parent suggested a size, we'll take it. - */ - -/* ARGSUSED */ - static XtGeometryResult QueryGeometry(Widget w, - XtWidgetGeometry* request, XtWidgetGeometry* reply_return) - { - XtGeometryResult result; - - request->request_mode &= CWWidth | CWHeight; - - /* parent isn't going to change w or h, so nothing to re-compute */ - if (request->request_mode == 0) - return XtGeometryYes; - - /* if proposed size is large enough, accept it. Otherwise, - * suggest our arbitrary initial size. */ - - result = XtGeometryYes; - if (request->request_mode & CWHeight) - { - if (request->height < INITIAL_HEIGHT) - { - result = XtGeometryAlmost; - reply_return->height = INITIAL_HEIGHT; - reply_return->request_mode &= CWHeight; - } - else - result = XtGeometryYes; - } - - if (request->request_mode & CWWidth) - { - if (request->width < INITIAL_WIDTH) - { - result = XtGeometryAlmost; - reply_return->width = INITIAL_WIDTH; - reply_return->request_mode &= CWWidth; - } - else - result = XtGeometryYes; - } - - return(result); - } - -/* - * Actually layout the canvas - */ - - static void Resize(Widget w) - { - CanvasWidget cw = (CanvasWidget) w; - DoLayout(cw, True); - XtCallCallbacks((Widget)cw, XtNcallback, NULL); - } - - static void ChangeManaged(CanvasWidget w) - { - CanvasWidget sbw = (CanvasWidget) w; - DoLayout(sbw, True); - } - -/* ARGSUSED */ - static void Initialize(Widget request, Widget new) - { - CanvasWidget newsbw = (CanvasWidget)new; - - if (newsbw->core.width == 0) - newsbw->core.width = INITIAL_WIDTH; - - if (newsbw->core.height == 0) - newsbw->core.height = INITIAL_HEIGHT; - - } /* Initialize */ - -/* ARGSUSED */ - static Boolean SetValues(Widget current, Widget request, Widget new, - ArgList args, Cardinal* num_args) - { - CanvasWidget sbwcurrent = (CanvasWidget) current; - CanvasWidget sbwnew = (CanvasWidget) new; - - /* need to relayout if h_space or v_space change */ - if ((sbwnew->canvas.h_space != sbwcurrent->canvas.h_space) || - (sbwnew->canvas.v_space != sbwcurrent->canvas.v_space)) - { - DoLayout(sbwnew, True); - } - - return False; - } diff --git a/v/srcx/tabstr.c b/v/srcx/tabstr.c deleted file mode 100644 index 9cea076..0000000 --- a/v/srcx/tabstr.c +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Functions for drawing String's with tab characters in them - */ - -#include -#include -#include -#include "tabstr.h" - -/* - * Like DrawImageString, except it takes an additional "tabs" - * argument, used to specify what horizontal pixel position to - * move to when tab characters are present in the string. If - * the "tabs" argument is NULL, works exactly like its - * counterpart. - */ -void -XfwfDrawImageString(display, drawable, gc, font, x, y, string, length, tabs, underline) - Display *display; - Drawable drawable; - GC gc; - XFontStruct *font; - int x; - int y; - String string; - int length; - int *tabs; - char *underline; -{ - register char *p, *ep; - register int tx, tab; - - tab = tx = 0; - for (p = string; length; ) { - ep = strnchr(p, '\t', length); - if (underline && p <= underline && underline < ((ep && tabs) ? ep : p+length)) { - int _x = 0, _wd = 0; - if (p != underline) { - int direction, ascent, descent; XCharStruct overall; - XTextExtents(font, p, underline - p, &direction, &ascent, &descent, &overall); - _x = overall.width; - } - _wd = XTextWidth(font, underline, 1); - XDrawLine(display, drawable, gc, - x+tx + _x , y + font->max_bounds.descent - 1, - x+tx + _x + _wd, y + font->max_bounds.descent - 1); - } - if (ep && tabs) { - XDrawImageString(display, drawable, gc, x+tx, y, p, ep - p); - tx = tabs[tab++]; - length -= ep - p + 1; - p = ep + 1; - } else { - XDrawImageString(display, drawable, gc, x+tx, y, p, length); - break; - } - } -} - -/* - * Like DrawString, except it takes an additional "tabs" - * argument, used to specify what horizontal pixel position to - * move to when tab characters are present in the string. If - * the "tabs" argument is NULL, works exactly like its - * counterpart. - */ -void XfwfDrawString(display, drawable, gc, font, x, y, string, length, tabs, underline) - Display *display; - Drawable drawable; - GC gc; - XFontStruct *font; - int x; - int y; - String string; - int length; - int *tabs; - char *underline; -{ - register char *p, *ep; - register int tx, tab; - - tab = tx = 0; - for (p = string; length; ) { - ep = strnchr(p, '\t', length); - if (underline && p <= underline && underline < ((ep && tabs) ? ep : p+length)) { - int _x = 0, _wd = 0; - if (p != underline) { - int direction, ascent, descent; XCharStruct overall; - XTextExtents(font, p, underline - p, &direction, &ascent, &descent, &overall); - _x = overall.width; - } - _wd = XTextWidth(font, underline, 1); - XDrawLine(display, drawable, gc, - x+tx + _x , y + font->max_bounds.descent - 1, - x+tx + _x + _wd, y + font->max_bounds.descent - 1); - } - if (ep && tabs) { - XDrawString(display, drawable, gc, x+tx, y, p, ep - p); - tx = tabs[tab++]; - length -= ep - p + 1; - p = ep + 1; - } else { - XDrawString(display, drawable, gc, x+tx, y, p, length); - break; - } - } -} - -/* - * Converts a string list of tabs to an array of tabs - */ -int *XfwfTablist2Tabs(tablist) - char *tablist; -{ - register int *tabs = NULL; - register int ntabs = 0; - - if (!tablist) - return NULL; - for (;;) - { - /* Skip leading blanks */ - while (*tablist && *tablist == ' ') ++tablist; - if (!*tablist) break; - - /* Allocate space for the new tab */ - if (ntabs) - tabs = (int *) XtRealloc( (char *) tabs, - (ntabs+1) * sizeof(int)); - else - tabs = (int *) XtMalloc( (ntabs + 1) * sizeof(int)); - /* Add it to the list */ - tabs[ntabs++] = atoi(tablist); - /* Skip to the next blank */ - while (*tablist && *tablist != ' ') ++tablist; - } - return (tabs); -} - -/* - * Like TextWidth, except it takes an additional "tabs" - * argument, used to specify what horizontal pixel position to - * move to when tab characters are present in the string. If - * the "tabs" argument is NULL, works exactly like its - * counterpart. - */ -int -XfwfTextWidth(font, str, length, tabs) - XFontStruct *font; - String str; - int length; - int *tabs; -{ - register char *p, *ep; - register int tx, tab, rc; - - tab = tx = 0; - if (length == 0) return 0; - for (p = str; length; ) - { - ep = strnchr(p, '\t', length); - if (ep && tabs) - { - tx = tabs[tab++]; - length -= ep - p + 1; - p = ep + 1; - } - else - { - rc = XTextWidth(font, p, length); - if (rc < 0) return rc; else return rc + tx; - } - } - return -1; -} - -/* - * Like strchr, except has a length limit. - */ -char * -strnchr(s, c, n) - char *s; - int c; - int n; -{ - while (n--) - if (*s == c) return s; else ++s; - return NULL; -} diff --git a/v/srcx/tabstr.h b/v/srcx/tabstr.h deleted file mode 100644 index 5a16e9c..0000000 --- a/v/srcx/tabstr.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Functions for drawing String's with tab characters in them - */ - -#if (NeedFunctionPrototypes > 0) - -extern void XfwfDrawImageString(Display *display, Drawable drawable, - GC gc, XFontStruct *font, int x, int y, String string, int length, - int *tabs, char *underline); -extern void XfwfDrawString(Display *display, Drawable drawable, - GC gc, XFontStruct *font, int x, int y, String string, int length, - int *tabs, char *underline); -extern void XtabDrawString(Display *display, Drawable drawable, GC gc, - int x, int y, String string, int length, int *tabs); -extern int * XfwfTablist2Tabs(char *tablist); -extern int XfwfTextWidth(XFontStruct *font, String str, int length, - int *tabs); -extern char * strnchr(char *s, int c, int n); - -#else - -extern void XfwfDrawImageString(); -extern void XfwfDrawString(); -extern void XtabDrawString(); -extern int * XfwfTablist2Tabs(); -extern int XfwfTextWidth(); -extern char * strnchr(); - -#endif - diff --git a/v/srcx/vapp.cxx b/v/srcx/vapp.cxx deleted file mode 100644 index a65a994..0000000 --- a/v/srcx/vapp.cxx +++ /dev/null @@ -1,1163 +0,0 @@ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// -// date: 02 Mar 2000 12:00:45 PM -// // -// VV VV VV VV // -// VV VV V - A Portable C++ GUI Framework VV VV // -// VV VV designed and written by VV VV // -// VV VV VV VV // -// VV VV Bruce E. Wampler, Ph.D. VV VV // -// VVV e-mail: wampler@cs.unm.edu VVV // -// V V // -// // -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// -// // -// vapp.cxx - The vApp control object (for X11R5) // -// // -// Copyright (C) 1995-2000 Bruce E. Wampler // -// // -// This file is part of the V C++ GUI Framework. // -// // -// This library is free software; you can redistribute it and/or // -// modify it under the terms of the GNU Lesser General Public // -// License as published by the Free Software Foundation; either // -// version 2.1 of the License, or (at your option) any later version. // -// // -// This library is distributed in the hope that it will be useful, // -// but WITHOUT ANY WARRANTY; without even the implied warranty of // -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // -// Library General Public License for more details. // -// // -// You should have received a copy of the GNU Library General Public // -// License along with this library (see COPYING.LIB); if not, write to the // -// Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -// // -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// - -#include // my header file -#include // Win header -#include -#include -#include - -#ifndef Athena -#include -#include -#include -#endif - -#include -//#include - -#include -#include - - // Globals available to the world - - vApp* theApp = NULL; // to be filled in upon instantiation - DebugMask DebugState; - - // Define the default color scheme - shades of gray - // #define UseBlueColors to get a Motif-like look for the default - -#ifdef UseBlueColors - -#define vLightGray "LightSteelBlue2" // status bar background (204, 80% gray) -#define vMedGray "LightSteelBlue" // dialog, command bar background (191,75%) -#define vDarkGray "LightSteelBlue3" // Menu bar, button faces (179,70%) -#define vDarkShadow "LightSteelBlue4" // dark shadows for buttons -#define vLightShadow "LightSteelBlue1" // light shadows for buttons (222,87%) - -#else // Default V Gray scheme - -#define vLightGray "#CCCCCCCCCCCC" // status bar background (204, 80% gray) -#define vMedGray "#BFBFBFBFBFBF" // dialog, command bar background (191,75%) -#define vDarkGray "#B3B3B3B3B3B3" // Menu bar, button faces (179,70%) -#define vDarkShadow "#7F7F7F7F7F7F" // dark shadows for buttons (127,50%) -#define vLightShadow "#DEDEDEDEDEDE" // light shadows for buttons (222,87%) - -#endif - - // define the structures we need to recover the XtDefaultFont info - - typedef struct - { - Pixel copy_fg; - Pixel copy_bg; - - Pixel dialogBG; - Pixel statusBarBG; - Pixel menuBarBG; - Pixel controlBG; - Pixel controlFace; - Pixel lightControlShadow; - Pixel darkControlShadow; - - XFontStruct *font; - } AppData; - - static AppData app_data; - - static XtResource app_resources[] = - { - { - XtNforeground, - XtCForeground, - XtRPixel, - sizeof(Pixel), - XtOffsetOf(AppData,copy_fg), - XtRString, - ( XtPointer ) XtDefaultForeground - }, - { - XtNbackground, - XtCBackground, - XtRPixel, - sizeof(Pixel), - XtOffsetOf(AppData,copy_bg), - XtRString, - ( XtPointer ) XtDefaultBackground - }, - -//-------------------------------------------- - { - "vDialogBG", - XtCForeground, - XtRPixel, - sizeof(Pixel), - XtOffsetOf(AppData,dialogBG), - XtRString, - ( XtPointer ) vMedGray - }, - { - "vStatusBarBG", - XtCForeground, - XtRPixel, - sizeof(Pixel), - XtOffsetOf(AppData,statusBarBG), - XtRString, - ( XtPointer ) vLightGray - }, - { - "vMenuBarBG", - XtCForeground, - XtRPixel, - sizeof(Pixel), - XtOffsetOf(AppData,menuBarBG), - XtRString, - ( XtPointer ) vDarkGray - }, - { - "vControlBG", - XtCForeground, - XtRPixel, - sizeof(Pixel), - XtOffsetOf(AppData,controlBG), - XtRString, - ( XtPointer ) vDarkGray - }, - { - "vControlFace", - XtCForeground, - XtRPixel, - sizeof(Pixel), - XtOffsetOf(AppData,controlFace), - XtRString, - ( XtPointer ) vMedGray - }, - { - "vLightControlShadow", - XtCForeground, - XtRPixel, - sizeof(Pixel), - XtOffsetOf(AppData,lightControlShadow), - XtRString, - ( XtPointer ) vLightShadow - }, - { - "vDarkControlShadow", - XtCForeground, - XtRPixel, - sizeof(Pixel), - XtOffsetOf(AppData,darkControlShadow), - XtRString, - ( XtPointer ) vDarkShadow - }, -//-------------------------------------------- - - { - XtNfont, - XtCFont, - XtRFontStruct, - sizeof(XFontStruct*), - XtOffsetOf(AppData, font), - XtRString, - ( XtPointer ) XtDefaultFont - }, - }; - - // Define three shades of gray used to draw dialogs and controls. - // LightGray is for the status bar background - // Med Gray is for the dialog and command bar background - // DarkGray is for the menu bar and button faces - - - Pixel _vStatusBarBG; - Pixel _vDialogBG; - Pixel _vMenuBarBG; - Pixel _vControlBG; - Pixel _vControlFace; - Pixel _vLightControlShadow; - Pixel _vDarkControlShadow; - -#ifndef Athena - static int _inExit = 0; -#endif - - static char copyright[] = - "****> Copyright (C) 1995-2000 Bruce E. Wampler; under terms of the\ - GNU Lesser General Public License, version 2.1 <****"; - -//######################################################################### -// Clipboard helper stuff - -//================>>> clip_x11_lose_ownership_cb <<<================= - static void clip_x11_lose_ownership_cb(Widget w, Atom* selection) - { - theApp->ClipboardClear(); - } - - -//========================>>> ignore_DW_CB <<<======================= - static void ignore_DW_CB(Widget, XtPointer client_data, XtPointer) - { - ; - } - -#ifndef Athena -//========================>>> vguiMotifIdleWorkCB <<<======================= - static Boolean vguiMotifIdleWorkCB(XtPointer client_data) - { - // return true when done, false to contineu - return theApp->MotifIdleWork(client_data); - } -#endif - -//================>>> clip_x11_convert_selection_cb <<<================= - static Boolean clip_x11_convert_selection_cb(Widget w, Atom* selection, - Atom* target, Atom* type, XtPointer* value, unsigned long* length, int* format) - { - if (*target != XA_STRING) - return False; - - char* txt = theApp->ClipboardGetText(); // get ptr to text - int tlen = strlen(txt)+1; - *value = XtMalloc((Cardinal)tlen); - if (*value == 0) - return False; - strcpy((char*)*value,txt); - *length = (unsigned long) tlen; - *type = *target; - *format = 8; /* 8 bits per char */ - return True; - } - -//================>>> clip_x11_request_selection_cb <<<================= - static void clip_x11_request_selection_cb(Widget w, - XtPointer success, Atom* selection, Atom* type, - void* value, unsigned long *length, int* format) - { - if (value == 0 || *length == 0) - { - *(int *)success = 0; - return; - } - - char* p = (char *)value; - long len = *length;; - char *realtext = new char[len+2]; - - int ix; - for (ix = 0 ; ix < len ; ++ix) - realtext[ix] = p[ix]; // need eos - realtext[ix] = 0; - - theApp->ClipboardSetText(realtext, 0); - - delete [] realtext; - XtFree((char *)value); - *(int *)success = 1; -} - -//========================>>> vApp::vApp <<<======================= - vApp::vApp(VCONST char* appName, int simSDI, int fh, int fw) : - vBaseItem(appName) // constructor - { - // First, set the global pointer to the main App. This happens - // when the user declares the instance of the app, either from - // a vApp object direct, or an object from a class derived - // from the vApp class. - - theApp = this; // this is our object - - // now the data members - -#ifndef Athena - _taskList = 0; - _inExit = 0; -#endif - _workTimer = 0; // timer for work slice (BEW: 7/27/96) - _running = 0; // we are running - _display = NULL; - _appContext = 0; - _WindowList = 0; // no windows registered - _simSDI = simSDI; // not used in X - - ClipMax = ClipAllocUnit - 1; - theClipboard = new char[ClipAllocUnit]; - *theClipboard = 0; // empty clipboard - - _frameWidth = fw; _frameHeight = fh; - _DefaultHeight = 150; // default sizes for canvas window - _DefaultWidth = 350; - - - // Set which debug items to show - - DebugState.System = 1; // System debug messages - DebugState.CmdEvents = 0; // Show command events (buttons, etc.) - DebugState.MouseEvents = 0; // Show mouse events - DebugState.WindowEvents = 0; // Window events (resize, etc.) - DebugState.Build = 0; // Define/Build window - DebugState.BadVals= 0; // Error values - DebugState.Misc = 0; // Misc stuff - DebugState.Text = 0; // Text events - DebugState.Constructor = 0; // Show constructors - DebugState.Destructor = 0; // Show destructors - DebugState.User = 1; // Debug user events - DebugState.UserApp1 = 0; // Level 1 User App - DebugState.UserApp2 = 0; // Level 2 User App - DebugState.UserApp3 = 0; - - } - -//========================>>> vApp::initialize <<<======================= - void vApp::initialize(int& argc, char** argv) - { - // Main interface to the parent windowing system - - static XrmOptionDescRec Options[] = { - {"-vDebug","*none",XrmoptionSepArg,(XPointer) NULL} - }; - - int local_argc = argc; - - for (int argn = 1 ; argn < argc ; ++argn) // look for vDebug switch - { - if (strcmp(argv[argn],"-vDebug") == 0) - { - // Turn them all off - DebugState.System = 0; // System debug messages - DebugState.CmdEvents = 0; // Show command events (buttons, etc.) - DebugState.MouseEvents = 0; // Show mouse events - DebugState.WindowEvents = 0; // Window events (resize, etc.) - DebugState.Build = 0; // Define/Build window - DebugState.BadVals= 0; // Error values - DebugState.Misc = 0; // Misc stuff - DebugState.Text = 0; // Text events - DebugState.Constructor = 0; // Show constructors - DebugState.Destructor = 0; // Show destructors - DebugState.User = 0; // Debug user events - DebugState.UserApp1 = 0; // Level 1 User App - DebugState.UserApp2 = 0; // Level 2 User App - DebugState.UserApp3 = 0; - argn++; - if (argn >= argc) - break; - for (char* cp = argv[argn] ; *cp ; ++cp) - { - switch (*cp) - { - case 'A': // All system - DebugState.System = 1; // System debug messages - DebugState.CmdEvents = 1; // Show command events (buttons, etc.) - DebugState.MouseEvents = 1; // Show mouse events - DebugState.WindowEvents = 1; // Window events (resize, etc.) - DebugState.Build = 1; // Define/Build window - DebugState.BadVals= 1; // Error values - DebugState.Misc = 1; // (Other) Misc stuff - DebugState.Text = 1; // Text events - DebugState.Constructor = 1; // Show constructors - DebugState.Destructor = 1; // Show destructors - break; - case 'S': - DebugState.System = 1; // System debug messages - break; - case 'c': - DebugState.CmdEvents = 1; // Show command events (buttons, etc.) - break; - case 'm': - DebugState.MouseEvents = 1; // Show mouse events - break; - case 'w': - DebugState.WindowEvents = 1; // Window events (resize, etc.) - break; - case 'b': - DebugState.Build = 1; // Define/Build window - break; - case 'v': - DebugState.BadVals= 1; // Error values - break; - case 'o': - DebugState.Misc = 1; // (Other) Misc stuff - break; - case 't': - DebugState.Text = 1; // Text events - break; - case 'C': - DebugState.Constructor = 1; // Show constructors - break; - case 'D': - DebugState.Destructor = 1; // Show destructors - break; - case 'U': - DebugState.User = 1; // Debug user events - break; - case '1': - DebugState.UserApp1 = 1; // Level 1 User App - break; - case '2': - DebugState.UserApp2 = 1; // Level 2 User App - break; - case '3': - DebugState.UserApp3 = 1; - break; - } - } - break; // done with list - } - } - - _vHandle = XtAppInitialize( - &_appContext, // The Xt App Context - _name, // my name - Options, XtNumber(Options), - &local_argc, argv, // XtAppInitialize eats it args (e.g., -font) - NULL, NULL, 0); - - argc = local_argc; // fix argc count - - // Now retrieve the XFontStruct of the XtDefaultFont - - XtVaGetApplicationResources - (_vHandle, &app_data, app_resources, XtNumber(app_resources), NULL); - - _XDefaultFont = app_data.font; // specified by -fn or default settings - - // We've now created a top level shell. We want to make it - // invisible in the center of the screen (for possible aid in - // placement of other windows later) - - _display = XtDisplay(_vHandle); // Get the display - _xwindow = 0; - - _DisplayHeight = DisplayHeight(_display,0); - _DisplayWidth = DisplayWidth(_display,0); - - XtVaSetValues(_vHandle, // this Widget - XtNmappedWhenManaged, FALSE, // invisible - XtNx, _DisplayWidth/2, // middle of screen - XtNy, _DisplayHeight/2, - XtNwidth, 1, // and very small - XtNheight, 1, -#ifndef Athena - XmNkeyboardFocusPolicy,XmPOINTER, - XmNdeleteResponse,XmDO_NOTHING, // added 1.24 - a long standing, awful bug... -#endif - NULL); - - // Set default height and width to a 24x80 window - - vFont tempSys(vfDefaultSystem); - int asc, des; - int dh = tempSys.XFontH(asc, des); - - if (dh > 0) - _DefaultHeight = (dh * 24) + 12; // make default 24 lines - - int dw = tempSys.XTextW("c"); - if (dw > 0) - _DefaultWidth = (dw * 80) + 12; // 80 columns - - // Now realize the shell window so childern will work. - - XtRealizeWidget(_vHandle); - - CheckEvents(); - - // Add the delete protocol -#ifndef Athena - vx_wm_protocols = XmInternAtom(XtDisplay(_vHandle), "WM_PROTOCOLS", - False); - - vx_wm_delete_window = - XmInternAtom(XtDisplay(_vHandle), "WM_DELETE_WINDOW", False); - - XmAddWMProtocolCallback(_vHandle, vx_wm_delete_window, ignore_DW_CB, 0); -#else - vx_wm_protocols = XInternAtom(XtDisplay(_vHandle), "WM_PROTOCOLS", - False); - - vx_wm_delete_window = - XInternAtom(XtDisplay(_vHandle), "WM_DELETE_WINDOW", False); - - XSetWMProtocols(XtDisplay(_vHandle), XtWindow(_vHandle), - &vx_wm_delete_window, 1); - -// XtAddEventHandler(_vHandle, (EventMask)0L, 1, -// (XtEventHandler)ignore_DW_CB, 0); - -#endif - - // Color stuff - - XtVaGetValues(_vHandle, - XtNdepth, &_depth, - NULL); - - _colormap = DefaultColormapOfScreen( - XScreenOfDisplay(_display, DefaultScreen(_display))); - - if (_depth <= 1) - { - _vStatusBarBG = - _vDialogBG = - _vMenuBarBG = - _vControlBG = - _vControlFace = - _vLightControlShadow = - _backgroundPix = XWhitePixel(theApp->display(),0); - _vDarkControlShadow = - _foregroundPix = XBlackPixel(theApp->display(),0); - } - else - { - _backgroundPix = XWhitePixel(theApp->display(),0); -// KDE overrides bg, so use white! -//1.22 _backgroundPix = app_data.copy_bg; - _foregroundPix = app_data.copy_fg; - - // Get the control colors - _vDialogBG = app_data.dialogBG; - _vStatusBarBG = app_data.statusBarBG; - _vMenuBarBG = app_data.menuBarBG; - _vControlBG = app_data.controlBG; - _vControlFace = app_data.controlFace; - _vLightControlShadow = app_data.lightControlShadow; - _vDarkControlShadow = app_data.darkControlShadow; - } - - for (int icx = 0 ; icx < 16 ; ++icx) - { - (void) vStdColors[icx].pixel(); // Force all colors to map - } - - _running = 1; - - } - -#ifndef Athena -// -// All this code comes from some wierd way Motif handles events. -// For some reason, one can't close a window from itself as -// you can for Athena, gtk, and MS-Windows. The motif runtime -// crashes. In a similar fashion, you don't seem to be able -// to create new windows from within a mouse down event. -// So this kludgy stuff saves what needs to be done, and -// then does it at the next idle time, which seems to let -// Motif be closer to its top loop. This behavior was similar -// on both Metroworks Motif and LessTif. - -//========================>>> vApp::MotifIdleWork <<<======================= - Boolean vApp::MotifIdleWork(XtPointer client_data) - { - // return true when done, false to contine - - TaskList* dp; - while (_taskList) - { - if (_taskList->cmd == M_Close) // special case - { - (_taskList->window)->_CloseWinFinal(); - } - else - { - (_taskList->window)->WindowCommand(_taskList->cmd, - (ItemVal)0,(CmdType)0); - } - dp = _taskList; - _taskList = _taskList->nextTask; - delete dp; // delete as we go - } - _taskList = 0; - return True; // no tasks? done! - } - -//========================>>> vApp::MotifSetTask <<<======================= - int vApp::MotifSetTask(vWindow* vw, ItemVal iv) - { - // set up a task to do - if (_inExit && iv == M_Close) - { - vw->_CloseWinFinal(); - return 1; - } - - if (_taskList == 0) // no tasks waiting - { - // add task to the list, setup work callback - _taskList = new TaskList; - _taskList->nextTask = 0; - _taskList->window = vw; - _taskList->cmd = iv; - // add the work proc for first task only - (void) XtAppAddWorkProc(_appContext, - (XtWorkProc)vguiMotifIdleWorkCB, (XtPointer)0); - return 1; - } - else - { - // add task to the list, setup work callback - TaskList* tp = new TaskList; - tp->nextTask = _taskList; // add current to new - _taskList = tp; // make new one the head - _taskList->window = vw; - _taskList->cmd = iv; - return 1; - } - } -#endif - -//========================>>> vApp::xWindow <<<======================= - Window vApp::xWindow() - { - return (_xwindow == 0 ? (_xwindow = XtWindow(_vHandle)) : _xwindow); - } - -//========================>>> vApp::NewAppWin <<<======================= - vWindow* vApp::NewAppWin(vWindow* win, VCONST char* name, int w, int h, - vAppWinInfo* winInfo) - { - vWindow* thisWin = win; - vAppWinInfo* awinfo = winInfo; - - SysDebug1(Build,"vApp::NewAppWin(%s)\n",name); - - if (!thisWin) // Not created - thisWin = new vCmdWindow(name, w, h); - - if (!winInfo) - awinfo = new vAppWinInfo(name); - - registerWindow(thisWin, awinfo); // register this window - return thisWin; - } - -//========================>>> vApp::NewHelpWin <<<======================= - vWindow* vApp::NewHelpWin(vWindow* win, VCONST char* name, int h, int w) - { - vWindow* thisWin = win; - - SysDebug1(Build,"vApp::NewHelpWin(%s)\n",name); - - if (!thisWin) // Not created - return 0; - registerWindow(thisWin, 0); // register this window - return thisWin; - } - -//=======================>>> vApp::CheckEvents <<<======================== - void vApp::CheckEvents() - { - // Periodically call this from a compute bound app to allow - // events to get through. - XEvent an_event; - - // Clean up event queue of events we care about. - while (XtAppPending(theApp->appContext()) & (XtIMXEvent | XtIMTimer)) - { - XtAppNextEvent(theApp->appContext(),&an_event); // get events - XtDispatchEvent(&an_event); // and dispatch them - } - } - -//======================>>> vApp::Exit <<<======================= - void vApp::Exit(void) - { - // Close All registered windows and exit - - WindList *curWin; - vWindow *tmp; - - SysDebug(Build,"vApp::Exit()\n"); - -#ifndef Athena - _inExit = 1; -#endif - - for (curWin = _WindowList ; curWin !=0 ; curWin = _WindowList) - { - tmp = curWin->window; - if (curWin->info == 0) // return assocated info ptr - CloseHelpWin(tmp); // different for Help - else - CloseAppWin(tmp); // use local or derived close app - } - - exit(0); - } - -//========================>>> vApp::IsHelpWin <<<======================= - int vApp::IsHelpWin(vWindow *Win) - { - WindList *curWin; - - for (curWin = _WindowList ; curWin !=0 ; curWin = curWin->nextWinList) - { - if (curWin->window == Win) - { - return (curWin->info == 0); // Help if 0 - } - } - return 0; - } - -//==================>>> vApp::XWaitUntilMapped <<<======================= - void vApp::XWaitUntilMapped(Widget w) - { -#ifndef Athena -// CheckEvents(); -// XmUpdateDisplay(w); -#else - XEvent ev; - Display *dsp; - dsp = display(); - - XSync(display(), false); - - /* Flush all buffers */ - XSync(dsp, False); - - /* Process remaining events ... */ - while (XCheckMaskEvent(dsp, ExposureMask, &ev)) - { - XtDispatchEvent(&ev); - } - - if (XtIsRealized(w) && XtIsRealized(_vHandle)) - { - XWindowAttributes attr; - while (XGetWindowAttributes(display(), XtWindow(w), &attr) - && attr.map_state != IsViewable) - { - if (XGetWindowAttributes(display(), XtWindow(_vHandle), &attr) - && attr.map_state != IsViewable) - break; // Shell is withdrawn or iconic - - // Wait for exposure event - XEvent event; - XtAppNextEvent(XtWidgetToApplicationContext(w), &event); - XtDispatchEvent(&event); - } - } - - XSync(display(), false); - - /* First process all available events ... */ - while (XCheckMaskEvent(dsp, ExposureMask, &ev)) - { - XtDispatchEvent(&ev); - } - - /* Flush all buffers */ - XSync(dsp, False); - - /* Process remaining events ... */ - while (XCheckMaskEvent(dsp, ExposureMask, &ev)) - { - XtDispatchEvent(&ev); - } - -#endif - } - -//==================>>> vApp::XCheckSelection <<<======================= - int vApp::XCheckSelection() - { - // this code is called when focus enter to copy selection to clipboard - XEvent event; - Atom type = XA_STRING; - static int success; - int i; - - XtGetSelectionValue(_vHandle, XA_PRIMARY, type, - clip_x11_request_selection_cb, (XtPointer)&success, CurrentTime); - return success; - } - -//==================>>> vApp::ClipboardSetText <<<======================= - int vApp::ClipboardSetText(VCONST char* text, int DoXOwn) VCONST - { - // set the system clipboard to the value in text - // X: XtOwnSelection - - if (strlen(text) <= 0) - return 0; // don't allow null strings... - while (strlen(text) >= ClipMax - 1) - { - ClipMax += ClipAllocUnit; // bump max - if (theClipboard != 0) - delete [] theClipboard; // free last chunk - theClipboard = new char[ClipMax+2]; - if (!theClipboard) - { - ClipMax = 0; - return 0; - } - } - // OK, have a place to put the text - strcpy(theClipboard, text); - SetValueAll(M_Paste,1,Sensitive); - - // This is the X11 call we need - we will make our clipboard copy - // available to other X windows even if we dehighlight - we are - // making the Clipboard available, not the selection. - - if (DoXOwn) // allows reuse of this routine by focus detection - { - if (!XtOwnSelection(_vHandle, XA_PRIMARY, CurrentTime, - clip_x11_convert_selection_cb, clip_x11_lose_ownership_cb, 0)) - return 0; - } - return 1; - } - -//====================>>> vApp::ClipboardGetText <<<===================== - char* vApp::ClipboardGetText() VCONST - { - // return a pointer to the clipboard text - we will allocate - // space for it as needed - if (theClipboard != 0 && *theClipboard != 0) - { - return theClipboard; - } - - return 0; - } - -//====================>>> vApp::ClipboardCheckText <<<=================== - int vApp::ClipboardCheckText() VCONST - { - // check if text available on system clipboard - return (theClipboard != 0 && *theClipboard != 0); - } - -//====================>>> vApp::ClipboardClear <<<======================== - void vApp::ClipboardClear() VCONST - { - // Clear out the clipboard - *theClipboard = 0; - SetValueAll(M_Paste,0,Sensitive); - XtDisownSelection(_vHandle, XA_PRIMARY, CurrentTime); - } - -//==================>>> vApp::CloseLastCmdWindow <<<======================= - void vApp::CloseLastCmdWindow(vWindow* win, int exitcode) - { - // This method, new in 1.21, allows an empty MDI frame for - // Windows. Default behavior is to exit on last close. To - // overide, the derived CloseLastCmdWindow should simply return. - // WARNING: This is not yet implemented in X. - -// delete win; - Exit(); - } - -//========================>>> vApp::CloseAppWin <<<======================= - int vApp::CloseAppWin(vWindow* win) - { - - SysDebug(Build,"vApp::CloseAppWin()\n"); - - win->CloseWin(); // let the window close itself - - // Motif version deletes the object in the work method -#ifdef Athena - delete win; // free the window -#endif - return 1; - } - -//========================>>> vApp::CloseHelpWin <<<======================= - int vApp::CloseHelpWin(vWindow* win) - { - - SysDebug(Build,"vApp::CloseAppWin()\n"); - - win->CloseWin(); // let the window close itself - unregisterWindow(win); // take it off the list - delete win; // free the window - return 1; - } - -//===========================>>> vApp::AppCommand <<<========================= - void vApp::AppCommand(vWindow* win, ItemVal id, ItemVal retval, CmdType ctype) - { - SysDebug1(CmdEvents,"vApp::AppCmd(id: %d)\n",id); - if (id == M_Exit) - Exit(); - } - -//========================>>> vApp::GetDefaultFont <<<======================= - vFont vApp::GetDefaultFont() - { - vFont defFont(vfDefaultSystem); - defFont.LoadFont(); // make sure loaded - return defFont; - } - -//========================>>> vApp::getAppWinInfo <<<======================= - vAppWinInfo* vApp::getAppWinInfo(vWindow *Win) - { - WindList *curWin; - - for (curWin = _WindowList ; curWin !=0 ; curWin = curWin->nextWinList) - { - if (curWin->window == Win) - { - return curWin->info; // return assocated info ptr - } - } - return 0; - } - -//===========================>>> vApp::KeyIn <<<=========================== - void vApp::KeyIn(vWindow* win, vKey key, unsigned int shift) - { - SysDebug(Misc,"vApp::KeyIn\n"); - } - -//========================>>> vApp::registerWindow <<<======================= - void vApp::registerWindow(vWindow *Win, vAppWinInfo *awinfo) - { - WindList* newList = new WindList; // new cell to add to list - - SysDebug1(Misc,"vApp::registerWindow - %s\n",Win->name()) - - newList->window = Win; // remember the window - newList->info = awinfo; // and its info class - - newList->nextWinList = _WindowList; // link in at front - _WindowList = newList; - } - -//========================>>> vApp::unregisterWindow <<<======================= - void vApp::unregisterWindow(vWindow *Win) - { - WindList *curWin, *tmp, *last, *next; - - last = 0; - - for (curWin = _WindowList ; curWin !=0 ; curWin = next) - { - next = curWin->nextWinList; - if (curWin->window == Win) - { - - SysDebug1(Misc,"vApp::unregisterWindow - %s\n",Win->name()) - - tmp = curWin; - - if (curWin == _WindowList) - _WindowList = curWin->nextWinList; - else - last->nextWinList = curWin->nextWinList; - - delete curWin->info; // free the info space - delete tmp; // free the list space - } - last = curWin; - } - } - -//========================>>> vApp::SendWindowCommandAll <<<======================= - void vApp::SendWindowCommandAll(ItemVal id, int val, CmdType ctype) - { - // send a command to all windows - for (WindList* curWin = _WindowList ; curWin !=0 ; curWin = curWin->nextWinList) - { - (curWin->window)->WindowCommand(id, val, ctype); - } - } - -//========================>>> vApp::UpdateAllViews <<<======================= - void vApp::UpdateAllViews(vWindow* sender, int hint, void* pHint) - { - // Easy way to do MVC - call UpdateView in all windows - // This function is called by the user whenever a change is made to - // the model e.g the document. This causes vWindow::UpdateView to be - // called for every open window. The parameters are used to both filter and - // hint the windows on which actions to take in vWindow::UpdateView: - // - // sender: If this is not zero, this window will not invoke UpdateView, - // because typically the change of model was a result of - // an interaction with this window. - // hint: This should be an enum defined in your derived app class. - // Hints about which kind of change is made, so that only - // appropriate action is taken on appropriate windows. - // pHint: This is normally a pointer to the object representing the - // document - - for (WindList* curWin = _WindowList ; curWin !=0 ; curWin = curWin->nextWinList) - { - if (curWin->window != sender) - (curWin->window)->UpdateView(sender, hint, pHint); - } - } - -//========================>>> vApp::SetValueAll <<<======================= - void vApp::SetValueAll(ItemVal id, int val, ItemSetType setType) VCONST - { - for (WindList* curWin = _WindowList ; curWin !=0 ; curWin = curWin->nextWinList) - { - (curWin->window)->SetValue(id, val, setType); - } - } - -//======================>>> vApp::SetAppTitle <<<========================== - void vApp::SetAppTitle(VCONST char* title) - { - // set the title in the title bar -- this is a no-op on some platforms - } - -//========================>>> vApp::SetStringAll <<<======================= - void vApp::SetStringAll(ItemVal id, VCONST char* str) - { - for (WindList* curWin = _WindowList ; curWin !=0 ; curWin = curWin->nextWinList) - { - (curWin->window)->SetString(id, str); - } - } - -//========================>>> vApp::ShowList <<<======================= - int vApp::ShowList(void) - { - // This is a utility routine to show current information - - fprintf(stderr,"Registered windows:\n"); - for (WindList* curWin = _WindowList ; curWin !=0 ; curWin = curWin->nextWinList) - { - fprintf(stderr," %s\n",(curWin->window)->name()); - } - return 1; - } - -//====================>>> _appWorkTimer::TimerTick <<<==================== - void _appWorkTimer::TimerTick() - { - - theApp->DispatchWork(); - } - -//========================>>> vApp::EnableWorkSlice <<<==================== - int vApp::EnableWorkSlice(long slice) - { - - if (slice > 0) - { - if (_workTimer == 0) // First time to start timer - { - _workTimer = new _appWorkTimer; - } - return _workTimer->TimerSet(slice); - } - else - { - if (_workTimer) - _workTimer->TimerStop(); - } - return 1; - } - -//========================>>> vApp::DispatchWork <<<======================= - void vApp::DispatchWork(void) - { - - WorkSlice(); // Work Slice for App - // Call WorkSlice for all windows - for (WindList* curWin = _WindowList ; curWin !=0 ; - curWin = curWin->nextWinList) - { - (curWin->window)->WorkSlice(); - } - } - -//========================>>> vApp::GetMenuThis <<<======================= - vMenuPane* vApp::GetMenuThis(Widget w) - { - // This is a utility routine to get the this of a menu widget - - vMenuPane* mypane; - - for (WindList* curWin = _WindowList ; curWin !=0 ; curWin = curWin->nextWinList) - { - if ((mypane = (curWin->window)->GetMenuThis(w)) != 0) - return mypane; - } - return 0; - } - -//========================>>> vApp::doXEventLoop <<<======================= - void vApp::doXEventLoop(void) - { - // This is where we grab and handle events from the - // parent windowing system - - XtAppMainLoop(_appContext); // Xt's main loop handler - } - - -//######################################################################### -#ifdef DONT_USE_SEPARATE_STARTUP -//======================>>> main <<<====================================== - int main(int argc, char** argv) - { - int Xargc = argc; - int retcode; - - theApp->initialize(Xargc,argv); // Create top level widget - - if ((retcode = AppMain(Xargc,argv)) != 0) // call the app main program - exit(retcode); - - theApp->doXEventLoop(); // And enter the event loop - } -#endif - -//######################################################################### -// Utilities -//=========================>>> vSysWarning <<<============================ - void vSysWarning(VCONST char* msg) - { - XtAppWarning(theApp->appContext(), msg); - } - -//=========================>>> vSys <<<============================ - void vSysError(VCONST char* msg) - { - XtAppWarning(theApp->appContext(), msg); - exit(99); - } diff --git a/v/srcx/vawinfo.cxx b/v/srcx/vawinfo.cxx deleted file mode 100644 index a0fd17e..0000000 --- a/v/srcx/vawinfo.cxx +++ /dev/null @@ -1,31 +0,0 @@ -//=============================================================== -// vawinfo.cxx - vAppWinInfo utility class for tracking windows -// -// Copyright (C) 1995-2000 Bruce E. Wampler -// date: 28 Feb 2000 09:14:38 PM -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Lesser General Public License, -// Version 2.1 This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include -#include - -//=======================>>> vAppWinInfo::vAppWinInfo <<<=================== - vAppWinInfo::vAppWinInfo(VCONST char* name, VCONST void* ptr) - { - SysDebug1(Constructor,"vAppWinInfo::vAppWinInfo(%s) - constructor\n",name); - - _infoName = new char[strlen(name)+1]; - strcpy(_infoName, name); - _ptr = ptr; - } - -//=======================>>> vAppWinInfo::~vAppWinInfo <<<=================== - vAppWinInfo::~vAppWinInfo() - { - SysDebug(Destructor,"vAppWinInfo::~vAppWinInfo() - desstructor\n"); - delete [] _infoName; - } diff --git a/v/srcx/vbaseitm.cxx b/v/srcx/vbaseitm.cxx deleted file mode 100644 index 96d425e..0000000 --- a/v/srcx/vbaseitm.cxx +++ /dev/null @@ -1,55 +0,0 @@ -//=============================================================== -// vbaseitm.cpp - the base class that holds handle information - X11R5 -// -// Copyright (C) 1995-2000 Bruce E. Wampler -// date: 28 Feb 2000 09:16:09 PM -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Lesser General Public License, -// Version 2.1 This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // my defines -#include - -//=====================>>> vBaseItem::vBaseItem <<<==================== - vBaseItem::vBaseItem(VCONST char* name) // constructor - { - SysDebug1(Constructor,"\nvBaseItem::vBaseItem(%s) constructor\n",name) - - _vHandle = NULL; // No widget yet - _name = new char[strlen(name)+1]; // build a copy - strcpy(_name,name); - _copied = 0; // not copied - } - -//=====================>>> vBaseItem::vBaseItem <<<==================== - vBaseItem::vBaseItem(const vBaseItem& b) // Copy constructor - { - SysDebug(Constructor,"\nvBaseItem::vBaseItem(const vBaseItem) Copy constructor\n") - - _name = b._name; // name of item - _vHandle = b._vHandle; // X widget - _copied = 1; // This instance IS a copy - - } - -//=====================>>> vBaseItem::~vBaseItem <<<==================== - vBaseItem::~vBaseItem() // destructor - { - - if (_copied) // don't destruct if a copy - { - SysDebug1(Destructor,"vBaseItem::~vBaseItem: NOT destroying copy %s\n\n",_name) - return; - } - SysDebug1(Destructor,"vBaseItem::~vBaseItem: destroying %s\n\n",_name) - - if (_vHandle) - { - XtDestroyWidget(_vHandle); // Destroy widget if any - _vHandle = NULL; - } - delete [] _name; // free this space - } diff --git a/v/srcx/vbasewin.cxx b/v/srcx/vbasewin.cxx deleted file mode 100644 index 3df9ade..0000000 --- a/v/srcx/vbasewin.cxx +++ /dev/null @@ -1,47 +0,0 @@ -//=============================================================== -// vbasewin.cxx - vBaseWindow class functions - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // our header - -//======================>>> vBaseWindow::vBaseWindow <<<======================= - vBaseWindow::vBaseWindow(VCONST char *name) : - vBaseItem(name) - { - - SysDebug1(Constructor,"vBaseWindow::vBaseWindow(%s) constructor\n", name) - - _topLevel = 0; // null the main window - } - -//======================>>> vBaseWindow::vBaseWindow <<<======================= - vBaseWindow::vBaseWindow(const vBaseWindow& w) : - vBaseItem(w) - { - vSysError("vBaseWindow: V Semantics do not allow copy constructors."); - } - -//====================>>> vBaseWindow::~vBaseWindow <<<======================= - vBaseWindow::~vBaseWindow(void) - { - - SysDebug(Destructor,"vBaseWindow::~vBaseWindow destructor\n") - - } - -//======================>>> vWindow::closeBaseWindow <<<======================= - void vBaseWindow::closeBaseWindow(void) - { - if (_vHandle != 0) - { - XtDestroyWidget(_vHandle); // kill us off - _vHandle = 0; // and mark our handle null - } - } diff --git a/v/srcx/vbglcnv.cxx b/v/srcx/vbglcnv.cxx deleted file mode 100644 index 932b44e..0000000 --- a/v/srcx/vbglcnv.cxx +++ /dev/null @@ -1,321 +0,0 @@ -//=============================================================== -// vbaseGLCanvas - a basic GL window canvas for drawing -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // our header -// #include "vbglcnv.h" // our header - -extern "C" -{ -#ifndef Athena -#include -#else -#include -#endif -#include -} - -#include // we are part of a vWindow - - XVisualInfo* vBaseGLCanvasPane::_visinfo = 0; // one time visual - int vBaseGLCanvasPane::_doubleBuffer = 0; // if we have double buffering - unsigned int vBaseGLCanvasPane::_vGLmode = 0; - -//================>>> vBaseGLCanvasPane::vBaseGLCanvasPane <<<======================== - vBaseGLCanvasPane::vBaseGLCanvasPane(unsigned int vGLmode, - PaneType pt) : vCanvasPane(pt) - { - SysDebug(Constructor,"vBaseGLCanvasPane::vBaseGLCanvasPane() constructor\n") - - const unsigned int defGLmode = (vGL_RGB | vGL_DoubleBuffer); - - // One shot initialization of X Visual - - if (_visinfo == 0) // Haven't gotten a visual yet - { - _vGLmode = ((vGLmode == vGL_Default) ? defGLmode : vGLmode); - - if (_vGLmode & vGL_Indexed) // Indexed mode ********************* - { - _visinfo = chooseIndexed(_vGLmode); - if (_visinfo == 0 && (_vGLmode & vGL_DoubleBuffer)) - { - _vGLmode &= ~vGL_DoubleBuffer; // try without double buffer - _visinfo = chooseIndexed(_vGLmode); - } - } - else // RGB mode ******************** - { - _visinfo = chooseRGB(_vGLmode); - if (_visinfo == 0 && (_vGLmode & vGL_Alpha)) // try to get rid of this - { - _vGLmode &= ~vGL_Alpha; // zap the alpha plane - _visinfo = chooseRGB(_vGLmode); - } - if (_visinfo == 0 && (_vGLmode & vGL_DoubleBuffer)) - { - _vGLmode &= ~vGL_DoubleBuffer; // try without double buffer - _visinfo = chooseRGB(_vGLmode); - } - } - - if (_visinfo == 0) - XtAppError(theApp->appContext(), "Can't create Visual for GL."); - else - _doubleBuffer = (_vGLmode & vGL_DoubleBuffer); - } - } - -//================>>> vBaseGLCanvasPane::~vBaseGLCanvasPane <<<=================== - vBaseGLCanvasPane::~vBaseGLCanvasPane() - { - SysDebug(Destructor,"vBaseGLCanvasPane::~vBaseGLCanvasPane() destructor\n") - } - -//==================>>> vBaseGLCanvasPane::chooseIndexed <<<======================= - XVisualInfo* vBaseGLCanvasPane::chooseIndexed(unsigned int glMode) - { - - static int bufSizeList[] = {16, 12, 8, 4, 2, 1, 0}; - int list[32]; - int n = 0; - XVisualInfo* vi; - - list[n++] = GLX_BUFFER_SIZE; - list[n++] = 1; // we will dynamically change this - if (glMode & vGL_DoubleBuffer) - { - list[n++] = GLX_DOUBLEBUFFER; - } - if (glMode & vGL_Stereo) - { - list[n++] = GLX_STEREO; - } - if (glMode & vGL_Depth) - { - list[n++] = GLX_DEPTH_SIZE; - list[n++] = 1; - } - if (glMode & vGL_Stencil) - { - list[n++] = GLX_STENCIL_SIZE; - list[n++] = 1; - } - list[n] = (int) None; /* terminate list */ - - /* glXChooseVisual specify GLX_BUFFER_SIZE prefers the - "smallest index buffer of at least the specified size". - This would be reasonable if GLUT allowed the user to - specify the required buffe size, but GLUT's display mode - is too simplistic (easy to use?). GLUT should try to find - the "largest". So start with a large buffer size and - shrink until we find a matching one that exists. */ - - for (int i = 0; bufSizeList[i]; i++) - { - // Assumes list[1] is where GLX_BUFFER_SIZE parameter is. - list[1] = bufSizeList[i]; - vi = glXChooseVisual(theApp->display(), - DefaultScreen(theApp->display()), list); - if (vi) - { - return vi; - } - } - return 0; - } - -//==================>>> vBaseGLCanvasPane::chooseRGB <<<======================= - XVisualInfo* vBaseGLCanvasPane::chooseRGB(unsigned int glMode) - { - - int list[32]; - int n = 0; - XVisualInfo* vi; - - list[n++] = GLX_RGBA; - list[n++] = GLX_RED_SIZE; - list[n++] = 1; - list[n++] = GLX_GREEN_SIZE; - list[n++] = 1; - list[n++] = GLX_BLUE_SIZE; - list[n++] = 1; - if (glMode & vGL_Alpha) - { - list[n++] = GLX_ALPHA_SIZE; - list[n++] = 1; - } - - if (glMode & vGL_DoubleBuffer) - { - list[n++] = GLX_DOUBLEBUFFER; - } - if (glMode & vGL_Stereo) - { - list[n++] = GLX_STEREO; - } - if (glMode & vGL_Depth) - { - list[n++] = GLX_DEPTH_SIZE; - list[n++] = 16; // fixed for 1.25: 5/17/00 - } - if (glMode & vGL_Stencil) - { - list[n++] = GLX_STENCIL_SIZE; - list[n++] = 1; - } - if (glMode & vGL_Accum) - { - list[n++] = GLX_ACCUM_RED_SIZE; - list[n++] = 1; - list[n++] = GLX_ACCUM_GREEN_SIZE; - list[n++] = 1; - list[n++] = GLX_ACCUM_BLUE_SIZE; - list[n++] = 1; - if (glMode & vGL_Alpha) - { - list[n++] = GLX_ACCUM_ALPHA_SIZE; - list[n++] = 1; - } - } - - list[n] = (int) None; /* terminate list */ - - vi = glXChooseVisual(theApp->display(), - DefaultScreen(theApp->display()), list); - return vi; - } - -extern "C" -{ -//============================>>> CGLKeyInEV <<<========================== - void CGLKeyInEV(Widget w, XtPointer client_data, XEvent* event, char *x) - { - // KeyPress Event Handler - // - // client_data will have the this pointer of our object - - XKeyPressedEvent *kp; - - kp = (XKeyPressedEvent*)event; - vBaseGLCanvasPane* thisWindow = (vBaseGLCanvasPane*) client_data; // get back this - - thisWindow->GLKeyInEV(kp->keycode, kp->state); - } -} - -//==================>>> vBaseGLCanvasPane::initialize <<<========================== - void vBaseGLCanvasPane::initialize(vWindow* pWindow, Widget pWidget, - Widget drawCanvas, Widget drawArea) - { - - Widget drwCnv, drwArea; - - drwCnv = XtVaCreateManagedWidget( - "vBaseGLCanvasPane", - canvasWidgetClass, // widget class - pWidget, // parent widget -#ifndef Athena - XmNallowResize,1, -#else - XtNshowGrip, FALSE, - XtNallowResize,1, -#endif - XtNhSpace, 1, - XtNvSpace, 1, - XtNheight,(pWindow->getWinHeight())+16, - XtNwidth,(pWindow->getWinWidth())+16, - NULL); // argument list - - - drwArea = XtVaCreateManagedWidget( - "vCanvasDrawGL", // widget name - glwDrawingAreaWidgetClass, // widget class - drwCnv, // parent widget - GLwNvisualInfo, _visinfo, - XtNheight, pWindow->getWinHeight(), - XtNwidth, pWindow->getWinWidth(), - NULL); // argument list - - // now we can handle everything in the standard canvas - - vCanvasPane::initialize(pWindow, pWidget, drwCnv, drwArea); - - // The graphics init event - XtAddCallback(drwArea, GLwNginitCallback, CgraphicsInit,(XtPointer)this); - - glxContext = 0; - -#ifdef Athena - XtAddEventHandler(drwArea,KeyPressMask, 0, - (XtEventHandler)CGLKeyInEV,(XtPointer)this); -#endif - - } - -//=======================>>> vBaseGLCanvasPane::GLKeyInEV <<<========================== - void vBaseGLCanvasPane::GLKeyInEV(unsigned int keycode, unsigned int state) - { - CnvKeyInEv(keycode, state); // pass up - } - -//==================>>> vBaseGLCanvasPane::graphicsInit <<<======================== - void vBaseGLCanvasPane::graphicsInit(void) - { - XVisualInfo *visinfo; - - // Perform only the most basic operations, including getting the context - - XtVaGetValues(DrawingWindow(), GLwNvisualInfo, &visinfo, NULL); - - glxContext = glXCreateContext(theApp->display(), visinfo, - 0, // No sharing. - 1); // Direct rendering if possible. - - vglMakeCurrent(); - } - -//==================>>> vBaseGLCanvasPane::graphicsInit <<<======================== - void vBaseGLCanvasPane::vglFlush(void) - { - - if (_doubleBuffer) - glXSwapBuffers(theApp->display(), XtWindow(DrawingWindow())); - else - glFlush(); - - /* Avoid indirect rendering latency from queuing. */ - if (!glXIsDirect(theApp->display(), glxContext)) - glFinish(); - - - } - -//=====================>>> vBaseGLCanvasPane::Resize <<<============================ - void vBaseGLCanvasPane::Resize(int newW, int newH) - { - // This is the routine the user will override to intercept size changes - - vglMakeCurrent(); - glXWaitX(); - glViewport(0,0,newW,newH); - - } - - -extern "C" -{ -//==============================>>> CgraphicsInit <<<============================= - void CgraphicsInit(Widget w, XtPointer clientData, XtPointer call) - { - ((vBaseGLCanvasPane*)clientData)->graphicsInit(); - } - -} diff --git a/v/srcx/vbtncmd.cxx b/v/srcx/vbtncmd.cxx deleted file mode 100644 index 850f8ca..0000000 --- a/v/srcx/vbtncmd.cxx +++ /dev/null @@ -1,498 +0,0 @@ -//=============================================================== -// vbtncmd.xxx - button Cmd -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // Motif/Athena mapping -#include // our definitions -#include // a command parent -#include // for icons -#include - -extern "C" -{ -#ifndef Athena -#include -#include -#include -#endif - -#ifdef USE3D -#include -#include -#else -#include -#include -#endif - -#include - -} - -#ifndef Athena // -------------------------------------- - -#define cmdWidgetClass xmPushButtonWidgetClass -#define togWidgetClass xmToggleButtonWidgetClass -#define Ncallback XmNactivateCallback -#define Nheight XmNheight -#define Nlabel XmNlabelString -#define NmappedWhenManaged XmNmappedWhenManaged -#define Nwidth XmNwidth -//@@ These use athena parent for now -#define Nresizable(x) // XtNresizable,x - -#define setLabel(x,y) XmString x = XmStringCreateLocalized(y); -#define freeLabel(x) XmStringFree(x); - -#define shadowThick 2 - -#else //------------------------------------------------------ - -#ifdef USE3D -#define cmdWidgetClass command3dWidgetClass -#define togWidgetClass toggle3dWidgetClass -#else -#define cmdWidgetClass commandWidgetClass -#define togWidgetClass toggleWidgetClass -#endif -#define Ncallback XtNcallback -#define Nheight XtNheight -#define Nlabel XtNlabel -#define NmappedWhenManaged XtNmappedWhenManaged -#define Nwidth XtNwidth -#define Nresizable(x) XtNresizable,x, -#define setLabel(x,y) VCONST char* x = y; -#define freeLabel(x) - -#endif // ----------------------------------------------------- - -//====================>>> vButtonCmd::vButtonCmd <<<======================= - vButtonCmd::vButtonCmd(vCmdParent* dp, CommandObject* dc) : - vCmd(dp, dc) - { - initialize(); - } - -//====================>>> vButtonCmd::~vButtonCmd <<<======================= - vButtonCmd::~vButtonCmd() - { - - SysDebug(Destructor,"vButtonCmd::~vButtonCmd() destructor\n") - - } - -//=====================>>> vButtonCmd::initialize <<<======================= - void vButtonCmd::initialize() - { - // build a button command for use in a parent window - Pixmap pixmap = 0; - Pixmap inspixmap = 0; - - CopyToLocal(); // make local copies - - VCONST char* label = _title; - - SysDebug(Constructor,"vButtonCmd::vButtonCmd() constructor\n") - - Widget WfHoriz = _parentWin->getWidgetFromId(dlgCmd->cRightOf); - Widget WfVert = _parentWin->getWidgetFromId(dlgCmd->cBelow); - - int map = !(dlgCmd->attrs & CA_Hidden); - - if (dlgCmd->cmdType == C_IconButton && _itemList != 0) // icon - { - vIcon* ip = (vIcon *) _itemList; // to access bitmap - -#ifndef Athena - unsigned long wbg; - XtVaGetValues(wParent, XmNbackground, &wbg, 0); // get bg - - pixmap = ip->GetXPM(3, wbg); - inspixmap = ip->GetInsensXPM(3, wbg); - wCmd = XtVaCreateManagedWidget( - "ButtonCmd", // name - xmPushButtonWidgetClass, // class - wParent, // parent - XmNlabelType,XmPIXMAP, - XmNlabelPixmap,pixmap, - XmNlabelInsensitivePixmap,inspixmap, - - XmNmarginTop,0, - XmNmarginBottom,0, -// XmNmarginLeft,2, // 1.24 -// XmNmarginRight,2, - XmNmarginLeft,1, // 1.24 - XmNmarginRight,1, - XmNalignment, XmALIGNMENT_CENTER, - XmNborderWidth,0, - XmNshadowThickness, shadowThick, - - NmappedWhenManaged, map, - Nresizable(TRUE) - NULL); -#else - pixmap = ip->GetXPM(2); - wCmd = XtVaCreateManagedWidget( - "IconButtonCmd", // name - cmdWidgetClass, // class - wParent, // parent - XtNbitmap, pixmap, // the pixmap - XtNbackground, _vControlFace, - XtNinternalWidth,2, - NmappedWhenManaged, map, - Nresizable(TRUE) - NULL); -#endif - if (WfVert != 0) - XtVaSetValues(wCmd, Nbelow(WfVert) NULL); - if (WfHoriz != 0) - XtVaSetValues(wCmd, NrightOf(WfHoriz) NULL); - } - else if (dlgCmd->cmdType == C_ToggleIconButton && _itemList != 0) // icon - { - vIcon* ip = (vIcon *) _itemList; // to access bitmap - - -#ifndef Athena - unsigned long wbg; - XtVaGetValues(wParent, XmNbackground, &wbg, 0); // get bg - - pixmap = ip->GetXPM(3, wbg); - inspixmap = ip->GetInsensXPM(3, wbg); - wCmd = XtVaCreateManagedWidget( - "ToggleIconButtonCmd", // name - togWidgetClass, // class - wParent, // parent - XmNlabelType,XmPIXMAP, - XmNlabelPixmap, pixmap, // the pixmap - XmNlabelInsensitivePixmap,inspixmap, - XmNset,_retVal, - - XmNmarginTop,2, - XmNmarginBottom,2, - XmNmarginLeft,2, - XmNmarginRight,2, - XmNalignment, XmALIGNMENT_CENTER, - XmNborderWidth,0, - XmNshadowThickness, shadowThick, - - XmNfillOnSelect,0, // alternate method suggested - XmNindicatorOn,0, // by promayon@imag.fr - - NmappedWhenManaged, map, - Nresizable(TRUE) - NULL); -#else - - pixmap = ip->GetXPM(2); - wCmd = XtVaCreateManagedWidget( - "ToggleIconButtonCmd", // name - togWidgetClass, // class - wParent, // parent - XtNbitmap, pixmap, // the pixmap - XtNbackground, _vControlFace, - XtNinternalWidth,2, - XtNstate,_retVal, -#ifdef USE3D - XtNhighlightThickness,0, -#endif - NmappedWhenManaged, map, - Nresizable(TRUE) - NULL); -#endif - - if (WfVert != 0) - XtVaSetValues(wCmd, Nbelow(WfVert) NULL); - if (WfHoriz != 0) - XtVaSetValues(wCmd, NrightOf(WfHoriz) NULL); - - } - else if (dlgCmd->cmdType == C_ToggleButton) // normal toggle button - { - setLabel(lbl,label) - wCmd = XtVaCreateManagedWidget( - "ToggleButtonCmd", // name - togWidgetClass, // class - wParent, // parent - NmappedWhenManaged, map, - Nlabel, lbl, // label -#ifndef Athena - XmNmarginTop,0, - XmNmarginBottom,0, - XmNmarginLeft,3, - XmNmarginRight,3, - XmNalignment, XmALIGNMENT_CENTER, - XmNborderWidth,0, - XmNshadowThickness, shadowThick, - XmNset,_retVal, - XmNfillOnSelect,1, - XmNindicatorOn,0, -#else - XtNstate,_retVal, - XtNbackground, _vControlFace, -#ifdef USE3D - XtNhighlightThickness,0, -#endif -#endif - Nresizable(TRUE) - NULL); - if (WfVert != 0) - XtVaSetValues(wCmd, Nbelow(WfVert) NULL); - if (WfHoriz != 0) - XtVaSetValues(wCmd, NrightOf(WfHoriz) NULL); - - freeLabel(lbl) - } - else // regular command button - { - setLabel(lbl,label) - -#ifdef Athena - if ((dlgCmd->attrs & CA_DefaultButton)) // default button? - { - wCmd = XtVaCreateManagedWidget( - "ButtonCmd", // name - cmdWidgetClass, // class type - wParent, // parent widget - NmappedWhenManaged, map, - Nlabel, lbl, // label - XtNinternalHeight,1, - XtNborderWidth, 2, - Nresizable(TRUE) - NULL); - } - else -#endif - { - wCmd = XtVaCreateManagedWidget( - "ButtonCmd", // name - cmdWidgetClass, // class type - wParent, // parent widget - NmappedWhenManaged, map, - Nlabel, lbl, // label -#ifndef Athena - XmNmarginTop,0, - XmNmarginBottom,0, - XmNmarginLeft,3, - XmNmarginRight,3, - XmNalignment, XmALIGNMENT_CENTER, - XmNborderWidth,0, - XmNshadowThickness, shadowThick, -#endif - Nresizable(TRUE) - NULL); - } - - if (WfVert != 0) - XtVaSetValues(wCmd, Nbelow(WfVert) NULL); - if (WfHoriz != 0) - XtVaSetValues(wCmd, NrightOf(WfHoriz) NULL); - - freeLabel(lbl) - } - -#ifdef Athena - if (dlgCmd->cmdType == C_Button) - { - XtVaSetValues(wCmd, // the widget to set - XtNbackground, _vControlFace, - NULL); - } -#endif - - if (dlgCmd->cmdType == C_Button && dlgCmd->size > 0) // size - width - { - int w = XTextWidth(theApp->_XDefaultFont, label,strlen(label)); - if (w < dlgCmd->size) - { - XtVaSetValues(wCmd, -#ifndef Athena - Nwidth,dlgCmd->size+5, -#else -#ifdef USE3D - Nwidth,dlgCmd->size+3, -#else - Nwidth,dlgCmd->size, -#endif -#endif - NULL); // the border - } - } - else if (dlgCmd->size > 0) // size - square (icons, color buttons) - { - XtVaSetValues(wCmd, -#ifndef Athena - Nwidth, dlgCmd->size+6, - Nheight, dlgCmd->size+5, - XmNrecomputeSize,1, -#else -#ifdef USE3D - Nwidth,dlgCmd->size+3, - Nheight, dlgCmd->size+3, -#else - Nwidth, dlgCmd->size, - Nheight, dlgCmd->size, -#endif -#endif - NULL); // the border - } - - wBox = 0; // no Box, but make copy for placement - - if ((dlgCmd->attrs & CA_DefaultButton)) // default button? - { -#ifdef Athena - // make the Return key work for this button - XtAccelerators button = XtParseAcceleratorTable( - "Return: set() notify() unset()\n"); - - XtVaSetValues(wCmd, - XtNaccelerators, button, // the accelerators - NULL); // the border -#else -// XtVaSetValues(wCmd, -// XmNshowAsDefault,1, -// NULL); // the border -#endif - } - -#ifndef Athena - if (dlgCmd->cmdType == C_ToggleIconButton && _itemList || - dlgCmd->cmdType == C_ToggleButton) // A toggle button - { - XtAddCallback(wCmd, XmNvalueChangedCallback, CButtonCmdCB, (XtPointer)this); - } - else - XtAddCallback(wCmd, Ncallback, CButtonCmdCB, (XtPointer)this); - -#else - XtAddCallback(wCmd, Ncallback, CButtonCmdCB, (XtPointer)this); -#endif - - // Need to set to insensitive if it is set insensitive - if (!_Sensitive) - { - XtVaSetValues(wCmd, // the widget to set - XtNsensitive, 0, // change to insensitive - NULL); - } - } - -//==================>>> vButtonCmd::GetCmdValue <<<========================= - int vButtonCmd::GetCmdValue(ItemVal id) VCONST - { - if (id != _cmdId) - return -1; - return _retVal; - } - -//================>>> vButtonCmd::ResetItemValue <<<====================== - void vButtonCmd::ResetItemValue(void) - { - - // We have to toggle things - - if (dlgCmd->cmdType != C_ToggleIconButton && - dlgCmd->cmdType != C_ToggleButton) - return; - - if (_retVal == _origVal) // No op if no change - return; - - _retVal = _origVal; // restore - -#ifndef Athena - XtVaSetValues(wCmd, // set for this widget - XmNset,_retVal, - NULL); -#else - XtVaSetValues(wCmd, // set for this widget - XtNstate,_retVal, - NULL); -#endif - - // let parent window handle now - _parentWin->ProcessCmd(_cmdId, _retVal, dlgCmd->cmdType); - } - -//================>>> vButtonCmd::SetCmdVal <<<============================ - void vButtonCmd::SetCmdVal(ItemVal val, ItemSetType st) - { - - SysDebug1(Misc,"vButtonCmd::SetCmdVal(val:%d)\n",val) - - if (st == Sensitive) - { - _Sensitive = val; // set - XtVaSetValues(wCmd, // the widget to set - XtNsensitive, val, // change sensitive - NULL); - } - else if (st == Hidden) // hide or unhide - { - if (val) - { - XtUnmapWidget(wCmd); // unmap this widget - } - else - { - XtMapWidget(wCmd); // unmap this widget - } - } - else if (st == Value || st == Checked) - { - _retVal = val; // set - - XtVaSetValues(wCmd, // set for this widget -#ifndef Athena - XmNset,_retVal, -#else - XtNstate,_retVal, -#endif - NULL); - } - } - -//================>>> vButtonCmd::SetCmdStr <<<============================ - void vButtonCmd::SetCmdStr(char* str) - { - // Set the string value of button - - SysDebug1(Misc,"vButtonCmd::SetCmdStr(str:%s)\n",str) - - _title = str; - - setLabel(tmp,str) - - XtVaSetValues(wCmd, // the widget to set - Nlabel, tmp, // label - NULL); - - freeLabel(tmp) - - } - -//====================>>> vButtonCmd::ButtonCmdCB <<<======================= - void vButtonCmd::ButtonCmdCB(void) - { - if (dlgCmd->cmdType == C_ToggleIconButton || - dlgCmd->cmdType == C_ToggleButton) - _retVal = !_retVal; - - _parentWin->ProcessCmd(_cmdId, _retVal, dlgCmd->cmdType); - } - -extern "C" -{ -//============================>>> CButtonCB <<<============================= - void CButtonCmdCB(Widget w, XtPointer This, XtPointer call_data) - { - ((vButtonCmd*)This)->ButtonCmdCB(); - } -} diff --git a/v/srcx/vcanvas.cxx b/v/srcx/vcanvas.cxx deleted file mode 100644 index 810ce57..0000000 --- a/v/srcx/vcanvas.cxx +++ /dev/null @@ -1,1326 +0,0 @@ -//=============================================================== -// vCanvas - a scrolling window canvas for drawing -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // our header -#include - -extern "C" -{ -#ifndef Athena -#include -#include -#define sbWidgetClass xmScrollBarWidgetClass -#define sbThickness 13 - -#else - -#include - -#ifdef USE3D -#include -#define sbWidgetClass scrollbar3dWidgetClass -#define sbThickness 15 -#else -#include -#define sbWidgetClass scrollbarWidgetClass -#define sbThickness 10 -#endif -#endif - -#include // our own canvas widget - -} -#include // need access to the app -#include // we are part of a vWindow -#include // for vCanvasPaneDC - - VCursor vCanvasPane::_currentCursor = -1; // for cursor -#ifndef Athena - XEvent* VGlobalButtonPressedEvent; // nasty but easy -#endif - -// Put the X dependent Cursor tables here... - - static unsigned int VtoXmap[] = - { - XC_X_cursor, XC_top_left_arrow, XC_center_ptr, XC_crosshair, - XC_sb_h_double_arrow, XC_hand2, XC_xterm, XC_icon, - XC_sb_v_double_arrow, XC_pencil, XC_question_arrow, - XC_sizing, XC_watch, XC_X_cursor - }; - - static Cursor XCursors[maxCursors+1]; - -//================>>> vCanvasPane::vCanvasPane <<<======================== - vCanvasPane::vCanvasPane(PaneType pt) : vPane(pt) - { - SysDebug(Constructor,"vCanvasPane::vCanvasPane() constructor\n") - - _cpDC = 0; // no pane DC - _compressRedraw = 1; // compress by default - - if (_currentCursor == -1) // Do we need to create cursors? - { - _currentCursor = VC_None; - for (int i = 0 ; i <= maxCursors ; ++i) // Create all cursors - { - XCursors[i] = XCreateFontCursor(theApp->display(),VtoXmap[i]); - // Get the fg and bg to make cursor match - } - } - - } - -//================>>> vCanvasPane::~vCanvasPane <<<======================== - vCanvasPane::~vCanvasPane() - { - SysDebug(Destructor,"vCanvasPane::~vCanvasPane() destructor\n") - if (_cpDC != 0) - delete _cpDC; // free the DC - } - -//==================>>> vCanvasPane::initialize <<<========================== - void vCanvasPane::initialize(vWindow* pWindow, Widget pWidget, - Widget drawCanvas, Widget drawArea) - { - XtCallbackRec HscrollProcList[] = - { - { CHScrollProcCB, this }, - { (XtCallbackProc) 0, (XtPointer) 0} - }; - XtCallbackRec VscrollProcList[] = - { - { CVScrollProcCB, this }, - { (XtCallbackProc) 0, (XtPointer) 0} - }; - -#ifdef Athena - XtCallbackRec HjumpProcList[] = - { - { CHJumpProcCB, this }, - { (XtCallbackProc) 0, (XtPointer) 0} - }; - - XtCallbackRec VjumpProcList[] = - { - { CVJumpProcCB, this }, - { (XtCallbackProc) 0, (XtPointer) 0} - }; -#endif - - SysDebug(Constructor,"vCanvasPane::initialize()\n") - _ResizeDone = 0; - _HScrlShown = 100; //@@@@ - _HScrlTop = 0; - _VScrlShown = 100; - _VScrlTop = 0; - - // now, build the menu items in the widget provided - - vPane::initialize(pWindow,pWidget); // initialize base class - - // canvasWidgetClass is V's own Widget that manages a drawing - // area and scroll bars. - - if (drawCanvas != 0) // canvas provided by subclass - { - _drawCanvas = drawCanvas; - } - else - { - _drawCanvas = XtVaCreateManagedWidget( - "vCanvasPane", - canvasWidgetClass, // widget class - _baseW, // parent widget -#ifndef Athena - XmNallowResize,1, -#else - XtNshowGrip, FALSE, - XtNallowResize,1, -#endif - XtNhSpace, 1, - XtNvSpace, 1, - XtNheight,(_parentWin->_WinHeight)+16, - XtNwidth,(_parentWin->_WinWidth)+16, - NULL); // argument list - } - - pWindow->setworkArea(_drawCanvas); - - // -------------------------------------------------------------- - _hasFocus = 0; // we don't start out with focus - _mouseDown = 0; // mouse is not down - - Dimension curW, curH; - -#ifndef Athena - - String translations = -": DrawingAreaInput() \n\ - : DrawingAreaInput() \n\ - : DrawingAreaInput() \n\ - : DrawingAreaInput() \n\ - : DrawingAreaInput()"; - - - if (drawArea != 0) - { - _drawWindow = drawArea; - } - else - { - _drawWindow = XtVaCreateManagedWidget( - "vCanvasDraw", // widget name - xmDrawingAreaWidgetClass, // widget class - _drawCanvas, // parent widget - - XmNtranslations, XtParseTranslationTable(translations), - XmNheight, _parentWin->_WinHeight, - XmNwidth, _parentWin->_WinWidth, - - XmNresizePolicy, XmRESIZE_ANY, - - XmNinitialFocus,1, - - NULL); // argument list - } - - // grab the events now, then setup all the callbacks. - // V 1.22 - BEW via C R Johnson: - // XmNuserData did not seem to work in a LessTif/mesa combo, - // so use client_data instead. - - XtAddCallback(_drawWindow,XmNinputCallback, CinputCB, (XtPointer)this); - XtAddCallback(_drawWindow,XmNexposeCallback, CexposeCB, (XtPointer)this); - XtAddCallback(_drawWindow,XmNresizeCallback, CresizeCB, (XtPointer)this); - -#else - if (drawArea != 0) - { - _drawWindow = drawArea; - } - else - { - _drawWindow = XtVaCreateManagedWidget( - "vCanvasDraw", // widget name - coreWidgetClass, // widget class - _drawCanvas, // parent widget - XtNheight, _parentWin->_WinHeight, - XtNwidth, _parentWin->_WinWidth, - NULL); // argument list - } - -#endif - - - // -------------------------------------------------------------- - - // After the drawing widget has been created, we can create - // the DC for it to use. - - CreateDC(); - - // now create scroll bars, add to the _drawCanvas - -#ifndef Athena - _drawVScroll = XtVaCreateManagedWidget( - "vCanvasVScroll", // name - sbWidgetClass, // class - _drawCanvas, // parent - - XmNvalueChangedCallback, VscrollProcList, // callback for scrolling - XmNincrementCallback, VscrollProcList, // callback for scrolling - XmNdecrementCallback, VscrollProcList, // callback for scrolling - XmNpageDecrementCallback, VscrollProcList, // callback for scrolling - XmNpageIncrementCallback, VscrollProcList, // callback for scrolling - - XmNheight, _parentWin->_WinHeight, - XmNwidth, sbThickness, // scrollbar param - XmNorientation,XmVERTICAL, - XmNmaximum,100, - NULL); - - _drawHScroll = XtVaCreateManagedWidget( - "vCanvasHScroll", - sbWidgetClass, - _drawCanvas, - - XmNvalueChangedCallback, HscrollProcList, // callback for scrolling - XmNdecrementCallback, HscrollProcList, // callback for scrolling - XmNincrementCallback, HscrollProcList, // callback for scrolling - XmNpageDecrementCallback, HscrollProcList, // callback for scrolling - XmNpageIncrementCallback, HscrollProcList, // callback for scrolling - - XmNorientation,XmHORIZONTAL, - XmNheight, sbThickness, // scrollbar param - XmNwidth, _parentWin->_WinWidth, - XmNmaximum,100, - NULL); - -#else - _drawVScroll = XtVaCreateManagedWidget( - "vCanvasVScroll", // name - sbWidgetClass, // class - _drawCanvas, // parent - XtNscrollProc, VscrollProcList, // callback for scrolling - XtNjumpProc, VjumpProcList, // callback for scrolling - XtNheight, _parentWin->_WinHeight, - XtNthickness, sbThickness, // scrollbar param -#ifdef USE3D - XtNbackground,_vControlFace, - XtNscrollbar3dBackground, _vControlBG, -#endif - NULL); - - _drawHScroll = XtVaCreateManagedWidget( - "vCanvasHScroll", - sbWidgetClass, - _drawCanvas, - XtNscrollProc, HscrollProcList, // callback for scrolling - XtNjumpProc, HjumpProcList, // callback for scrolling - XtNorientation,XtorientHorizontal, // scrollbar param - XtNthickness, sbThickness, // scrollbar param - XtNwidth, _parentWin->_WinWidth, -#ifdef USE3D - XtNbackground,_vControlFace, -XtNscrollbar3dBackground, _vControlBG, -#endif - NULL); - -#endif - - - // handle required events - requires redrawing -#ifdef Athena - - XtAddEventHandler(_drawWindow, ExposureMask, 0, - (XtEventHandler)CExposeEV,(XtPointer)this); - - // get mouse events - XtAddEventHandler(_drawWindow, ButtonPressMask, 0, - (XtEventHandler)CMouseDownEV,(XtPointer)this); - XtAddEventHandler(_drawWindow, PointerMotionMask, 0, - (XtEventHandler)CMouseMoveEV,(XtPointer)this); - XtAddEventHandler(_drawWindow, ButtonReleaseMask, 0, - (XtEventHandler)CMouseUpEV,(XtPointer)this); - - XtAddCallback(_drawCanvas, XtNcallback, CchangeCB, (XtPointer)this); -#endif - - // These work for Motif and Athena - - XtAddEventHandler(_drawWindow, EnterWindowMask, 0, - (XtEventHandler)CEnterEV,(XtPointer)this); - XtAddEventHandler(_drawWindow, LeaveWindowMask, 0, - (XtEventHandler)CLeaveEV,(XtPointer)this); - - _HOn = _VOn = 0; // both start out on - - SetHScroll(_HScrlShown, 0); // initial values for scroll bar - SetVScroll(_VScrlShown, 0); - - XtUnmanageChild(_drawHScroll); // Unmanage the widget - XtUnmanageChild(_drawVScroll); // Unmanage the widget - - XtVaGetValues(_drawCanvas, // get values for the draw canvas - XtNwidth, &curW, // its new h and w - XtNheight, &curH, - NULL); - - _height = curH; // update the local stuff - _width = curW; - - // The parent will resize based on stuff the child does. - - XtVaGetValues(_baseW, // parent widget - XtNwidth, &curW, // its new h and w - XtNheight, &curH, - NULL); - - _parentWin->_WinWidth = curW; - _parentWin->_WinHeight = curH; // update the local stuff - - _compressRedraw = 1; // compress by default - _Drawable = 0; - } - -//==================>>> vCanvasPane::CreateDC <<<======================== - void vCanvasPane::CreateDC(void) - { - if (!_cpDC) - _cpDC = new vCanvasPaneDC(this); // create a CanvasPaneDC - } - -//==================>>> vCanvasPane::ChangeCB <<<======================== - void vCanvasPane::ChangeCB(void) - { - Dimension curW, curH; - -#ifndef Athena - if (!_ResizeDone) // problem in lesstif - { - _ResizeDone = 1; - return; - } -#endif - XtVaGetValues(_drawWindow, // get values for the draw canvas - XtNwidth, &curW, // its new h and w - XtNheight, &curH, - NULL); - - if (curW > 0x7FFF) // supposed to be unsigned, but - curW = 0; // can get confused - if (curH > 0x7FFF) // supposed to be unsigned, but - curH = 0; // can get confused - - _height = curH; - _width = curW; - - // The parent will resize based on stuff the child does. - - Dimension pW, pH; - XtVaGetValues(_baseW, // parent widget - XtNwidth, &pW, // its new h and w - XtNheight, &pH, - NULL); - - _parentWin->_WinWidth = pW; - _parentWin->_WinHeight = pH; // update the local stuff - - Resize((int)curW, (int)curH); // Call the virtual function - - } - -//====================>>> vCanvasPane::ShowPane <<<====================== - void vCanvasPane::ShowPane(int OnOrOff) VCONST - { - if (OnOrOff) - { - XtManageChild(_drawCanvas); - } - else - { - XtUnmanageChild(_drawCanvas); - } - } - -//=====================>>> vCanvasPane::SetWidthHeight <<<============================ - void vCanvasPane::SetWidthHeight(int width, int height) - { - Dimension curW = width; - Dimension curH = height; - Dimension oldbaseW; - Dimension oldbaseH; - Dimension oldcnvW; - Dimension oldcnvH; - - SysDebug(Constructor,"vCanvasPane::setWidthHeight\n") - // find out the size difference between the window and the canvas - - XtVaGetValues(_baseW, // parent widget - XtNwidth, &oldbaseW, // its current h and w - XtNheight, &oldbaseH, - NULL); - - XtVaGetValues(_drawCanvas, // parent widget - XtNwidth, &oldcnvW, // its current h and w - XtNheight, &oldcnvH, - NULL); - - Dimension DiffW = (oldcnvW <= oldbaseW) ? oldbaseW - oldcnvW + 1 : 1 ; - Dimension DiffH = (oldcnvH <= oldbaseH) ? oldbaseH - oldcnvH + 1 : 1; - - XtVaSetValues(_baseW, // get values for the draw canvas - XtNwidth, curW + DiffW, // its new h and w - XtNheight, curH + DiffH, // its new h and w - NULL); - - // Now set the height of the canvas window. You don't always - // get what you asked for, however. - XtVaSetValues(_drawCanvas, // get values for the draw canvas - XtNheight, curH, - XtNwidth, curW, // its new h and w - NULL); - - - // Get these from X -- the window manager can muck these up. - XtVaGetValues(_drawCanvas, // get values for the draw canvas - XtNwidth, &curW, // its new h and w - XtNheight, &curH, - NULL); - - _height = curH; - _width = curW; - - XtVaGetValues(_baseW, // parent widget - XtNwidth, &curW, // its new h and w - XtNheight, &curH, - NULL); - - _parentWin->_WinWidth = curW; - _parentWin->_WinHeight = curH; - - } - -//------------------------- cursor Stuff --------------------------------- -//=====================>>> vCanvasPane::SetCursor <<<============================ - void vCanvasPane::SetCursor(VCursor id) - { - // Set to current cursor - - if (id < VC_None || id > VC_LAST) - { - SysDebug1(BadVals,"vCanvasPane::SetCursor(id=%d)\n",id) - return; - } - - if (id == VC_None) // special case - UnSetCursor(); - - SysDebug1(WindowEvents,"vCanvasPane::SetCursor(id=%d)\n",id) - - _currentCursor = id; - - XDefineCursor(theApp->display(), XtWindow(_drawWindow), XCursors[id]); - } - -//=====================>>> vCanvasPane::UnSetCursor <<<============================ - void vCanvasPane::UnSetCursor(void) - { - XUndefineCursor(theApp->display(), XtWindow(_drawWindow)); - _currentCursor = VC_None; - } - -//------------------------- Scrolling Stuff --------------------------------- -//====================>>> vCanvasPane::HJumpProcCB <<<========================= - void vCanvasPane::HJumpProcCB(float fpercent, int motifValue) - { - // This is called with a fraction from 0 to 1.0 indicating - // how far the user has moved the scroll bar left or right. - // I can't get the Athena scroll widget to work how I want, so - // I'll live with how it seems to want to work: the shown - // fraction only is "correct" when it will all fit. The top - // will always be right - but 100 is at the bottom with the - // shown drawn out of the scroll box. Sigh... - - int shown = _HScrlShown; - int max_top = 100 - shown; - int top; - -#ifndef Athena - int percent = (int)motifValue; -#else - int percent = (int)(fpercent * 100.); -#endif - - if (percent > max_top) - { - percent = max_top; - } - - if (max_top == 0) - top = 0; - else - top = (percent * 100) / max_top; - - if (top != _HScrlTop) // actually changed things - { - HPage(shown, top); - } - } - -//=======================>>> vCanvasPane::HPage <<<============================ - void vCanvasPane::HPage(int Shown, int Top) - { - // This is the main way a user app gets scrolling events, and - // will usually override this guy to handle what is actually - // drawn in the canvas window. - // This should then be called to actually change the display. - - SysDebug2(WindowEvents,"vCanvasPane::HPage(Shown: %d, Top: %d)\n",Shown, Top); - - SetHScroll(Shown,Top); - } - -//=======================>>> vCanvasPane::HScroll <<<========================== - void vCanvasPane::HScroll(int step) - { - // This is the way the user app gets step events - either page or - // single step events. The default doesn't have to do anything. - - SysDebug1(WindowEvents,"vCanvasPane::HScroll(%d)\n",step); - - } - -//=====================>>> vCanvasPane::ShowHScroll <<<========================= - void vCanvasPane::ShowHScroll(int OnOff) - { - if (OnOff) // Turn on - { - if (_HOn) // Already on - return; - _HOn = 1; - XtManageChild(_drawHScroll); // Unmanage the widget - } - else // Turn off - { - if (!_HOn) // Already off - return; - _HOn = 0; - XtUnmanageChild(_drawHScroll); // Unmanage the widget - } - - Dimension curW, curH; - - XtVaGetValues(_drawWindow, // get values for the draw canvas - XtNwidth, &curW, // its new h and w - XtNheight, &curH, - NULL); - - _height = curH; // update the local stuff - _width = curW; - - Dimension pW, pH; - XtVaGetValues(_baseW, // parent widget - XtNwidth, &pW, // its new h and w - XtNheight, &pH, - NULL); - - _parentWin->_WinWidth = pW; - _parentWin->_WinHeight = pH; // update the local stuff - - XClearArea(XtDisplay(_drawWindow), XtWindow(_drawWindow), - 0, 0, _width, _height, 1); - - } - -//=====================>>> vCanvasPane::ShowVScroll <<<========================= - void vCanvasPane::ShowVScroll(int OnOff) - { - if (OnOff) // Turn on - { - if (_VOn) // Already on - return; - _VOn = 1; - XtManageChild(_drawVScroll); // Unmanage the widget - } - else // Turn off - { - if (!_VOn) // Already off - return; - _VOn = 0; - XtUnmanageChild(_drawVScroll); // Unmanage the widget - } - - Dimension curW, curH; - - XtVaGetValues(_drawWindow, // get values for the draw canvas - XtNwidth, &curW, // its new h and w - XtNheight, &curH, - NULL); - - _height = curH; // update the local stuff - _width = curW; - - Dimension pW, pH; - XtVaGetValues(_baseW, // parent widget - XtNwidth, &pW, // its new h and w - XtNheight, &pH, - NULL); - - _parentWin->_WinWidth = pW; - _parentWin->_WinHeight = pH; // update the local stuff - - XClearArea(XtDisplay(_drawWindow), XtWindow(_drawWindow), - 0, 0, _width, _height, 1); - } - -//=====================>>> vCanvasPane::SetHScroll <<<========================= - void vCanvasPane::SetHScroll(int Shown, int Top) - { - // Make sure we are setting to valid values, and are changing things! - - if (Shown < 0 || Shown > 100 || Top < 0 || Top > 100) - return; - - _HScrlShown = Shown; - if (Shown < 5) // it must be something that shows - _HScrlShown = 5; - - if (Shown == 100) // Map top to space we have available - _HScrlTop = 0; - else - _HScrlTop = Top; - - DrawHScroll(_HScrlShown, _HScrlTop); - - } - -//=====================>>> vCanvasPane::DrawHScroll <<<======================== - void vCanvasPane::DrawHScroll(int Shown, int Top) - { - Arg args[3]; // Used to pass float value - -#ifndef Athena - float shown = (float) Shown; - int iTop; - - if (Top == 0) - iTop = 0; - else if (Top == 100) - iTop = 100 - Shown; - else - iTop = (int) ((100. - shown)*((float)Top / 100.)); - - XtVaSetValues(_drawHScroll, - XmNsliderSize,Shown, - XmNvalue,iTop, - NULL); -#else - union - { - XtArgVal arg_value; - float float_value; - } shown_value, top_value; - - float shown = float(Shown) / 100.; - float top; - - if (Top == 0) - top = 0.; - else - top = float(Top) / 100.; -//1.20 top = (1. - shown)*(float(Top) / 100.); - - shown_value.float_value = shown; - top_value.float_value = top; - - if (sizeof (float) > sizeof (XtArgVal)) - { - XtSetArg(args[0], XtNtopOfThumb, &top_value); - XtSetArg(args[1], XtNshown, &shown_value); - } - else - { - XtSetArg(args[0], XtNtopOfThumb, top_value.arg_value); - XtSetArg(args[1], XtNshown, shown_value.arg_value); - } - - XtSetValues(_drawHScroll, args, 2); // change it! -#endif - - } - -//====================>>> vCanvasPane::VJumpProcCB <<<======================= - void vCanvasPane::VJumpProcCB(float fpercent, int motifValue) - { - // This code must be used with the 3D Widgets since they - // actually give the correct values -- we need to map - // the value supplied from the widget to a 0 - 100 range - // required by the V specs. - - - int shown = _VScrlShown; - int max_top = 100 - shown; - int top; - -#ifndef Athena - int percent = (int)motifValue; -#else - int percent = (int)(fpercent * 100.); -#endif - - if (percent > max_top) - { - percent = max_top; - } - - if (max_top == 0) - top = 0; - else - top = (percent * 100) / max_top; - - if (top != _VScrlTop) // actually changed things - { - VPage(shown, top); - } - } - -//========================>>> vCanvasPane::VPage <<<=========================== - void vCanvasPane::VPage(int Shown, int Top) - { - - SysDebug2(WindowEvents,"vCanvasPane::VPage(Shown: %d, Top: %d)\n",Shown, Top); - - SetVScroll(Shown,Top); - - } - -//========================>>> vCanvasPane::VScroll <<<========================= - void vCanvasPane::VScroll(int step) - { - // This is the way the user app gets step events - either page or - // single step events. The default doesn't have to do anything. - - SysDebug1(WindowEvents,"vCanvasPane::VScroll(%d)\n",step); - - } - -//=====================>>> vCanvasPane::GetVScroll <<<========================= - int vCanvasPane::GetVScroll(int& Shown, int& Top) VCONST - { - Shown = _VScrlShown; Top = _VScrlTop; - return _VOn; - } - -//=====================>>> vCanvasPane::GetHScroll <<<========================= - int vCanvasPane::GetHScroll(int& Shown, int& Top) VCONST - { - Shown = _HScrlShown; Top = _HScrlTop; - return _HOn; - } - -//=====================>>> vCanvasPane::SetVScroll <<<========================= - void vCanvasPane::SetVScroll(int Shown, int Top) - { - // Make sure we are setting to valid values, and are changing things! - - if (Shown < 0 || Shown > 100 || Top < 0 || Top > 100) - return; - - _VScrlShown = Shown; - if (Shown < 5) - _VScrlShown = 5; - - if (Shown == 100) // Map top to space we have available - _VScrlTop = 0; - else - _VScrlTop = Top; - - DrawVScroll(_VScrlShown, _VScrlTop); - } - -//======================>>> vCanvasPane::DrawVScroll <<<======================= - void vCanvasPane::DrawVScroll(int Shown, int Top) - { - -#ifndef Athena - float shown = (float) Shown; - int iTop; - - if (Top == 0) - iTop = 0; - else if (Top == 100) - iTop = 100 - Shown; - else - iTop = (int) ((100. - shown)*((float)Top / 100.)); - - XtVaSetValues(_drawVScroll, - XmNsliderSize,Shown, - XmNvalue,iTop, - NULL); -#else - Arg args[3]; // Used to pass float value - - union - { - XtArgVal arg_value; - float float_value; - } shown_value, top_value; - - float shown = float(Shown) / 100.; - float top; - - - if (Top == 0) - top = 0.; - else - top = float(Top) / 100.; -//1.20 top = (1. - shown)*(float(Top) / 100.); - - shown_value.float_value = shown; - top_value.float_value = top; - - if (sizeof (float) > sizeof (XtArgVal)) - { - XtSetArg(args[0], XtNtopOfThumb, &top_value); - XtSetArg(args[1], XtNshown, &shown_value); - } - else - { - XtSetArg(args[0], XtNtopOfThumb, top_value.arg_value); - XtSetArg(args[1], XtNshown, shown_value.arg_value); - } - - XtSetValues(_drawVScroll, args, 2); // change it! -#endif - - } - -//====================>>> vCanvasPane::HScrollProcCB <<<======================= - void vCanvasPane::HScrollProcCB(int position) - { - if (position > 0) // Scroll right a page - HScroll(1); - else - HScroll(-1); // Scroll left a page - } - -//====================>>> vCanvasPane::VScrollProcCB <<<======================= - void vCanvasPane::VScrollProcCB(int position) - { - if (position > 0) // scroll list down one page - VScroll(1); - else - VScroll(-1); // scroll list up one page - } - -//=====================>>> vCanvasPane::ExposeEV <<<========================== - void vCanvasPane::ExposeEV(int x, int y, int width, int height, int count) - { - // We need to be a little intelligent about handling expose - // events. Most users don't care about getting all the little - // rectangles that are generated by dragging a window. Most users - // just redraw everything on each Redraw, which can be very ugly - // if you get a bunch of little rectangles in a row. Our solution - // is a flag that will compress redraws, and will be true by default. - // Only the last event caueses a Redraw, and it will be for the whole - // canvas. - - - if (_compressRedraw) - { - if (count != 0) // ignore all but last expose event - return; - Redraw(0, 0, _width, _height); - } - else - { - Redraw(x, y , width, height); - } - } - -//=====================>>> vCanvasPane::EnterFocus <<<======================== - void vCanvasPane::EnterFocus() - { - SysDebug(WindowEvents,"vCanvasPane::EnterFocus()\n") - if (_currentCursor != VC_None) - SetCursor(_currentCursor); - } - -//=====================>>> vCanvasPane::EnterEV <<<========================== - void vCanvasPane::EnterEV() - { - if (_hasFocus) // don't double enter focus - return; - _hasFocus = 1; - -#ifndef Athena - XmProcessTraversal(_drawWindow,XmTRAVERSE_CURRENT); // Xm bug, call twice! - XmProcessTraversal(_drawWindow,XmTRAVERSE_CURRENT); -#endif - - theApp->XCheckSelection(); - EnterFocus(); // call the virtual function - } - -//=====================>>> vCanvasPane::LeaveFocus <<<======================= - void vCanvasPane::LeaveFocus() - { - SysDebug(WindowEvents,"vCanvasPane::LeaveFocus()\n") - } - -//=====================>>> vCanvasPane::LeaveEV <<<========================== - void vCanvasPane::LeaveEV() - { - if (!_hasFocus) // don't double leave focus - return; - _hasFocus = 0; - - LeaveFocus(); // call the virtual function - } - -//=====================>>> vCanvasPane::MouseDownEV <<<======================= - void vCanvasPane::MouseDownEV(int x, int y, int button) - { - // We track mouse down internally - X should do it, but - // sometimes it seems to get the mouse down withoud sending - // the event, making MouseMove not work as advertised. - if (_mouseDown) - return; - _mouseDown = 1; - MouseDown(x,y,button); - } - -//=====================>>> vCanvasPane::MouseUpEV <<<========================= - void vCanvasPane::MouseUpEV(int x, int y, int button) - { - if (!_mouseDown) - return; - _mouseDown = 0; - MouseUp(x,y,button); - } - -//=====================>>> vCanvasPane::MouseMoveEV <<<======================= - void vCanvasPane::MouseMoveEV(int x, int y, int button) - { - if (_mouseDown && button != 0) // only if down - MouseMove(x,y,button); - else - { - MouseMotion(x,y); - } - } - -//=====================>>> vCanvasPane::MouseDown <<<========================== - void vCanvasPane::MouseDown(int x, int y, int button) - { - // Mouse events in vCanvasPane are no-ops. - - SysDebug3(MouseEvents,"vCanvasPane::MouseDown(x:%d,y:%d,btn:%d)\n",x,y,button) - } - -//=====================>>> vCanvasPane::MouseUp <<<============================ - void vCanvasPane::MouseUp(int x, int y, int button) - { - // Mouse events in vCanvasPane are no-ops. - - SysDebug3(MouseEvents,"vCanvasPane::MouseUp(x:%d,y:%d,btn:%d)\n",x,y,button) - } - -//=====================>>> vCanvasPane::MouseMove <<<========================== - void vCanvasPane::MouseMove(int x, int y, int button) - { - // Mouse events in vCanvasPane are no-ops. - - SysDebug3(MouseEvents,"vCanvasPane::MouseMove(x:%d,y:%d,btn:%d)\n",x,y,button) - } - -//======================>>> vCanvasPane::FontChanged <<<=========================== - void vCanvasPane::FontChanged(VCONST vFont& vf) - { - // Called when the font is changed. - - SysDebug(WindowEvents,"vCanvasPane::FontChanged()\n") - } - -//=======================>>> vCanvasPane::Redraw <<<========================== - void vCanvasPane::Redraw(int x, int y, int width, int height) - { - // Redraw in vCanvasPane is a no-op. - -#ifdef vDEBUG // Don't have a SysDebug4 macro, so do it by hand - if (DebugState.WindowEvents && DebugState.System) - fprintf(stderr,"vCanvasPane::Redraw(x=%d, y=%d, w=%d, h=%d)\n",x,y,width,height); -#endif - - } - -//=====================>>> vCanvasPane::Resize <<<============================ - void vCanvasPane::Resize(int newW, int newH) - { - // This is the routine the user will override to intercept size changes - - SysDebug2(WindowEvents,"vCanvasPane::Resize(newW:%d, newH:%d)\n",newW,newH) - - } - -//=====================>>> vCanvasPane::CnvKeyInEv <<<============================ - void vCanvasPane::CnvKeyInEv(unsigned int keycode, unsigned int state) - { - _parentWin->KeyInEV(keycode, state); - } - -extern "C" -{ -#ifndef Athena - -//==============================>>> CinputCB <<<============================== - void CinputCB(Widget w, XtPointer client_data, XtPointer call_data) - { - // input callback - // - // call_data will point to a structure that has data - - XmDrawingAreaCallbackStruct *cbs = // get callback struct - (XmDrawingAreaCallbackStruct *)call_data; - - XEvent* xep = cbs->event; // the event struct - - XtPointer xtp = client_data; // v1.22: this - - switch (xep->xany.type) // react depending on type - { - case KeyPress: - { - XKeyPressedEvent *kp = (XKeyPressedEvent*)xep; - ((vCanvasPane*)xtp)->CnvKeyInEv(kp->keycode, kp->state); - break; - } - - case KeyRelease: - { - // ignore key releases - break; - } - - case ButtonPress: - { - VGlobalButtonPressedEvent = xep; // needed for right popup - XButtonEvent* bpxp = (XButtonEvent*)xep; - ((vCanvasPane*)xtp)->MouseDownEV(bpxp->x, bpxp->y, bpxp->button); - break; - } - - case ButtonRelease: - { - XButtonEvent* brxp = (XButtonEvent*)xep; - ((vCanvasPane*)xtp)->MouseUpEV(brxp->x, brxp->y, brxp->button); - break; - } - - case MotionNotify: - { - XMotionEvent* xp = (XMotionEvent*)xep; - int button = 0; // assume button 1 - - if (xp->state & Button1Mask) - button = 1; - else if (xp->state & Button2Mask) - button = 2; - else if (xp->state & Button3Mask) - button = 3; - - ((vCanvasPane*)xtp)->MouseMoveEV(xp->x, xp->y, button); - break; - } - - default: - break; - - - } - } - -//==============================>>> CexposeCB <<<============================== - void CexposeCB(Widget w, XtPointer client_data, XtPointer call_data) - { - // expose callback - // - // client_data will have the this pointer of our object - // call_data will point to a structure that handles - // resize, scrollbars, and exposure - - XmDrawingAreaCallbackStruct *cbs = // get callback struct - (XmDrawingAreaCallbackStruct *)call_data; - - XExposeEvent* xp = (XExposeEvent*) cbs->event; // the event struct - - // v1.22 - client_data has this - ((vCanvasPane*)client_data)->ExposeEV(xp->x, xp->y, xp->width, xp->height, xp->count); - - } - -//==============================>>> CresizeCB <<<============================== - void CresizeCB(Widget w, XtPointer client_data, XtPointer call_data) - { - // change callback - // - // client_data will have the this pointer of our object - // call_data will point to a structure that handles - // resize, scrollbars, and exposure - - ((vCanvasPane*)client_data)->ChangeCB(); - } - - -#else // ###### Athena - -//==============================>>> CchangeCB <<<============================== - void CchangeCB(Widget w, XtPointer client_data, XtPointer call_data) - { - // change callback - // - // client_data will have the this pointer of our object - // call_data will point to a structure that handles - // resize, scrollbars, and exposure - - ((vCanvasPane*)client_data)->ChangeCB(); - } - -//==============================>>> CExposeEV <<<============================== - void CExposeEV(Widget w, XtPointer client_data, XEvent* event, char *x) - { - -#ifdef Athena - - // Exposure event - // - // client_data will have the this pointer of our object - - XExposeEvent* xp; - - xp = (XExposeEvent*)event; - - ((vCanvasPane*)client_data)->ExposeEV(xp->x, xp->y, xp->width, xp->height, xp->count); -#endif - } - -//=============================>>> CMouseDownEV <<<============================ - void CMouseDownEV(Widget w, XtPointer client_data, XEvent* event, char *x) - { - // Mouse down event -#ifdef Athena - XButtonEvent* xp; - - xp = (XButtonEvent*)event; - - ((vCanvasPane*)client_data)->MouseDownEV(xp->x, xp->y, xp->button); -#endif - } - -//==============================>>> CMouseUpEV <<<=========================== - void CMouseUpEV(Widget w, XtPointer client_data, XEvent* event, char *x) - { -#ifdef Athena - // Mouse up event - XButtonEvent* xp; - - xp = (XButtonEvent*)event; - - ((vCanvasPane*)client_data)->MouseUpEV(xp->x, xp->y, xp->button); -#endif - } - -//============================>>> CMouseMoveEV <<<========================== - void CMouseMoveEV(Widget w, XtPointer client_data, XEvent* event, char *x) - { -#ifdef Athena - // Mouse down event - XMotionEvent* xp; - - xp = (XMotionEvent*)event; - - int button = 0; // assume button 1 - - if (xp->state & Button1Mask) - button = 1; - else if (xp->state & Button2Mask) - button = 2; - else if (xp->state & Button3Mask) - button = 3; - - ((vCanvasPane*)client_data)->MouseMoveEV(xp->x, xp->y, button); -#endif - } -#endif // ### Motif or Athena - -// common to both Motif and Athena - -//==============================>>> CEnterEV <<<============================= - void CEnterEV(Widget w, XtPointer client_data, XEvent* event, char *x) - { - // Enter event - // - // client_data will have the this pointer of our object - - ((vCanvasPane*)client_data)->EnterEV(); - } - -//==============================>>> CLeaveEV <<<============================== - void CLeaveEV(Widget w, XtPointer client_data, XEvent* event, char *x) - { - // Leave event - // - // client_data will have the this pointer of our object - - ((vCanvasPane*)client_data)->LeaveEV(); - } - -//============================>>> CHJumpProcCB <<<============================= - void CHJumpProcCB(Widget w, XtPointer This, XtPointer pc_ptr) - { - float percent = *(float*)pc_ptr; // get the percent back - - ((vCanvasPane*)This)->HJumpProcCB(percent,0); - } - -//============================>>> CHScollProcCB <<<============================= - void CHScrollProcCB(Widget w, XtPointer This, XtPointer position) - { -#ifndef Athena - XmScrollBarCallbackStruct* cbp = (XmScrollBarCallbackStruct*)position; - switch (cbp->reason) - { - case XmCR_DECREMENT: - case XmCR_PAGE_DECREMENT: - { - ((vCanvasPane*)This)->HScrollProcCB(-1); - break; - } - case XmCR_INCREMENT: - case XmCR_PAGE_INCREMENT: - { - ((vCanvasPane*)This)->HScrollProcCB(1); - break; - } - case XmCR_VALUE_CHANGED: - { - ((vCanvasPane*)This)->HJumpProcCB(0.0, cbp->value); - break; - } - } -#else - int pos = (int)position; - ((vCanvasPane*)This)->HScrollProcCB(pos); -#endif - } - -//============================>>> CJumpProcCB <<<============================= - void CVJumpProcCB(Widget w, XtPointer This, XtPointer pc_ptr) - { - float percent = *(float*)pc_ptr; // get the percent back - - ((vCanvasPane*)This)->VJumpProcCB(percent,0); - } - -//============================>>> CVScollProcCB <<<============================= - void CVScrollProcCB(Widget w, XtPointer This, XtPointer position) - { -#ifndef Athena - XmScrollBarCallbackStruct* cbp = (XmScrollBarCallbackStruct*)position; - switch (cbp->reason) - { - case XmCR_DECREMENT: - case XmCR_PAGE_DECREMENT: - { - ((vCanvasPane*)This)->VScrollProcCB(-1); - break; - } - case XmCR_INCREMENT: - case XmCR_PAGE_INCREMENT: - { - ((vCanvasPane*)This)->VScrollProcCB(1); - break; - } - case XmCR_VALUE_CHANGED: - { - ((vCanvasPane*)This)->VJumpProcCB(0.0, cbp->value); - break; - } - } -#else - int pos = (int)position; - ((vCanvasPane*)This)->VScrollProcCB(pos); -#endif - } - -} diff --git a/v/srcx/vcbtncmd.cxx b/v/srcx/vcbtncmd.cxx deleted file mode 100644 index 716b4c5..0000000 --- a/v/srcx/vcbtncmd.cxx +++ /dev/null @@ -1,90 +0,0 @@ -//=============================================================== -// vcbtncmd.xxx - Color button Cmd -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // Motif/Athena mapping -#include // our definitions - -extern "C" -{ -#include -#ifndef Athena -#include -#endif -} - -#ifndef Athena -#define Nbackground XmNbackground -#else -#define Nbackground XtNbackground -#endif - -//=================>>> vColorButtonCmd::vColorButtonCmd <<<======================= - vColorButtonCmd::vColorButtonCmd(vCmdParent* dp, CommandObject* dc) : - vButtonCmd(dp, dc) - { - initColor(); - } - -//====================>>> vColorButtonCmd::~vColorButtonCmd <<<======================= - vColorButtonCmd::~vColorButtonCmd() - { - - SysDebug(Destructor,"vColorButtonCmd::~vColorButtonCmd() destructor\n") - } - -//=====================>>> vColorButtonCmd::initColor <<<======================= - void vColorButtonCmd::initColor(void) - { - // wCmd is the widget of this button - - SysDebug(Constructor,"vColorButtonCmd::vColorButtonCmd() constructor\n") - - _origColor = 0; - if (_itemList != 0) // an RGB provided - { - _origColor = (vColor*)_itemList; // point to the rgb - _color = *_origColor; - } - - XtVaSetValues(wCmd, Nbackground, _color.pixel(), NULL); // change the background pixel - } - -//================>>> vColorButtonCmd::SetCmdVal <<<============================ - void vColorButtonCmd::SetCmdVal(ItemVal val, ItemSetType st) - { - - SysDebug1(Misc,"vColorButtonCmd::SetCmdVal(val:%d)\n",val) - - switch (st) - { - case ChangeColor: // changed original vColor - _color = *_origColor; // recopy color - XtVaSetValues(wCmd, Nbackground, _color.pixel(), NULL); // change the background pixel - break; - - case Red: - _color.SetR(val); - break; - - case Green: - _color.SetG(val); - break; - - case Blue: - _color.SetB(val); - XtVaSetValues(wCmd, Nbackground, _color.pixel(), NULL); // change the background pixel - break; - - default: - vButtonCmd::SetCmdVal(val, st); - break; - } - } diff --git a/v/srcx/vchkboxc.cxx b/v/srcx/vchkboxc.cxx deleted file mode 100644 index b6f46d5..0000000 --- a/v/srcx/vchkboxc.cxx +++ /dev/null @@ -1,482 +0,0 @@ -//=============================================================== -// vchkboxc.cxx - Checkbox -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // Motif/Athena mapping -#include // our definitions -#include // a command parent -#include -#include -#include - -extern "C" -{ -#include - -#ifndef Athena -#include -#include -#define setLabel(x,y) XmString x = XmStringCreateSimple(y); -#define freeLabel(x) XmStringFree(x); - -#else - -#include -#include -#include -#endif -} - -#ifdef Athena // Athena -#define boxx_width 12 -#define boxx_height 12 -static char boxx_bits[] = { - 0xff, 0x0f, 0x03, 0x0c, 0x05, 0x0a, 0x09, 0x09, 0x91, 0x08, 0x61, 0x08, - 0x61, 0x08, 0x91, 0x08, 0x09, 0x09, 0x05, 0x0a, 0x03, 0x0c, 0xff, 0x0f}; -static Pixmap boxx_bitmap = 0; - -#define boxnox_width 12 -#define boxnox_height 12 -static char boxnox_bits[] = { - 0xff, 0x0f, 0x01, 0x08, 0x01, 0x08, 0x01, 0x08, 0x01, 0x08, 0x01, 0x08, - 0x01, 0x08, 0x01, 0x08, 0x01, 0x08, 0x01, 0x08, 0x01, 0x08, 0xff, 0x0f}; -static Pixmap boxnox_bitmap = 0; - -static int buttonh; // to track height of button - -#define cboxnox_width 12 -#define cboxnox_height 12 -static unsigned char cboxnox_bits[] = - { - 3, // 4 (3+1) colors - 0,0,0, // 0 -> black - 255,255,255, // 1 -> white - 128,128,128, // 2 -> dark - 192,192,192, // 3 -> light - 2,2,2,2,2,2,2,2,2,2,2,2, - 2,2,2,2,2,2,2,2,2,2,2,3, - 2,2,1,1,1,1,1,1,1,1,3,3, - 2,2,1,1,1,1,1,1,1,1,3,3, - 2,2,1,1,1,1,1,1,1,1,3,3, - 2,2,1,1,1,1,1,1,1,1,3,3, - 2,2,1,1,1,1,1,1,1,1,3,3, - 2,2,1,1,1,1,1,1,1,1,3,3, - 2,2,1,1,1,1,1,1,1,1,3,3, - 2,2,1,1,1,1,1,1,1,1,3,3, - 2,2,3,3,3,3,3,3,3,3,3,3, - 3,3,3,3,3,3,3,3,3,3,3,3 - }; - - static vIcon noxIcon(&cboxnox_bits[0], cboxnox_height, cboxnox_width, 8); - -#define cboxx_width 12 -#define cboxx_height 12 -static unsigned char cboxx_bits[] = - { - 3, // 4 (3+1) colors - 0,0,0, // 0 -> black - 255,255,255, // 1 -> white - 128,128,128, // 2 -> dark - 192,192,192, // 3 -> light - 2,2,2,2,2,2,2,2,2,2,2,2, - 2,2,2,2,2,2,2,2,2,2,2,3, - 2,2,1,1,1,1,1,1,1,1,3,3, - 2,2,1,1,1,1,1,0,0,1,3,3, - 2,2,1,1,1,1,1,0,0,1,3,3, - 2,2,1,0,0,1,0,0,1,1,3,3, - 2,2,1,0,0,1,0,0,1,1,3,3, - 2,2,1,1,0,0,0,1,1,1,3,3, - 2,2,1,1,1,0,0,1,1,1,3,3, - 2,2,1,1,1,1,1,1,1,1,3,3, - 2,2,3,3,3,3,3,3,3,3,3,3, - 3,3,3,3,3,3,3,3,3,3,3,3 - }; - - static vIcon xIcon(&cboxx_bits[0], cboxx_height, cboxx_width, 8); - - static Pixmap _Xpm; // Pixmap for X box - static Pixmap _noXpm; // clear checkbox - -#endif - -//=================>>> vCheckBoxCmd::~vCheckBoxCmd <<<======================= - vCheckBoxCmd::~vCheckBoxCmd() - { - SysDebug(Destructor,"vCheckBoxCmd::~vCheckBoxCmd() destructor\n") - } - -//=================>>> vCheckBoxCmd::vCheckBoxCmd <<<======================= - vCheckBoxCmd::vCheckBoxCmd(vCmdParent* dp, CommandObject* dc) : - vCmd(dp, dc) - { - // Create bitmaps if need to - - - SysDebug(Constructor,"vCheckBoxCmd::vCheckBoxCmd() constructor\n") - -#ifdef Athena - // Fixup the colors in the icons - static int colors_set = 0; - - if (!colors_set) - { - colors_set = 1; - - XColor xc; - xc.pixel = _vDarkControlShadow; // the light shadow - XQueryColor(theApp->display(),theApp->Xcolormap(),&xc); - cboxnox_bits[7] = cboxx_bits[7] = (unsigned char) (xc.red >> 8); - cboxnox_bits[8] = cboxx_bits[8] = (unsigned char) (xc.green >> 8); - cboxnox_bits[9] = cboxx_bits[9] = (unsigned char) (xc.blue >> 8); - - xc.pixel = _vLightControlShadow; // the light shadow - XQueryColor(theApp->display(),theApp->Xcolormap(),&xc); - cboxnox_bits[10] = cboxx_bits[10] = (unsigned char) (xc.red >> 8); - cboxnox_bits[11] = cboxx_bits[11] = (unsigned char) (xc.green >> 8); - cboxnox_bits[12] = cboxx_bits[12] = (unsigned char) (xc.blue >> 8); - } - - if (boxx_bitmap == 0) - { - boxx_bitmap = XCreateBitmapFromData( - theApp->display(), // our display - DefaultRootWindow(theApp->display()), // a Drawable - boxx_bits, // the boxx bitmap data - boxx_width, // from the file - boxx_height); - } - if (boxnox_bitmap == 0) - { - boxnox_bitmap = XCreateBitmapFromData( - theApp->display(), // our display - DefaultRootWindow(theApp->display()), // a Drawable - boxnox_bits, // the menux bitmap data - boxnox_width, // from the file - boxnox_height); - } - _Xpm = (theApp->Xdepth() > 1) ? xIcon.GetXPM() : boxx_bitmap; - _noXpm = (theApp->Xdepth() > 1) ? noxIcon.GetXPM() : boxnox_bitmap; - -#endif - initialize(); // and initialize - } - -//=====================>>> vCheckBoxCmd::initialize <<<======================= - void vCheckBoxCmd::initialize(void) - { - // build a button command for use in a parent window - - CopyToLocal(); // make local copies - - Widget WfHoriz = _parentWin->getWidgetFromId(dlgCmd->cRightOf); - Widget WfVert = _parentWin->getWidgetFromId(dlgCmd->cBelow); - - int map = !(dlgCmd->attrs & CA_Hidden); - -#ifndef Athena - setLabel(tmp,_title) - - wCmd = XtVaCreateManagedWidget( - "vCheckBox", // name - xmToggleButtonWidgetClass, // class - wParent, // parent - XmNindicatorType,XmN_OF_MANY, - XmNset,_retVal, // start state - XmNlabelString,tmp, - NULL); - if (WfVert != 0) - { - XtVaSetValues(wCmd, Nbelow(WfVert) NULL); - } - - if (WfHoriz != 0) - { - XtVaSetValues(wCmd, NrightOf(WfHoriz) NULL); - } - - freeLabel(tmp) - - XtAddCallback(wCmd, XmNvalueChangedCallback, CCheckBoxCmdCB, (XtPointer)this); - // Need to set to insensitive if it is set insensitive - if (!_Sensitive) - { - XtVaSetValues(wCmd, // the widget to set - XmNsensitive, 0, // change to insensitive - NULL); - } - wBox = _wLabel = 0; - -#else // Athena ------------------------- - - wBox = XtVaCreateManagedWidget( - "vCheckBox", // name - boxWidgetClass, // class - wParent, // parent - XtNorientation, XtEhorizontal, - XtNborderWidth,0, // no border - XtNhSpace,2, - XtNvSpace,0, - XtNmappedWhenManaged, map, - XtNresizable, TRUE, - NULL); - - if (WfVert != 0) - XtVaSetValues(wBox, Nbelow(WfVert) NULL); - if (WfHoriz != 0) - XtVaSetValues(wBox, NrightOf(WfHoriz) NULL); - - // calculate height to make the box come out next to the label - // if possible. We will also try to make these the same height - // as a button or label - - int fh; - - fh = theApp->_XDefaultFont->ascent + theApp->_XDefaultFont->descent; - - buttonh = (boxx_height > fh+6) ? boxx_height : fh+6; - - if (_retVal) // depends on state - { - wCmd = XtVaCreateManagedWidget( - "vCheckBoxCheck", // name - commandWidgetClass, // class - wBox, // parent - XtNbitmap,_Xpm, - XtNheight,buttonh, // calculate the height - XtNinternalHeight, 0, - XtNinternalWidth, 0, - XtNborderWidth,0, - XtNhighlightThickness,0, // no highlight - XtNresizable, TRUE, - NULL); - } - else - { - wCmd = XtVaCreateManagedWidget( - "vCheckBoxCheck", // name - commandWidgetClass, // class - wBox, // parent - XtNbitmap,_noXpm, - XtNheight,buttonh, // calculate the height - XtNinternalHeight, 0, - XtNinternalWidth, 0, - XtNborderWidth,0, - XtNhighlightThickness,0, // no highlight - XtNresizable, TRUE, - NULL); - } - - _wLabel = XtVaCreateManagedWidget( - "vCheckBoxLabel", // name - commandWidgetClass, // class - wBox, // parent - XtNlabel, _title, - XtNinternalHeight, 3, // same height as button/label - XtNinternalWidth, 0, - XtNborderWidth,0, // label only, no border - XtNhighlightThickness,0, // No highlight - XtNresizable, TRUE, - NULL); - - XtAddCallback(wCmd, XtNcallback, CCheckBoxCmdCB, (XtPointer)this); - XtAddCallback(_wLabel, XtNcallback, CCheckBoxCmdCB, (XtPointer)this); - - XtVaSetValues(wBox, // the widget to set - XtNbackground, _vDialogBG, NULL); - XtVaSetValues(wCmd, // the widget to set - XtNbackground, _vDialogBG, NULL); - XtVaSetValues(_wLabel, // the widget to set - XtNbackground, _vDialogBG, NULL); - - // Need to set to insensitive if it is set insensitive - if (!_Sensitive) - { - XtVaSetValues(wCmd, // the widget to set - XtNsensitive, 0, // change to insensitive - NULL); - XtVaSetValues(_wLabel, // the widget to set - XtNsensitive, 0, // change insensitive - NULL); - } -#endif - } - -//================>>> vCheckBoxCmd::ResetItemValue <<<====================== - void vCheckBoxCmd::ResetItemValue(void) - { - - // We have to toggle things - - if (_retVal == _origVal) // No op if no change - return; - - _retVal = _origVal; // restore - -#ifndef Athena - XmToggleButtonSetState(wCmd,_retVal,0); -#else - if (_retVal) // depends on state - { - XtVaSetValues(wCmd, // set for this widget - XtNbitmap,_Xpm, // on bitmap - XtNheight,buttonh, // calculate the height - NULL); - } - else - { - XtVaSetValues(wCmd, // set for this widget - XtNbitmap,_noXpm, // off bitmap - XtNheight,buttonh, // calculate the height - NULL); - } -#endif - - // let parent window handle now - _parentWin->ProcessCmd(_cmdId, _retVal, dlgCmd->cmdType); - } - -//==================>>> vCheckBoxCmd::GetCmdValue <<<========================= - int vCheckBoxCmd::GetCmdValue(ItemVal id) VCONST - { - if (id != _cmdId) - return -1; - return _retVal; - } - -//================>>> vCheckBoxCmd::SetCmdVal <<<============================ - void vCheckBoxCmd::SetCmdVal(ItemVal val, ItemSetType st) - { - - SysDebug1(Misc,"vCheckBoxCmd::SetCmdVal(val:%d)\n",val) - - if (st == Value || st == Checked) - { - _retVal = val; // set - -#ifndef Athena - XmToggleButtonSetState(wCmd,_retVal,0); -#else - if (_retVal) // depends on state - { - XtVaSetValues(wCmd, // set for this widget - XtNbitmap,_Xpm, - XtNheight,buttonh, // calculate the height - NULL); - } - else - { - XtVaSetValues(wCmd, // set for this widget - XtNbitmap,_noXpm, - XtNheight,buttonh, // calculate the height - NULL); - } -#endif - } - else if (st == Hidden) // hide or unhide - { - if (val) - { -#ifndef Athena - XtUnmapWidget(wCmd); // unmap this widget -#else - XtUnmapWidget(wBox); // unmap this widget -#endif - } - else - { -#ifndef Athena - XtMapWidget(wCmd); // unmap this widget -#else - XtMapWidget(wBox); // unmap this widget -#endif - } - } - else if (st == Sensitive) - { - _Sensitive = val; // set -#ifndef Athena - XtVaSetValues(wCmd, // the widget to set - XmNsensitive, val, // change sensitive - NULL); -#else - XtVaSetValues(wCmd, // the widget to set - XtNsensitive, val, // change sensitive - NULL); - XtVaSetValues(_wLabel, // the widget to set - XtNsensitive, val, // change sensitive - NULL); -#endif - } - else - { - SysDebug2(BadVals,"vCheckBoxCmd::SetCmdVal(val:%d,type:%d) - BAD TYPE\n",val,st) - } - - } - - -//================>>> vCheckBoxCmd::SetCmdStr <<<============================ - void vCheckBoxCmd::SetCmdStr(VCONST char* str) - { - - SysDebug1(Misc,"vCheckBoxCmd::SetCmdStr(str:%s)\n",str) - -#ifndef Athena - setLabel(tmp,str) - XtVaSetValues(wCmd, // the widget to set - XmNlabelString,tmp, - NULL); - freeLabel(tmp) -#else - XtVaSetValues(wCmd, // the widget to set - XtNlabel, str, // label - NULL); -#endif - - } -//====================>>> vCheckBoxCmd::CheckBoxCmdC <<<======================= - void vCheckBoxCmd::CheckBoxCmdCB(void) - { - - // We have to toggle bitmap for Athena - - if (_retVal) // depends on state - { - _retVal = 0; // toggle -#ifdef Athena - XtVaSetValues(wCmd, // set for this widget - XtNbitmap,_noXpm, - XtNheight,buttonh, // calculate the height - NULL); -#endif - } - else - { - _retVal = 1; // toggle -#ifdef Athena - XtVaSetValues(wCmd, // set for this widget - XtNbitmap,_Xpm, - XtNheight,buttonh, // calculate the height - NULL); -#endif - } - - // let parent window handle now - _parentWin->ProcessCmd(_cmdId, _retVal, dlgCmd->cmdType); - } - -extern "C" -{ -//============================>>> CCheckBoxCB <<<============================= - void CCheckBoxCmdCB(Widget w, XtPointer This, XtPointer call_data) - { - ((vCheckBoxCmd*)This)->CheckBoxCmdCB(); - } -} diff --git a/v/srcx/vclabelc.cxx b/v/srcx/vclabelc.cxx deleted file mode 100644 index 1a038c1..0000000 --- a/v/srcx/vclabelc.cxx +++ /dev/null @@ -1,88 +0,0 @@ -//=============================================================== -// vclabelc.xxx - Color label Cmd -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // Motif/Athena mapping -#include // our definitions - -extern "C" -{ -#include -#ifndef Athena -#include -#endif -} - -#ifndef Athena -#define Nforeground XmNforeground -#else -#define Nforeground XtNforeground -#endif - -//=================>>> vColorLabelCmd::vColorLabelCmd <<<======================= - vColorLabelCmd::vColorLabelCmd(vCmdParent* dp, CommandObject* dc) : - vLabelCmd(dp, dc) - { - initColor(); - } - -//====================>>> vColorLabelCmd::~vColorLabelCmd <<<======================= - vColorLabelCmd::~vColorLabelCmd() - { - - SysDebug(Destructor,"vColorLabelCmd::~vColorLabelCmd() destructor\n") - } - -//=====================>>> vColorLabelCmd::initColor <<<======================= - void vColorLabelCmd::initColor(void) - { - // wCmd is the widget of this button - - SysDebug(Constructor,"vColorLabelCmd::vColorLabelCmd() constructor\n") - - if (_itemList != 0) // an RGB provided - { - _origColor = (vColor*)_itemList; // point to the rgb - _color = *_origColor; // copy the color - } - XtVaSetValues(wCmd, Nforeground, _color.pixel(), NULL); // change the background pixel - } - -//================>>> vColorLabelCmd::SetCmdVal <<<============================ - void vColorLabelCmd::SetCmdVal(ItemVal val, ItemSetType st) - { - - SysDebug1(Misc,"vColorLabelCmd::SetCmdVal(val:%d)\n",val) - - switch (st) - { - case ChangeColor: - _color = *_origColor; // recopy color - XtVaSetValues(wCmd, Nforeground, _color.pixel(), NULL); // change the background pixel - break; - - case Red: - _color.SetR(val); - break; - - case Green: - _color.SetG(val); - break; - - case Blue: - _color.SetB(val); - XtVaSetValues(wCmd, Nforeground, _color.pixel(), NULL); - break; - - default: - vLabelCmd::SetCmdVal(val, st); - break; - } - } diff --git a/v/srcx/vcmd.cxx b/v/srcx/vcmd.cxx deleted file mode 100644 index 0cd3c6f..0000000 --- a/v/srcx/vcmd.cxx +++ /dev/null @@ -1,43 +0,0 @@ -//=============================================================== -// vcmd.cxx - vCmd class -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include -#include - -//===================>>> vCmd::vCmd <<<======================= - vCmd::vCmd(vCmdParent* dp, CommandObject* co) - { - // We had to make this a non-inline to get access - // to the vcmdprnt definitons. - - _parentWin = dp; // dialog class parent - dlgCmd = co; // static data structure - wParent = dp->getParent(co->cFrame); // our parent widget - _origVal = co->retVal; // save orignal state - - wBox = // many Cmds use a surrounding box - wCmd = 0; // main widget for this Cmd - - _intervalId = 0; - } - -//===================>>> vCmd::CopyToLocal <<<======================= - void vCmd::CopyToLocal(void) - { - // Copy static values to local copy - _title = dlgCmd->title; - if (!_title || *_title == 0) - _title = ""; - _cmdId = dlgCmd->cmdId; - _retVal = dlgCmd->retVal; - _Sensitive = dlgCmd->Sensitive; - _itemList = dlgCmd->itemList; - } diff --git a/v/srcx/vcmdpane.cxx b/v/srcx/vcmdpane.cxx deleted file mode 100644 index 7ee1455..0000000 --- a/v/srcx/vcmdpane.cxx +++ /dev/null @@ -1,234 +0,0 @@ -//=============================================================== -// vCommandPane - the button bar pane class used by the vWindow class -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include -#include - -extern "C" -{ -#ifndef Athena -#include -#include -#else // *** ATHENA - -#include -#include -#endif -} - -#include // we are part of a window -#include - -#ifdef Athena -#define gray_width 2 -#define gray_height 2 -static char gray_bits[] = { - 0x01, 0x02}; -static Pixmap gray_bitmap = 0; -#endif - -//===================>>> vCommandPane::vCommandPane <<<==================== - vCommandPane::vCommandPane(CommandObject* cList) : - vPane(P_Commands), vCmdParent() - { - SysDebug(Constructor,"vCommandPane::vCommandPane() constructor\n") - - _origList = cList; // handle to list of commands - } - -//===================>>> vCommandPane::~vCommandPane <<<==================== - vCommandPane::~vCommandPane() - { - SysDebug(Destructor,"vCommandPane::~vCommandPane() destructor\n") - } - -//==================>>> vCommandPane::ProcessCmd <<<======================= - void vCommandPane::ProcessCmd(ItemVal id, ItemVal rv, CmdType ct) - { - // simple interface between command objects and the - // inherited vCmdParent ProcessCmd to the CommandObject which does the work - - _parentWin->WindowCommand(id, rv, ct); - } - -//====================>>> vCommandPane::GetPaneValue <<<====================== - int vCommandPane::GetPaneValue(ItemVal id, int& val) VCONST - { - if (HasId(id)) // make sure the id is in the pane - { - val = GetValue(id); - return 1; // assume 0 if not found - } - else - return 0; // can't find this id - } - -//====================>>> vCommandPane::GetPaneTextIn <<<====================== - int vCommandPane::GetPaneTextIn(ItemVal id, char* str, int maxlen) VCONST - { - if (HasId(id)) // make sure the id is in the pane - { - return GetTextIn(id,str,maxlen); - } - else - return 0; // can't find this id - } - -//===================>>> vCommandPane::SetPaneValue <<<======================== - void vCommandPane::SetPaneValue(ItemVal id, int val, ItemSetType setType) - { - SetValue(id,val,setType); - } - -//====================>>> vCommandPane::SetPaneString <<<====================== - void vCommandPane::SetPaneString(ItemVal id, VCONST char* str) - { - SetString(id,str); - } - -//====================>>> vCommandPane::ShowPane <<<====================== - void vCommandPane::ShowPane(int OnOrOff) VCONST - { - if (OnOrOff) - { - XtManageChild(_wDialog); - } - else - { - XtUnmanageChild(_wDialog); - } - } - -//====================>>> vCommandPane::initialize <<<======================= - void vCommandPane::initialize(vWindow* pWin, Widget pWidget, - Widget drawCanvas, Widget drawArea) - { - // now, build the menu items in the widget provided - - DlgCmdList* curCmd; - -#ifdef Athena - if (gray_bitmap == 0) // haven't built the pixmap yet - { - gray_bitmap = XCreatePixmapFromBitmapData( - theApp->display(), // our display - DefaultRootWindow(theApp->display()), // a Drawable - gray_bits, // the gray bitmap data - gray_width, // from the file - gray_height, - (unsigned long) theApp->Xfg(), // Forground color - (unsigned long) theApp->Xbg(), // Background color - DefaultDepth(theApp->display(),DefaultScreen(theApp->display()))); - - } -#endif - - vPane::initialize(pWin, pWidget); // initialize base class - - // Now the Command bar that will have Commands - -#ifndef Athena - - Widget wrap = pWin->getcmdArea(); // have we defined enclosing area? - - if (wrap == 0) // don't have a pane yet - { - wrap = XtVaCreateManagedWidget( - "vCommandPaneWrap", - xmPanedWindowWidgetClass, // widget class - _baseW, // parent widget - XmNmarginHeight,2, - XmNmarginWidth,2, - XmNsashHeight,10, - XmNsashWidth,0, - XmNsashShadowThickness,0, - XmNseparatorOn,1, - XmNallowResize,1, - NULL); // argument list - pWin->setcmdArea(wrap); - } - - /* NOTE: POSSIBLE LessTif difference... - * At one point, LessTif had a bug that made the resizing - * not work correctly, and my workaround was to only have - * one of XmNresizeHeight or XmNresizeWidth true. e.g., - * XmNresizeHeight,1, - * XmNresizeWidth,0, - * - * Real Motif barfed on that, and wanted both to be 1. - * This is fixed, at least as of LessTif 0.88 - * - */ - - _wDialog = XtVaCreateManagedWidget( - "vCommandPane", - xmRowColumnWidgetClass, // widget class - wrap, // parent widget - // PanedWindow constrants - XmNallowResize,1, - - // RowColumn values - XmNspacing,2, - - XmNisAligned,1, - XmNentryVerticalAlignment,XmALIGNMENT_CENTER, - XmNentryAlignment,XmALIGNMENT_CENTER, - XmNrowColumnType,XmWORK_AREA, - XmNadjustLast,0, - - XmNpacking,XmPACK_TIGHT, - - XmNisHomogeneous,0, - - XmNresizeHeight,1, // LessTif bug??? couldn't have - XmNresizeWidth,1, // both 1 at some point - need to test - - XmNmarginHeight,1, - XmNmarginWidth,1, - XmNnumColumns,1, - XmNadjustMargin,0, - XmNadjustLast,0, - XmNorientation,XmHORIZONTAL, - NULL); // argument list - -#else - _wDialog = XtVaCreateManagedWidget( - "vCommandPane", - boxWidgetClass, // widget class - _baseW, // parent widget - XtNshowGrip,FALSE, - XtNallowResize,1, - XtNresizeToPreferred,1, - XtNskipAdjust,TRUE, - XtNvSpace,2, - NULL); // argument list - - // set the background pattern - if (theApp->Xdepth() <= 1) - XtVaSetValues(_wDialog, // the widget to set - XtNbackgroundPixmap, gray_bitmap, NULL); - else - XtVaSetValues(_wDialog, // the widget to set - XtNbackground, _vDialogBG, NULL); -#endif - - for (int ix = 0 ; _origList && (_origList[ix].cmdType != C_EndOfList) ; - ++ix) - { - curCmd = new DlgCmdList; // get a new cell - - curCmd->nextDCL = _cmdList; // add in at front - _cmdList = curCmd; - - curCmd->cmdP = AddCmd(&_origList[ix]); - - } - } diff --git a/v/srcx/vcmdprnt.cxx b/v/srcx/vcmdprnt.cxx deleted file mode 100644 index ebdcf22..0000000 --- a/v/srcx/vcmdprnt.cxx +++ /dev/null @@ -1,455 +0,0 @@ -//=============================================================== -// vcmdprnt.cxx - vCmdParent Class -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // our include - -#include // ButtonCmd -#include // ColorButtonCmd -#include // Color label -#include // LabelCmd -#include // FrameCmd -#include // CheckBoxCmd -#include // RadioButtonCmd -#include // TextInCmd -// V:1.14 #include // TextEdCmd -#include // TextCmd -#include // ListCmd -#include // ComboBoxCmd -#include // SpinnerCmd -#include // SliderCmd -#include // ProgressCmd -#include // for tip window - - -// Define the event handlers -static void Leave_event(Widget w, XtPointer client_data, XEvent * xevent, Boolean * continue_to_dispatch ); -static void Enter_event(Widget w, XtPointer client_data, XEvent * xevent, Boolean * continue_to_dispatch ); - static void Timer_event(XtPointer client_data, XtIntervalId *id); - -//======================>>> vCmdParent::vCmdParent <<<============================ - vCmdParent::vCmdParent() - { - _cmdList = 0; - } - -//======================>>> vCmdParent::~vCmdParent <<<============================ - vCmdParent::~vCmdParent() - { - SysDebug(Destructor,"vCmdParent::~vCmdParent() destructor\n") - - // need to delete everything we added - - DlgCmdList* tmp; - - for (DlgCmdList* cc = _cmdList ; cc != 0 ; ) - { - delete cc->cmdP; // delete the cmd object - tmp = cc; // don't forget where we were - cc = cc->nextDCL; // for next time - delete tmp; // delete the list cell - } - } - -//======================>>> vCmdParent::AddCmd <<<============================ - vCmd* vCmdParent::AddCmd(CommandObject* cmd) - { - // Private method to add a single command to a dialog object. - - SysDebug2(Build,"vCmdParent::AddCmd() - %s(id:%d)\n",cmd->title,cmd->cmdId) - - vCmd* cmdPtr; - - switch (cmd->cmdType) // depends on type - { - case C_IconButton: // a command button Icon - case C_ToggleIconButton: // a toggle command button Icon - case C_ToggleButton: // a toggle command button - case C_Button: // Button - { - cmdPtr = new vButtonCmd(this, cmd); - break; - } - - case C_ColorButton: // ColorButton - { - cmdPtr = new vColorButtonCmd(this, cmd); - break; - } - - case C_ColorLabel: // ColorButton - { - cmdPtr = new vColorLabelCmd(this, cmd); - break; - } - - case C_CheckBox: // Checked Item - { - cmdPtr = new vCheckBoxCmd(this, cmd); - break; - } - - case C_ComboBox: // Popup combo list - { - cmdPtr = new vComboBoxCmd(this, cmd); - break; - } - - case C_Frame: // General purpose frame - case C_ToggleFrame: // Toggle frame - { - cmdPtr = new vFrameCmd(this, cmd); - break; - } - - case C_Icon: // a display only Icon - case C_Blank: // to help RightOfs, Belows work - case C_BoxedLabel: // Boxed text label - case C_Label: // Regular text label - { - cmdPtr = new vLabelCmd(this, cmd); - break; - } - - case C_List: // List of items (scrollable) - { - cmdPtr = new vListCmd(this, cmd); - break; - } - - case C_ProgressBar: // Progress bar - { - cmdPtr = new vProgressCmd(this, cmd); - break; - } - - case C_RadioButton: // radio button - { - cmdPtr = new vRadioButtonCmd(this, cmd); - break; - } - - case C_Slider: // slider - { - cmdPtr = new vSliderCmd(this, cmd); - break; - } - - case C_Text: // Text output field - { - cmdPtr = new vTextCmd(this, cmd); - break; - } - - case C_TextIn: // Text input field - { - cmdPtr = new vTextInCmd(this, cmd); - break; - } - - case C_Spinner: // Value Box list - { - cmdPtr = new vSpinnerCmd(this, cmd); - break; - } - - default: // unknown! - { - SysDebug2(BadVals,"vCmdParent::AddCmd(id:%d, title:%s) ** Unknown DialogCommand\n",cmd->cmdId,cmd->title); - cmd->title = "?? Bad CommandObject ??"; - cmdPtr = new vLabelCmd(this, cmd); - break; - } - } - - // Add popup tip here. - - if (cmd->tip && *cmd->tip) // a tip has been supplied - { - Widget tw = cmdPtr->GetWidget(); // main box for tip - if (tw != 0) // a widget has been defined! - { - XtAddEventHandler(tw, EnterWindowMask, False, - Enter_event, (XtPointer) cmdPtr); - XtAddEventHandler(tw, LeaveWindowMask|ButtonPressMask, - False, Leave_event, (XtPointer) cmdPtr); - } - } - - return cmdPtr; - } - -//====================>>> vCmdParent::HasId <<<========================= - int vCmdParent::HasId(ItemVal id) VCONST - { - // We need this one for panes to work correctly - - for (DlgCmdList* cc = _cmdList ; cc != 0 ; cc = cc->nextDCL) - { - if (((cc->cmdP)->dlgCmd)->cmdId == id) - { - return 1; - } - } - return 0; - } - -//====================>>> vCmdParent::GetValue <<<========================= - int vCmdParent::GetValue(ItemVal id) VCONST - { - for (DlgCmdList* cc = _cmdList ; cc != 0 ; cc = cc->nextDCL) - { - if (((cc->cmdP)->dlgCmd)->cmdId == id) - { - return (cc->cmdP)->GetCmdValue(id); // return the value - } - } - return 0; - } - -//====================>>> vCmdParent::GetTextIn <<<========================= - int vCmdParent::GetTextIn(ItemVal id, char* strout, int maxlen) - { - // recover the string from TextIn id, up to maxlen - for (DlgCmdList* cc = _cmdList ; cc != 0 ; cc = cc->nextDCL) - { - if (((cc->cmdP)->dlgCmd)->cmdId == id) - { - // need to cast to a vTextInCmd so we can use getstr - vTextInCmd* tip = (vTextInCmd*) cc->cmdP; - - return tip->GetTextIn(id, strout, maxlen); // return the value - } - } - - *strout = 0; - return 0; - } - -//====================>>> vCmdParent::SetFrameChildren <<<====================== - void vCmdParent::SetFrameChildren(ItemVal frameId, int frameVal) - { - // Set all children of given frame to hidden or not hidden - // Do this recursively to be sure to get them all. - - // Scan list, setting all children that use this frame - - for (DlgCmdList* cc = _cmdList ; cc != 0 ; cc = cc->nextDCL) // Find the frame - { - CommandObject* cop = (cc->cmdP)->dlgCmd; - if (cop->cFrame == frameId) // A child of ours - { - // Hide control if not turning on (frameVal is opposite of Hidden) - SetValue(cop->cmdId, !frameVal, Hidden); - if (cop->cmdType == C_Frame || cop->cmdType == C_ToggleFrame) - SetFrameChildren(cop->cmdId, frameVal); // Get other chilren - } - } - } - -//====================>>> vCmdParent::getParent <<<======================= - Widget vCmdParent::getParent(ItemVal id) VCONST - { - // If the object id has a frame specified, find it and return - // its widget. Otherwist, the parent is the dialog. - - Widget tmp; - - if (id == NoFrame) - { - return _wDialog; - } - else - { - tmp = getFrameWidgetFromId(id); - if (tmp == 0) - { - vSysWarning("Cannot find Frame parent."); - return _wDialog; - } - else - return tmp; - } - } - -//==================>>> vCmdParent::getWidgetFromId <<<======================= - Widget vCmdParent::getWidgetFromId(ItemVal find_id) VCONST - { - // search the list of cmds for id, return its object - - DlgCmdList* cc; - - if (find_id == 0) // no op - { - return 0; - } - - // search the list - for (cc = _cmdList->nextDCL ; cc != 0 ; cc = cc->nextDCL) - { - if (((cc->cmdP)->dlgCmd)->cmdId == find_id) - { - if ( (cc->cmdP)->wBox == 0) // use the surround box if there - return (cc->cmdP)->wCmd; - else - return (cc->cmdP)->wBox; - } - } - - return 0; // failed to find it - } - -//==================>>> vCmdParent::getFrameWidgetFromId <<<======================= - Widget vCmdParent::getFrameWidgetFromId(ItemVal find_id) VCONST - { - // search the list of cmds for id, return its object - - DlgCmdList* cc; - - if (find_id == 0) // no op - return 0; - - // search the list - for (cc = _cmdList->nextDCL ; cc != 0 ; cc = cc->nextDCL) - { - if (((cc->cmdP)->dlgCmd)->cmdId == find_id) - { -#ifndef Athena - // This bit of code comes from the need to use the xmForm when - // placing children, but to use the xmFrame when placing the - // frame itself -- all because xmForm doesn't have a frame. - if (((cc->cmdP)->dlgCmd)->cmdType == C_Frame || - ((cc->cmdP)->dlgCmd)->cmdType == C_ToggleFrame) // need wCmd! - { - if ( (cc->cmdP)->wCmd != 0) // this should not happen, but... - return (cc->cmdP)->wCmd; - } -#endif - if ( (cc->cmdP)->wBox == 0) // use the surround box if there - return (cc->cmdP)->wCmd; - else - return (cc->cmdP)->wBox; - } - } - - return 0; - } - -//====================>>> vCmdParent::SetValue <<<======================= - void vCmdParent::SetValue(ItemVal id, ItemVal val, ItemSetType setType) - { - - SysDebug2(Misc,"vCmdParent::SetValue(id:%d, val:%d)\n",id,val) - - for (DlgCmdList* cc = _cmdList ; cc != 0 ; cc = cc->nextDCL) - { - if (((cc->cmdP)->dlgCmd)->cmdId == id) - { - (cc->cmdP)->SetCmdVal(val,setType); // return the value - return; - } - } - } - -//====================>>> vCmdParent::SetString <<<======================= - void vCmdParent::SetString(ItemVal id, VCONST char* str) - { - - SysDebug2(Misc,"vCmdParent::SetString(id:%d, str:%s)\n",id,str) - - for (DlgCmdList* cc = _cmdList ; cc != 0 ; cc = cc->nextDCL) - { - if (((cc->cmdP)->dlgCmd)->cmdId == id) - { - SysDebug1(Misc,"vCmdParent::SetCmdStr( str:%s)\n",str) - (cc->cmdP)->SetCmdStr(str); // return the value - return; - } - } - - } - -//################################ TIP CODE ############################### - - static vTipWindow tipWin; // just need one tip window - static long tipTime = 600; // 600 ms time for tips - -//====================>>> Timer_event <<<======================= - static void Timer_event( XtPointer client_data, XtIntervalId *id) - { - vCmd* cmd = (vCmd*) client_data; - - Position abs_x, abs_y; - Position w_height; - - if (cmd->GetIntId() == 0) - return; // timeout was removed but callback happened anyway - - cmd->SetIntId(0); // force to 0 - - // now figure out where to put the popup - - Widget tw = cmd->GetWidget(); // main box for tip - if (tw == 0) - return; // nowhere to go - - XtVaGetValues(tw, XtNheight, &w_height, NULL ); - - /* position just below the widget */ - - XtTranslateCoords(tw, 0, w_height, &abs_x, &abs_y); - tipWin.ShowTipWindow(abs_x + 12, abs_y, cmd->GetDlgCmd()->tip); -} - -//====================>>> Enter_event <<<======================= - static void Enter_event(Widget w, XtPointer client_data, XEvent * xevent, - Boolean * continue_to_dispatch ) - { - vCmd* cmd = (vCmd *) client_data; - XEnterWindowEvent* event = & xevent->xcrossing; - - // Check for two enters in a row. Can happen when widget is - // exposed under a pop-up - - if (tipTime <= 0) - return; - if (cmd->GetIntId() != 0) - return; - if(event->mode != NotifyNormal) - return; - if (!cmd->GetDlgCmd()->tip) - return; - - tipWin.CloseTipWindow(); // pop down previous! - - // Add a timer so the help pops up after a delay - XtIntervalId id = XtAppAddTimeOut( - XtWidgetToApplicationContext(w), - tipTime, Timer_event, client_data); - cmd->SetIntId(id); // remember id - } - -/* -Remove timer, if its pending. Then popdown help. -*/ -//====================>>> Leave_event <<<======================= - static void Leave_event(Widget w, XtPointer client_data, XEvent * xevent, Boolean * continue_to_dispatch ) - { - vCmd* cmd = (vCmd *) client_data; - XEnterWindowEvent* event = & xevent->xcrossing; - - if (cmd->GetIntId() != 0) - { - XtRemoveTimeOut(cmd->GetIntId()); - cmd->SetIntId(0); // force to 0 - } - tipWin.CloseTipWindow(); // pop down previous! - - } diff --git a/v/srcx/vcmdwin.cxx b/v/srcx/vcmdwin.cxx deleted file mode 100644 index 9507faa..0000000 --- a/v/srcx/vcmdwin.cxx +++ /dev/null @@ -1,95 +0,0 @@ -//=============================================================== -// vCmdWin.cxx - vCmdWindow class functions - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // our header -#include // we have panes - -#include - -// Define static data of the class - - int vCmdWindow::_numCmdWindows = 0; - vCmdWindow* vCmdWindow::CmdWins = 0; // no command windows to start - -//====================>>> vCmdWindow::vCmdWindow <<<======================= - vCmdWindow::vCmdWindow(VCONST char *name, int width, int height ) : - vWindow(name, width, height, CMDWINDOW) - { - // make widgets null - - SysDebug(Constructor,"vCmdWindow::vCmdWindow() constructor\n") - - destroyed = 0; // we haven't been destroyed - - NextCmdWin = CmdWins; // link in to list of cmdwindows - CmdWins = this; // put on front of the list - ++_numCmdWindows; // bump how many windows up - } - -//====================>>> vCmdWindow::~vCmdWindow <<<======================= - vCmdWindow::~vCmdWindow() // destructor - { - - SysDebug(Destructor,"vCmdWindow::~vCmdWindow() destructor\n") - - } - -//============================>>> vCmdWindow::CloseWin <<<=================== - void vCmdWindow::CloseWin(void) - { -#ifndef Athena - // Motif requires wierd closing stuff... - if (CmdWins == this && CmdWins->NextCmdWin == 0) - { - _CloseWinFinal(); // Skip the wait last time - } - else if (!theApp->MotifSetTask(this, M_Close)) - _CloseWinFinal(); // just try normal way -#else - - _CloseWinFinal(); // Athena is normal -#endif - } - -//============================>>> vCmdWindow::_CloseWinFinal <<<=================== - void vCmdWindow::_CloseWinFinal(void) - { - // close button class callback - - vCmdWindow* cw_list; - - SysDebug(Build,"vCmdWindow::CloseWin()\n"); - - --_numCmdWindows; // windows down by one - // Remove from active list - if (CmdWins == this) // first one on list - { - CmdWins = CmdWins->NextCmdWin; // point to next - } - else - { - for (cw_list = CmdWins ; cw_list != 0 ; cw_list = cw_list->NextCmdWin) - { - if (cw_list->NextCmdWin == this) - { - // remove from list - cw_list->NextCmdWin = (cw_list->NextCmdWin)->NextCmdWin; - break; - } - } - } - - vWindow::_CloseWinFinal(); // Close Stuff in parent - if (CmdWins == 0) // last one? - { - theApp->CloseLastCmdWindow(this,0); - } - } diff --git a/v/srcx/vcolor.cxx b/v/srcx/vcolor.cxx deleted file mode 100644 index 573c3d8..0000000 --- a/v/srcx/vcolor.cxx +++ /dev/null @@ -1,271 +0,0 @@ -//=============================================================== -// vcolor.cxx: vColor class for drawing - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include -#include - - // Define 16 standard colors for use by everyone - - vColor vStdColors[16] = - { - vColor( 0, 0, 0), // vC_Black - vColor( 255, 0, 0), // vC_Red - vColor( 127, 0, 0), // vC_DimRed - vColor( 0, 255, 0), // vC_Green - vColor( 0, 127, 0), // vC_DimGreen - vColor( 0, 0, 255), // vC_Blue - vColor( 0, 0, 127), // vC_DimBlue - vColor( 255, 255, 0), // vC_Yellow - vColor( 127, 127, 0), // vC_DimYellow - vColor( 255, 0, 255), // vC_Magenta - vColor( 127, 0, 127), // vC_DimMagenta - vColor( 0, 255, 255), // vC_Cyan - vColor( 0, 127, 127), // vC_DimCyan - vColor( 127, 127, 127), // vC_DarkGray - vColor( 192, 192, 192), // vC_MedGray - vColor( 255, 255, 255) // vC_White - }; - - char* vColorNames[16] = - { - "Black", "Red", "Dim Red", "Green", "Dim Green", "Blue", - "Dim Blue", "Yellow", "Dim Yellow", "Magenta", "Dim Magenta", - "Cyan", "Dim Cyan", "Dark Gray", "Med Gray", "White" - }; - - static Pixel _firstPix = 0; - -//=======================>>> vColor::vColor <<<=========================== - vColor::vColor(unsigned int rd, unsigned int gr, unsigned int bl) - { - _r = (unsigned char) rd; - _g = (unsigned char) gr; - _b = (unsigned char) bl; - _pixel = 0; _mapped = 0; - } - -//=======================>>> vColor::vColor <<<=========================== - vColor::~vColor() - { - } - -//=======================>>> vColor::vColor <<<=========================== - vColor::vColor(const vColor& color) - { - // Copy constructor - _r = color._r; - _g = color._g; - _b = color._b; - if (color._mapped) - _pixel = color._pixel; - else - MapColor(); - _mapped = 1; - - } - -//=======================>>> vColor::= <<<=========================== - vColor& vColor::operator =(const vColor& color) - { - if (this == &color) // to self - return *this; - - _r = color._r; - _g = color._g; - _b = color._b; - if (color._mapped) - _pixel = color._pixel; - else - MapColor(); - _mapped = 1; - return *this; - } - -//=======================>>> vColor::BitsOfColor <<<=========================== - int vColor::BitsOfColor() VCONST - { - return theApp->Xdepth(); // How many bits of color supported - } - -//=======================>>> vColor::ResetColor <<<=========================== - void vColor::ResetColor(unsigned int rd, unsigned int gr, unsigned int bl) - { - // This method will try to free cells for more use! - // Note: any other color objects that reference this same color - // (because of =, copy, or coincidence) will have their color - // changed, too. - - if (_r == rd && _g == gr && _b == bl) - return; - - _r = (unsigned char) rd; - _g = (unsigned char) gr; - _b = (unsigned char) bl; - - if (_mapped && _pixel >= _firstPix) // Already mapped, so free - { - Pixel pix[1]; - pix[0] = _pixel; - XFreeColors(theApp->display(), theApp->Xcolormap(), - pix, 1, 0); - } - MapColor(); - } - -//=======================>>> vColor::ResetColor <<<=========================== - void vColor::ResetColor(VCONST vColor& c) - { - // This method will try to free cells for more use! - // Note: any other color objects that reference this same color - // (because of =, copy, or coincidence) will have their color - // changed, too. - - if (_r == c.r() && _g == c.g() && _b == c.b()) - return; - - _r = c.r(); - _g = c.g(); - _b = c.b(); - - if (_mapped && _pixel >= _firstPix) // Already mapped, so free - { - Pixel pix[1]; - pix[0] = _pixel; - XFreeColors(theApp->display(), theApp->Xcolormap(), - pix, 1, 0); - } - MapColor(); - } - -//=======================>>> vColor::Set <<<=========================== - void vColor::Set(unsigned int rd, unsigned int gr, unsigned int bl) - { - if (_r == rd && _g == gr && _b == bl) - return; - _r = (unsigned char) rd; - _g = (unsigned char) gr; - _b = (unsigned char) bl; - MapColor(); - } - -//=======================>>> vColor::Set <<<=========================== - void vColor::Set(VCONST vColor& c) - { - if (_r == c.r() && _g == c.g() && _b == c.b()) - return; - _r = c.r(); - _g = c.g(); - _b = c.b(); - MapColor(); - } - -//=======================>>> vColor::SetR <<<=========================== - void vColor::SetR(unsigned int rd) - { - if (_r == rd) - return; - _r = (unsigned char) rd; - MapColor(); - } - -//=======================>>> vColor::SetG <<<=========================== - void vColor::SetG(unsigned int gr) - { - if (_g == gr) - return; - _g = (unsigned char) gr; - MapColor(); - } - -//=======================>>> vColor::SetB <<<=========================== - void vColor::SetB(unsigned int bl) - { - if (_b == bl) - return; - _b = (unsigned char) bl; - MapColor(); - } - -//=======================>>> vColor::MapColor <<<=========================== - void vColor::MapColor() VCONST - { - // This will normally be used only internally. There is some - // chance a user overriding a drawing canvas will need to - // know about this method. The purpose of MapColor (and IsMapped) - // is to map the V RGB value to whatever internal value the host - // system requires. In the case of X, this is an X Pixel, which - // is really a long index into the X display's colormap. Rather - // than mapping the RGB to a Pixel every time, this will happen - // only when the color is use to change a brush or font or something. - // Then the Pixel value can be used directly for X. This mapping - // should only have to be done whenever a change happens, and - // the methods that allow changes are the ones to use MapColor. - // It is harmeless (other than inefficient) to MapColor when it - // is not needed. IsMapped returns true if the color has already - // been mapped. This need for mapping is really why vColor is - // real class rather than a simple struct. The act of setting - // a new color also causes the color to be mapped. - - // Now, map the RGB to a Pixmap index - - _pixel = vXAllocColor(_r,_g,_b); - _mapped = 1; - } - -//=======================>>> vXAllocColor <<<=========================== - Pixel vXAllocColor(unsigned int r, unsigned int g, unsigned int b) - { - // Global function to alloacate a R/W color cell if possible. - // Use by vColor and by vIcon. - - XColor xc; - int gotPix = 0; // No Pixel mapped yet - - // Convert from 0-255 scale of V to 0-65535 scale of X - xc.red = r * 256; - xc.green = g * 256; - xc.blue = b * 256; - xc.flags = DoRed | DoBlue | DoGreen; - xc.pixel = 0; - - if (theApp->Xdepth() > 1) // A color display - { - gotPix = XAllocColor(theApp->display(), theApp->Xcolormap(), &xc); - } - - if (gotPix) // Got one, return it! - { - if (_firstPix == 0 && !(r == 0 && g == 0 && b == 0) && - !(r == 255 && g == 255 && b == 255) ) - { - // Need to track first pixel so don't free - // colors allocated by V controls, etc. - _firstPix = xc.pixel; - } - return xc.pixel; // recover pixel value - } - else // Couldn't get an R/W Pixel - { - // Can't get a color pixel, so as a backup position (or for b/w) - // convert to gray scale (based on NTSC grayscale (using - // a scale of 0 to 1.0: (ingore some rounding) - // gray = .3*red + .59*green + .11*blue - - unsigned int gray = ((xc.red/10)*3) + ((xc.green/100)*59) - + ((xc.blue/100)*11); - - // I arbitrarily chose the cutoff value... - if (gray <= 29000) // use either black or white - return XBlackPixel(theApp->display(),0); - else - return XWhitePixel(theApp->display(),0); - } - } diff --git a/v/srcx/vcomboc.cxx b/v/srcx/vcomboc.cxx deleted file mode 100644 index fb65e9a..0000000 --- a/v/srcx/vcomboc.cxx +++ /dev/null @@ -1,583 +0,0 @@ -//=============================================================== -// vcomboc.cxx - vComboBoxCmd -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // Motif/Athena mapping -#include // our definitions -#include // a command parent -#include -#include -#ifdef USE3D -#include -#endif - -extern "C" -{ -#include - -#ifndef Athena - -#include -#include -#include -#include -#include -#include - -#else - -#include -#include -#include -#include -#include - -#endif - -#include -} - -#ifndef Athena - -#define lblWidgetClass xmLabelWidgetClass -#define cmdWidgetClass xmPushButtonWidgetClass -#define Ncallback XmNactivateCallback -#define Nheight XmNheight -#define Nlabel XmNlabelString -#define NmappedWhenManaged XmNmappedWhenManaged -#define Nwidth XmNwidth -//@@ These use athena parent for now -#define Nresizable(x) // XtNresizable,x, -#define Nsensitive XmNsensitive - -#define setLabel(x,y) XmString x = XmStringCreateLocalized(y); -#define freeLabel(x) XmStringFree(x); - -#else //------------------------------------------------------ - -#define lblWidgetClass labelWidgetClass -#ifdef USE3D -#define cmdWidgetClass command3dWidgetClass -#else -#define cmdWidgetClass commandWidgetClass -#endif -#define Ncallback XtNcallback -#define Nheight XtNheight -#define Nlabel XtNlabel -#define NmappedWhenManaged XtNmappedWhenManaged -#define Nwidth XtNwidth -#define Nresizable(x) XtNresizable,x, -#define Nsensitive XtNsensitive -#define setLabel(x,y) char* x = y; -#define freeLabel(x) - -#endif // ----------------------------------------------------- - - -#ifdef Athena - -#ifdef USE3D -#define down_width 8 -#define down_height 11 -static char down_bits[] = { - 0x00, 0x7e, 0x7e, 0x3c, 0x3c, 0x18, 0x18, 0x00, 0x7e, 0x7e, 0x00}; -#else -#define down_width 11 -#define down_height 17 -static char down_bits[] = { - 0xff, 0x07, 0x01, 0x04, 0x71, 0x04, 0x71, 0x04, 0xfd, 0x05, 0xfd, 0x05, - 0xf9, 0x04, 0xf9, 0x04, 0x71, 0x04, 0x71, 0x04, 0x21, 0x04, 0x21, 0x04, - 0x01, 0x04, 0xfd, 0x05, 0xfd, 0x05, 0x01, 0x04, 0xff, 0x07}; -#endif - -static Pixmap down_bitmap = 0; -#endif - -//=================>>> vComboBoxCmd::vComboBoxCmd <<<======================= - vComboBoxCmd::vComboBoxCmd(vCmdParent* dp, CommandObject* dc) : - vCmd(dp, dc) - { - // Create bitmaps if need to -#ifdef Athena - if (down_bitmap == 0) - { - down_bitmap = XCreateBitmapFromData( - theApp->display(), // our display - DefaultRootWindow(theApp->display()), // a Drawable - down_bits, // the bitmap data - down_width, // from the file - down_height); - } -#endif - - for (int ix = 0 ; ix < MAX_COMBO_LIST ; ++ix) - _workList[ix] = 0; - - initialize(); // and initialize - } - -//=======================>>> vComboBoxCmd::~vComboBoxCmd <<<======================= - vComboBoxCmd::~vComboBoxCmd() - { - - SysDebug(Constructor,"vComboBoxCmd::~vComboBoxCmd() Constructor\n") - - } - -//=====================>>> vComboBoxCmd::initialize <<<======================= - void vComboBoxCmd::initialize(void) - { - - - SysDebug(Constructor,"vComboBoxCmd::vComboBoxCmd() constructor\n") - - CopyToLocal(); - - // First, setup the list - - SetupComboList(); - - // build a button command for use in a parent window - - Widget WfHoriz = _parentWin->getWidgetFromId(dlgCmd->cRightOf); - Widget WfVert = _parentWin->getWidgetFromId(dlgCmd->cBelow); - - // We will put a box around the list and the scrollbar - - int map = !(dlgCmd->attrs & CA_Hidden); - -#ifndef Athena - wBox = XtVaCreateManagedWidget( - "ComboBox", // name - xmFormWidgetClass, // class - wParent, // parent - XmNshadowThickness,2, - XmNshadowType,XmSHADOW_IN, - XmNhorizontalSpacing,0, - XmNverticalSpacing,0, - XmNmarginWidth,0, - XmNmarginHeight,0, - XmNmappedWhenManaged, map, - XmNrubberPositioning,1, - NULL); -#else - wBox = XtVaCreateManagedWidget( - "ComboBox", // name - boxWidgetClass, // class - wParent, // parent - XtNorientation, XtEhorizontal, - XtNborderWidth,1, // border around list and scrollbar - XtNhSpace,1, - XtNvSpace,1, - XtNdefaultDistance, 0, - XtNmappedWhenManaged, map, - XtNresizable, TRUE, - XtNbackground,_vControlFace, - NULL); -#endif - if (WfVert != 0) - XtVaSetValues(wBox, Nbelow(WfVert) NULL); - if (WfHoriz != 0) - XtVaSetValues(wBox, NrightOf(WfHoriz) NULL); - - // figure out the label - - wCmd = XtVaCreateManagedWidget( // The select button - "vComboBoxButton", // name - lblWidgetClass, // class - wBox, // parent - Nwidth, _maxWidth+8, // widest string -#ifndef Athena - Nlabel, (XmString)_workList[_curSelection], // label - XmNtopAttachment,XmATTACH_FORM, - XmNtopOffset,2, - XmNbottomAttachment,XmATTACH_FORM, - XmNbottomOffset,2, - XmNleftAttachment,XmATTACH_FORM, - XmNleftOffset,2, - XmNrecomputeSize,0, -#else - Nlabel, _workList[_curSelection], // label - XtNjustify, XtJustifyLeft, - Nresizable(TRUE) -#endif - NULL); - -#ifndef Athena - _downButton = XtVaCreateManagedWidget( // the down button - "vComboBoxDown", // name - xmArrowButtonWidgetClass, // class - wBox, // parent - XmNtopAttachment,XmATTACH_FORM, - XmNtopOffset,2, - XmNbottomAttachment,XmATTACH_FORM, - XmNbottomOffset,2, - XmNrightAttachment,XmATTACH_FORM, - XmNrightOffset,2, - NrightOf(wCmd) - XmNarrowDirection,XmARROW_DOWN, - NULL); -#else - _downButton = XtVaCreateManagedWidget( // the down button - "vComboBoxDown", // name - cmdWidgetClass, // class - wBox, // parent - XtNbitmap,down_bitmap, - XtNbackground,_vControlFace, -#ifdef USE3D - XtNinternalWidth, 2, -#else - XtNinternalHeight, 0, - XtNinternalWidth, 0, - XtNborderWidth,0, -#endif - NULL); -#endif - - _popup = XtVaCreatePopupShell( // This is a popup for the list - "vComboPopup", - overrideShellWidgetClass, - wParent, // parent - XtNoverrideRedirect,1, - XtNallowShellResize,1, - NULL); - - PoppedUp = 0; - -#ifndef Athena - int maxShow = (_numItems > 8) ? 8 : _numItems; - - _popupList = XtVaCreateManagedWidget( - "vComboBoxList", // name - xmListWidgetClass, // class - _popup, - XmNitemCount, _numItems, // this many - XmNitems, (XmString)_workList, // the work list - XmNwidth, _maxWidth + 8, // widest string - XmNlistSizePolicy, XmCONSTANT, - XmNvisibleItemCount, maxShow, - NULL); - XtAddCallback(_popupList, XmNsingleSelectionCallback, CComboBoxCmdCB, (XtPointer)this); - XtAddCallback(_popupList, XmNbrowseSelectionCallback, CComboBoxCmdCB, (XtPointer)this); -#else - _popupList = XtVaCreateManagedWidget( - "vComboBoxList", // name - listWidgetClass, // class - _popup, - XtNdefaultColumns, 1, // 1 column - XtNforceColumns, True, // force columns - XtNlist, _workList, // the work list - XtNlongest, _maxWidth, // widest string - XtNnumberStrings, _numItems, // always MAX_LIST strings - XtNverticalList, TRUE, // we are a vertical list - XtNrowSpacing, 1, - XtNresizable, TRUE, - NULL); -#endif - - // add callback for actions - XtAddCallback(_downButton, Ncallback, CComboDownCB, (XtPointer)this); -#ifdef Athena - XtAddCallback(_popupList, XtNcallback, CComboBoxCmdCB, (XtPointer)this); -#endif - - if (!_Sensitive) - { - XtVaSetValues(wCmd, // the widget to set - Nsensitive, 0, // change to insensitive - NULL); - XtVaSetValues(_downButton, // the widget to set - Nsensitive, 0, // change to val - NULL); - } - } - -//==================>>> vComboBoxCmd::GetCmdValue <<<========================= - int vComboBoxCmd::GetCmdValue(ItemVal id) VCONST - { - if (id != _cmdId) - return -1; - return _curSelection; - } - -//=====================>>> vComboBoxCmd::SetCmdVal <<<========================= - void vComboBoxCmd::SetCmdVal(ItemVal val, ItemSetType st) - { - - SysDebug2(Misc,"vComboBoxCmd::SetCmdVal(val:%d, type:%d)\n",val,st) - - - if (st == ChangeList || st == ChangeListPtr) - { - if (st == ChangeListPtr) - _itemList = dlgCmd->itemList; - int oldMax = _maxWidth; // track current max width - - SetupComboList(); // resetup the list - if (oldMax > _maxWidth) - _maxWidth = oldMax; // don't let it get narrower - - // turn them all off! -#ifndef Athena - XmListReplaceItemsPosUnselected(_popupList, (XmString*)_workList, _numItems, 1); -#else - XawListChange(_popupList, _workList, _numItems, _maxWidth, True); -#endif - if (val < 0) // unselect - val = 0; - else if (val >= _numItems ) - val = _numItems - 1; - - _retVal = - _curSelection = val; // change the current value - - XtVaSetValues(wCmd, // the widget to set -#ifndef Athena - Nlabel, (XmString)_workList[_curSelection], // label -#else - Nlabel, _workList[_curSelection], // label -#endif - Nwidth, _maxWidth+8, // widest string - NULL); - return; - } - else if (st == Hidden) // hide or unhide - { - if (val) - { - XtUnmapWidget(wBox); // unmap this widget - } - else - { - XtMapWidget(wBox); // unmap this widget - } - } - else if (st == Checked) // fake out to pop down - { - if (PoppedUp) - { - XtPopdown(_popup); // another way to get it down - PoppedUp = 0; - } - } - else if (st == Value) - { - if (val < 0) // unselect - val = 0; - else if (val >= _numItems ) - val = _numItems - 1; - - // Now set appropriate _curSelection - - _retVal = - _curSelection = val; // change the current value - XtVaSetValues(wCmd, // the widget to set -#ifndef Athena - Nlabel, (XmString)_workList[_curSelection], // label -#else - Nlabel, _workList[_curSelection], // label -#endif - Nwidth, _maxWidth+8, // widest string - NULL); - } - else if (st == Sensitive) - { - _Sensitive = val; // set - XtVaSetValues(wCmd, // the widget to set - Nsensitive, val, // change to val - NULL); - XtVaSetValues(_downButton, // the widget to set - Nsensitive, val, // change to val - NULL); - } - } - -#ifdef USECMDBUTTON -//====================>>> vComboBoxCmd::ComboAcceptCB <<<======================= - void vComboBoxCmd::ComboAcceptCB(void) - { - - if (PoppedUp) - { - XtPopdown(_popup); // another way to get it down - PoppedUp = 0; - } - else // ok - the user has selected it - { - _parentWin->ProcessCmd(_cmdId, - (ItemVal)_curSelection, dlgCmd->cmdType); - } - } - -extern "C" -{ -//============================>>> CComboAcceptCB <<<============================= - void CComboAcceptCB(Widget w, XtPointer This, XtPointer lr) - { - // call the C++ version - ((vComboBoxCmd*)This)->ComboAcceptCB(); - } -} -#endif - - -//====================>>> vComboBoxCmd::ComboDownCB <<<======================= - void vComboBoxCmd::ComboDownCB(void) - { - Position x, y; - Dimension height; - - if (!PoppedUp) - { - // We have to calculate a bit to find where to but the combobox - XtTranslateCoords(wBox, // Get where the ComboBox wbox is - (Position) 0, (Position) 0, &x, &y); - - XtVaGetValues(wBox, // and the size - XtNheight,&height, - NULL); - - XtVaSetValues(_popup, // set loc of popup - XtNx, x, - XtNy, y+height, - NULL); - - // I can't quite get this to work just how I want. Ideally, - // nothing will happen until they pop down the combobox. - // Unfortunately, GrabExclusive seems to work ok for MODAL - // dialogs, but not for modeless or the command bar. - // GrabNone lets the combo hang down while they select - // other things in the dialog. This seems less messy - // than inconsistent operation, and they really want to - // press the arrow to unpop this thing. - -// XtPopup(_popup,XtGrabExclusive); // If we want modal popup - XtPopup(_popup,XtGrabNone); - theApp->XWaitUntilMapped(_popup); - PoppedUp = 1; - } - else - { - XtPopdown(_popup); // another way to get it down - PoppedUp = 0; - } - } - -extern "C" -{ -//============================>>> CComboDownCB <<<============================= - void CComboDownCB(Widget w, XtPointer This, XtPointer lr) - { - // call the C++ version - ((vComboBoxCmd*)This)->ComboDownCB(); - } -} - - -//====================>>> vComboBoxCmd::ComboBoxCmdCB <<<======================= - void vComboBoxCmd::ComboBoxCmdCB(int index) - { - _curSelection = index; // change the current selection - - XtPopdown(_popup); // take down the combo part - PoppedUp = 0; - XtVaSetValues(wCmd, -#ifndef Athena - Nlabel, (XmString)_workList[_curSelection], // change to current item -#else - Nlabel, _workList[_curSelection], // change to current item -#endif - Nwidth, _maxWidth+8, // widest string - NULL); - - // We will dynamically notify the program that the selection - // changed -- this may not be the best behavior, and - // we might change it. - - if (!(dlgCmd->attrs & CA_NoNotify)) - { - _parentWin->ProcessCmd(_cmdId, - (ItemVal)_curSelection, dlgCmd->cmdType); - } - } - -extern "C" -{ -//============================>>> CComboBoxCmdCB <<<============================= - void CComboBoxCmdCB(Widget w, XtPointer This, XtPointer lr) - { -#ifndef Athena - // need to adjust Motif's indexing from 1 to our indexing from 0 - XmListCallbackStruct* xml = (XmListCallbackStruct*) lr; - ((vComboBoxCmd*)This)->ComboBoxCmdCB(xml->item_position - 1); -#else - ((vComboBoxCmd*)This)-> - ComboBoxCmdCB(((XawListReturnStruct*)lr)->list_index); -#endif - } -} - - -//====================>>> vComboBoxCmd::SetupComboList <<<======================= - void vComboBoxCmd::SetupComboList(void) - { - // Set up the list for use - - int width, len; - - // First, count how many items are in the supplied list - - - _fullList = (char**)_itemList; // list - - _maxWidth = 0; // no items yet - - for ( _numItems = 0 ; _fullList[_numItems] != 0 ; ++_numItems) - { - if (_numItems < MAX_COMBO_LIST) // only allow MAX_LIST items - { -#ifndef Athena - if (_workList[_numItems] != 0) - freeLabel((XmString)_workList[_numItems]) - _workList[_numItems] = (char*)XmStringCreateLocalized(_fullList[_numItems]); -#else - _workList[_numItems] = _fullList[_numItems]; -#endif - } - else - { - SysDebug(BadVals,"Too many items for a combo box"); - } - - len = strlen(_fullList[_numItems]); // strlen - width = XTextWidth(theApp->_XDefaultFont, - _fullList[_numItems], len); - if (width > _maxWidth) - _maxWidth = width; // track largest so far - } - - _workList[_numItems] = NULL; // zap end of the list - - if (_numItems <= 0) - { - SysDebug(BadVals,"No Items supplied for ComboBox -- need 1!\n") - } - - _curSelection = _retVal; // the default - - if (_curSelection < 0) // make a safe default choice - _curSelection = 0; - else if (_curSelection >= _numItems) - _curSelection = _numItems - 1; - - // Note that at this point _numItems is how many items are - // in the user supplied list. - - } diff --git a/v/srcx/vcpdc.cxx b/v/srcx/vcpdc.cxx deleted file mode 100644 index ea3b5b4..0000000 --- a/v/srcx/vcpdc.cxx +++ /dev/null @@ -1,159 +0,0 @@ -//=============================================================== -// vCanvasPaneDC - a basic canvas for drawing -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include -#include -#include - -//================>>> vCanvasPaneDC::vCanvasPaneDC <<<======================== - vCanvasPaneDC::vCanvasPaneDC(vCanvasPane* parentPane) - { - - SysDebug(Constructor,"vCanvasPaneDC::vCanvasPaneDC() constructor\n") - - _parentPane = parentPane; - - _drawWidget = _parentPane->DrawingWindow(); // drawing to this widget - - _GCFont = - _font = theApp->GetDefaultFont(); // get the default font - - _GC = makeGC(_drawWidget); // make a normal GC to use - _XorGC = makeXorGC(_drawWidget); // make a GC to use - - _pen.SetPenToPixel(_canvasFG); - _brush.SetBrushToPixel(_canvasFG); - - SetPen(_pen); - SetBrush(_brush); - - _XDisplay = theApp->display(); - _physWidth = theApp->ScreenWidth(); - _physHeight = theApp->ScreenHeight(); - } - -//================>>> vCanvasPaneDC::~vCanvasPaneDC <<<======================== - vCanvasPaneDC::~vCanvasPaneDC() - { - XtReleaseGC(_drawWidget,_GC); // Release the GCs we allocated - XtReleaseGC(_drawWidget,_XorGC); - - SysDebug(Destructor,"vCanvasPaneDC::~vCanvasPaneDC() destructor\n") - } - -//=====================>>> vCanvasPaneDC::GetDrawable <<<====================== - Drawable vCanvasPaneDC::GetDrawable() - { - return _parentPane->GetXDrawable(); - } - -//=====================>>> vCanvasPaneDC::Clear <<<========================== - void vCanvasPaneDC::Clear(void) - { - Drawable dw = GetDrawable(); - if (dw != 0) - XClearArea(_XDisplay, dw, 0, 0, - _parentPane->GetWidth(), _parentPane->GetHeight(), 0); - } - -//=====================>>> vCanvasPaneDC::makeGC <<<========================= - GC vCanvasPaneDC::makeGC(Widget w) - { - // This one gets a default GC to used for the base canvas - - GC gc; // local copy - XGCValues values; // to setup values - - // set colors according to type of canvas - - _canvasFG = theApp->Xfg(); - _canvasBG = theApp->Xbg(); - - XtVaSetValues(w, // reset fg/bg - XtNforeground, _canvasFG, - XtNbackground, _canvasBG, - NULL); - - values.line_style = LineSolid; // only solid lines for now - values.line_width = 1; // width 1 - values.fill_style = FillSolid; - values.function = GXcopy; - values.foreground = _canvasFG; - values.background = _canvasBG; - - // This is a SHARED GC, so anything that changes must be - // reset on a per window basis before drawing anything. - - gc = XtAllocateGC(w, 0, - GCForeground | GCBackground | GCFunction | GCLineStyle | - GCLineWidth | GCFillStyle , - &values, - GCForeground | GCBackground | GCFunction | GCLineStyle | // changable - GCLineWidth | GCFillStyle | GCFont, - 0); - - // set the font - - // Be sure the font is loaded - _font.LoadFont(); - - XSetFont(theApp->display(), gc, _font.GetXFont()->fid); - - return gc; - } - -//=====================>>> vCanvasPaneDC::makeXorGC <<<========================== - GC vCanvasPaneDC::makeXorGC(Widget w) - { - // This one gets a default GC to used for the base canvas - - GC gc; // local copy - XGCValues values; // to setup values - - // set colors according to type of canvas - - values.line_width = 1; // width 1 - values.function = GXxor; - - if (_canvasFG == 0) - values.foreground = ~0; // force black - else - values.foreground = _canvasFG; - - gc = XtAllocateGC(w, 0, - GCForeground | GCFunction | GCLineWidth, - &values, - GCLineWidth, // Width changes - 0); - - return gc; - } - -//================>>> vCanvasPaneDC::SetBackground <<<========================== - void vCanvasPaneDC::SetBackground(VCONST vColor& color) - { - vXDC::SetBackground(color); - - XtVaSetValues(_drawWidget, // reset fg/bg - XtNbackground, _canvasBG, - NULL); - } - -//======================>>> vCanvasPaneDC::SetFont <<<=========================== - void vCanvasPaneDC::SetFont(VCONST vFont& vf) - { - // Change the font associated with this window. - - vXDC::SetFont(vf); - - _parentPane->FontChanged(_font); // We have changed the font, - // so we may need to do some things - } diff --git a/v/srcx/vdebug.cxx b/v/srcx/vdebug.cxx deleted file mode 100644 index 0f41e4f..0000000 --- a/v/srcx/vdebug.cxx +++ /dev/null @@ -1,208 +0,0 @@ -//=============================================================== -// vdebug.cxx - vDebugDialog class methods -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // our header - -// Define static data of the class - -#define dSystem 10 -#define dUser 11 - -#define dCmdEvents 12 -#define dMouseEvents 13 -#define dWindowEvents 14 - -#define dBuild 15 -#define dMisc 16 -#define dBadVals 17 - -#define dConstructor 18 -#define dDestructor 19 -#define dText 30 - -#define dUserApp1 20 -#define dUserApp2 21 -#define dUserApp3 22 - - static int SetCommandObject(const int id, const int val, CommandObject* CmdList); - - static CommandObject DebugDialog[] = - { - {C_Label, 1, 0, "Set Debug Options", - NoList, CA_MainMsg, isSens, 0,0}, - - {C_Blank, 8, 0, " ", NoList,CA_None,isSens,NoFrame,1,0}, - {C_Label, 9, 0, V_Version, NoList,CA_None,isSens,NoFrame,8,0}, - - // A frame around the check boxes - {C_Frame, 2, 0, "", NoList, CA_None, isSens,NoFrame, 0, 1}, - - // note: the id corresponds to the #defines above - {C_CheckBox,10,0,"System Msgs ",NoList,CA_None,isSens,2,0,0}, - {C_CheckBox,11,0,"User Messages ",NoList,CA_None,isSens,2,10,0}, - - {C_CheckBox,12,0,"Command Events",NoList,CA_None,isSens,2,0,10}, - {C_CheckBox,13,0,"Mouse Events ",NoList,CA_None,isSens,2,12,10}, - {C_CheckBox,14,0,"Window Events ",NoList,CA_None,isSens,2,13,10}, - - {C_CheckBox,15,0,"Build Windows ",NoList,CA_None,isSens,2,0,12}, - {C_CheckBox,16,0,"Misc Messages ",NoList,CA_None,isSens,2,15,12}, - {C_CheckBox,17,0,"Illegal Values",NoList,CA_None,isSens,2,16,12}, - - {C_CheckBox,18,0,"Constructors ",NoList,CA_None,isSens,2,0,15}, - {C_CheckBox,19,0,"Destructors ",NoList,CA_None,isSens,2,18,15}, - {C_CheckBox,30,0,"Text ",NoList,CA_None,isSens,2,19,15}, - - {C_CheckBox,20,0,"User Debug 1 ",NoList,CA_None,isSens,2,0,18}, - {C_CheckBox,21,0,"User Debug 2 ",NoList,CA_None,isSens,2,20,18}, - {C_CheckBox,22,0,"User Debug 3 ",NoList,CA_None,isSens,2,21,18}, - - {C_Button, M_All,M_All," All On ",NoList,CA_None,isSens,NoFrame,0,2}, - {C_Button, M_None,M_None," All Off ",NoList,CA_None,isSens,NoFrame,M_All,2}, - {C_Blank, 5, 0, " ", NoList,CA_None,isSens,NoFrame,M_None,2}, - {C_Button, M_Cancel, M_Cancel, " Cancel ", NoList, - CA_None,isSens,NoFrame, 5,2}, - {C_Button, M_OK, M_OK, " OK ", NoList, - CA_DefaultButton, isSens, NoFrame, M_Cancel, 2}, - {C_EndOfList,0,0,0,0,CA_None,0,0,0} - }; - - -//=======================>>> vDebugDialog::SetDebug <<<======================= - void vDebugDialog::SetDebug() - { - // Show a message, ask user Yes/No/Cancel - // returns < 0 for cancel, 0 for No, 1 for Yes - - int id; - ItemVal val; - - // first, set with current values - - if (!_cmdsAdded) // Only do this once - { - (void) SetCommandObject(dSystem, DebugState.System, DebugDialog); - (void) SetCommandObject(dUser, DebugState.User, DebugDialog); - (void) SetCommandObject(dCmdEvents, DebugState.CmdEvents, DebugDialog); - (void) SetCommandObject(dMouseEvents, DebugState.MouseEvents, DebugDialog); - (void) SetCommandObject(dWindowEvents, DebugState.WindowEvents, DebugDialog); - (void) SetCommandObject(dUserApp1, DebugState.UserApp1, DebugDialog); - (void) SetCommandObject(dUserApp2, DebugState.UserApp2 , DebugDialog); - (void) SetCommandObject(dUserApp3, DebugState.UserApp3 , DebugDialog); - (void) SetCommandObject(dBuild, DebugState.Build, DebugDialog); - (void) SetCommandObject(dMisc, DebugState.Misc, DebugDialog); - (void) SetCommandObject(dText, DebugState.Text, DebugDialog); - (void) SetCommandObject(dBadVals, DebugState.BadVals, DebugDialog); - (void) SetCommandObject(dConstructor, DebugState.Constructor, DebugDialog); - (void) SetCommandObject(dDestructor, DebugState.Destructor, DebugDialog); - - AddDialogCmds(DebugDialog); // Set up standard dialog - _cmdsAdded = 1; - } - - id = ShowModalDialog("Set Debug Options",val); // show and wait - switch (val) // convert to our system - { - case M_OK: - DebugState.System = GetValue(dSystem); - DebugState.User = GetValue(dUser); - DebugState.CmdEvents = GetValue(dCmdEvents); - DebugState.MouseEvents = GetValue(dMouseEvents); - DebugState.WindowEvents = GetValue(dWindowEvents); - DebugState.UserApp1 = GetValue(dUserApp1); - DebugState.UserApp2 = GetValue(dUserApp2); - DebugState.UserApp3 = GetValue(dUserApp3); - DebugState.Build = GetValue(dBuild); - DebugState.Misc = GetValue(dMisc); - DebugState.Text = GetValue(dText); - DebugState.BadVals = GetValue(dBadVals); - DebugState.Constructor = GetValue(dConstructor); - DebugState.Destructor = GetValue(dDestructor); - break; - - case M_Cancel: - break; - - default: - SysDebug1(BadVals,"vDebugDialog::SetDebug() - can't handle %d\n",val) - break; - }; - } - -//====================>>> vDebugDialog::DialogCommand <<<======================= - void vDebugDialog::DialogCommand(ItemVal id, ItemVal val, CmdType ctype) - { - - vModalDialog::DialogCommand(id,val,ctype); - - switch (id) - { - case M_OK: - CloseDialog(); - break; - - case M_All: // set all to 1 - SetValue(dSystem, 1, Value); - SetValue(dUser, 1, Value); - SetValue(dCmdEvents, 1, Value); - SetValue(dMouseEvents, 1, Value); - SetValue(dWindowEvents, 1, Value); - SetValue(dUserApp1, 1, Value); - SetValue(dUserApp2, 1, Value); - SetValue(dUserApp3, 1, Value); - SetValue(dBuild, 1, Value); - SetValue(dMisc, 1, Value); - SetValue(dText, 1, Value); - SetValue(dBadVals, 1, Value); - SetValue(dConstructor, 1, Value); - SetValue(dDestructor, 1, Value); - break; - - case M_None: // set all to 0 - SetValue(dSystem, 0, Value); - SetValue(dUser, 0, Value); - SetValue(dCmdEvents, 0, Value); - SetValue(dMouseEvents, 0, Value); - SetValue(dWindowEvents, 0, Value); - SetValue(dUserApp1, 0, Value); - SetValue(dUserApp2, 0, Value); - SetValue(dUserApp3, 0, Value); - SetValue(dBuild, 0, Value); - SetValue(dMisc, 0, Value); - SetValue(dText, 0, Value); - SetValue(dBadVals, 0, Value); - SetValue(dConstructor, 0, Value); - SetValue(dDestructor, 0, Value); - break; - } - } - -//########################################################################### -// Utilities - these may be useful for others, too. - -//========================>>> SetCommandObject <<<============================== - int SetCommandObject(const int id, const int val, CommandObject* CmdList) - { - for (CommandObject* cur = CmdList ; cur->cmdType != C_EndOfList ; ++cur) - { - if (cur->cmdId == id) - { - cur->retVal = val; - return 1; - } - } - - SysDebug1(BadVals,"SetCommandObject(id:%d...) - No match in list\n",id) - - return 0; - } - -// --------------------------------------------------------------------- diff --git a/v/srcx/vdialog.cxx b/v/srcx/vdialog.cxx deleted file mode 100644 index 7208382..0000000 --- a/v/srcx/vdialog.cxx +++ /dev/null @@ -1,600 +0,0 @@ -//=============================================================== -// vdialog.cxx - vDialog class -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // Motif/Athena mapping -#include // our header -#include -#include - -extern "C" -{ -#include - -#ifdef Athena - -#include -#include - -#else - -#include -#include -#include -#include -#include - -#endif -} - -#ifndef Athena - -#define formWidgetC xmFormWidgetClass -#define Ncallback XmNactivateCallback -#define Nheight XmNheight -#define Nlabel XmNlabelString -#define NmappedWhenManaged XmNmappedWhenManaged -#define Nwidth XmNwidth -#define NborderWidth XmNborderWidth - -#define Ntitle XmNtitle -#define NallowShellResize XmNallowShellResize -#define XNx XmNx -#define XNy XmNy - -#define setLabel(x,y) XmString x = XmStringCreateSimple(y); -#define freeLabel(x) XmStringFree(x); - -#else //------------------------------------------------------ - -#define formWidgetC formWidgetClass -#define NborderWidth XtNborderWidth -#define Ncallback XtNcallback -#define Nheight XtNheight -#define Nlabel XtNlabel -#define NmappedWhenManaged XtNmappedWhenManaged -#define Nwidth XtNwidth -#define setLabel(x,y) char* x = y; -#define freeLabel(x) - -#define Ntitle XtNtitle -#define NallowShellResize XtNallowShellResize -#define XNx XtNx -#define XNy XtNy - -#endif // ----------------------------------------------------- - -// Define static data of the class - -#ifdef Athena -#define GRAY_BACKGROUND -#else -#undef GRAY_BACKGROUND -#endif - -#ifdef GRAY_BACKGROUND -#define gray_width 2 -#define gray_height 2 -static char gray_bits[] = { - 0x01, 0x02}; -static Pixmap gray_bitmap = 0; -#endif - -//========================>>> ignore_DW_CB <<<======================= - static void ignore_d_DW_CB(Widget, XtPointer client_data, XtPointer) - { - ; - } - -//===================>>> vDialog::vDialog <<<======================= - vDialog::vDialog(vBaseWindow* creator, int modal, VCONST char* title) : - vBaseWindow(title) // constructor - { - _parentHandle = creator->vHandle(); - init(modal,title); - } - -//===================>>> vDialog::vDialog <<<======================= - vDialog::vDialog(vApp* creator, int modal, VCONST char* title) : - vBaseWindow(title) // constructor - { - _parentHandle = creator->vHandle(); - init(modal,title); - } - -//=================>>> vDialog::~vDialog <<<======================= - vDialog::~vDialog() - { - - SysDebug(Destructor,"vDialog::~vDialog() destructor\n") - - _IsDisplayed = 0; // The dialog is not up - closeBaseWindow(); // close this window - } - -//===================>>> vDialog::vDialog <<<======================= - vDialog::vDialog(const vDialog& d) : vBaseWindow(d), vCmdParent() - { - vSysError("vDialog - V semantics do not support copy constructors!"); - } - -//===================>>> vDialog::vDialog <<<======================= - void vDialog::init(int modal, VCONST char* title) - { - - // Initialize dialog box - - _addedWDW = 0; - - _modal = modal; // settable modal - - SysDebug(Constructor,"vDialog::vDialog() constructor\n") - - _wType = DIALOG; // a dialog - - _IsDisplayed = 0; // The dialog is not up - -#ifdef GRAY_BACKGROUND - // Create pixmap - if (gray_bitmap == 0) // haven't built the pixmap yet - { - gray_bitmap = XCreatePixmapFromBitmapData( - theApp->display(), // our display - DefaultRootWindow(theApp->display()), // a Drawable - gray_bits, // the gray bitmap data - gray_width, // from the file - gray_height, - (unsigned long) theApp->Xfg(), // Forground color - (unsigned long) theApp->Xbg(), // Background color - DefaultDepth(theApp->display(),DefaultScreen(theApp->display()))); - - } -#endif - -#ifdef Athena - // create a transient shell for the dialog - _vHandle = XtVaCreatePopupShell(_name, // name supplied - transientShellWidgetClass, // a transient shell - _parentHandle, - XtNtitle, _name, // no label - XtNallowShellResize, TRUE, - NULL); - -#else // Motif - - // create a transient shell for the dialog - _vHandle = XtVaCreateWidget(_name, // name supplied - xmDialogShellWidgetClass, // a transient shell - theApp->vHandle(), - XmNtitle, _name, // no label - XmNallowShellResize, TRUE, - XmNtransientFor,_parentHandle, - XmNdeleteResponse,XmDO_NOTHING, // added 1.24 - NULL); -#endif - - // Now the dialog widget - -#ifndef Athena // Motif version - if (_modal) - { - _wDialog = XtVaCreateWidget( - "vDialog", // widget name - xmFormWidgetClass, // widget class - _vHandle, // based on our popup window - XmNverticalSpacing,3, - XmNhorizontalSpacing,3, - XmNnoResize,false, - XmNresizePolicy, XmRESIZE_ANY, - XmNshadowThickness,1, - XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL, - XmNshadowType, XmSHADOW_ETCHED_IN, - NULL); // terminate varargs list - _dialogFrame = _wDialog; - } - else - { - _dialogFrame = XtVaCreateWidget( - "vDialogFrame", // widget name - xmFrameWidgetClass, // widget class - _vHandle, // based on our popup window - XmNmarginHeight,3, - XmNmarginWidth,3, - XmNshadowThickness,4, - XmNshadowType, XmSHADOW_OUT, - XmNresizePolicy, XmRESIZE_ANY, - NULL); // terminate varargs list - - _wDialog = XtVaCreateWidget( - "vDialog", // widget name - xmFormWidgetClass, // widget class - _dialogFrame, // based on our popup window - XmNverticalSpacing,3, - XmNhorizontalSpacing,3, - XmNnoResize,True, - XmNdialogStyle, XmDIALOG_MODELESS, - XmNresizePolicy, XmRESIZE_ANY, - NULL); // terminate varargs list - } -#else // Athena - - _wDialog = XtVaCreateWidget( - "vDialog", // widget name - formWidgetC, // widget class - _vHandle, // based on our popup window - XtNresizable,1, - NULL); // terminate varargs list - -#ifdef GRAY_BACKGROUND - // set the background pattern - if (theApp->Xdepth() <= 1) - XtVaSetValues(_wDialog, // the widget to set - XtNbackgroundPixmap, gray_bitmap, NULL); - else -#endif - XtVaSetValues(_wDialog, // the widget to set - XtNbackground, _vDialogBG, NULL); - -#endif // Motif/Athena - - _DefaultButton = 0; // No default button described - _FirstTextIn = 0; // No text in field - - } - -//===================>>> vDialog::AddDialogCmds <<<======================== - void vDialog::AddDialogCmds(CommandObject* cList) // add commands - { - // This is called to add commands from the supplied - // CommandObject list. - - vCmd* defButton = 0; - DlgCmdList* curCmd; - int textIns = 0; // how many text ins - - // scan the entire list - - for (int ix = 0 ; cList && (cList[ix].cmdType != C_EndOfList) ; ++ix) - { - curCmd = new DlgCmdList; // get a new cell - - curCmd->nextDCL = _cmdList; // add in at front - _cmdList = curCmd; - - curCmd->cmdP = AddCmd(&cList[ix]); - - // Track default button - - if (cList[ix].attrs & CA_DefaultButton) - { - defButton = curCmd->cmdP; - } - - if (cList[ix].cmdType == C_TextIn) - { - ++textIns; - if (_FirstTextIn == 0) - _FirstTextIn = curCmd->cmdP; - } - } - - if (defButton) // we have a default - { - _DefaultButton = defButton; // Track the default button - - // This lets us use Enter to activate the default button. - // The accelerators are defined elsewhere - this just - // allows the accelerators for _wDialog to apply to - // the default button as well. - -#ifndef Athena - // @@@ need to do something -#else - XtInstallAccelerators(_wDialog, defButton->wCmd); // add accelerators -#endif - } -#ifndef Athena - // @@@ do something -#else // Athena - if (textIns == 1 && _FirstTextIn != 0) // we had a textin field - { - XtSetKeyboardFocus(_wDialog,_FirstTextIn->wCmd); // set focus to first text - } -#endif - } - -#ifdef useAddDialogCmdObj -// move next line to .h if used -virtual void vDialog::AddDialogCmdObj(CommandObject* Cmd, vCmd* CmdInstance); -//===================>>> vDialog::AddDialogCmdObj <<<======================== - void vDialog::AddDialogCmdObj(CommandObject* Cmd, vCmd* CmdInstance) - { - // This is called to add an already instantiated command object to the - // CommandObject list. - - vCmd* defButton = 0; - - // scan the entire list - - DlgCmdList* curCmd = new DlgCmdList; // get a new cell - - curCmd->nextDCL = _cmdList; // add in at front of list - - _cmdList = curCmd; - - curCmd->cmdP = CmdInstance; // point to the object - - // Track default button - - if (Cmd->attrs & CA_DefaultButton) - { - _DefaultButton = CmdInstance; // This is the default button - // This lets us use Enter to activate the default button. - // The accelerators are defined elsewhere - this just - // allows the accelerators for _wDialog to apply to - // the default button as well. - -#ifndef Athena - // @@@ need to do something -#else - XtInstallAccelerators(_wDialog, defButton->wCmd); // add accelerators -#endif - } - } -#endif - -//====================>>> vDialog::CancelDialog <<<======================= - void vDialog::CancelDialog(void) - { - // Cancel selected - reset all values to original values - - - SysDebug(CmdEvents,"vDialog::CancelDialog()\n") - - for (DlgCmdList* cc = _cmdList ; cc != 0 ; cc = cc->nextDCL) - { - (cc->cmdP)->ResetItemValue(); - } - - // And close the dialog - - CloseDialog(); - } - -//====================>>> vDialog::CloseDialog <<<======================= - void vDialog::CloseDialog(void) - { - - SysDebug(Build,"vDialog::CloseDialog()\n") - - // This is UGLY, but so are combo boxes, and we gotta do it! - for (DlgCmdList* cc = _cmdList ; cc != 0 ; cc = cc->nextDCL) - { - if ((cc->cmdP)->dlgCmd->cmdType == C_ComboBox) - (cc->cmdP)->SetCmdVal(0,Checked); - } - - XtPopdown(_vHandle); // pop down - _IsDisplayed = 0; // The dialog is not up - } - -//====================>>> vDialog::DialogCommand <<<======================= - void vDialog::DialogCommand(ItemVal id, ItemVal retval, CmdType ctype) - { - // After the user has selected a command from the dialog, - // this routine is called with the value - - - SysDebug2(CmdEvents,"vDialog::DialogCommand(id:%d, val:%d)\n",id, retval) - - switch (id) // We will do some things depending on value - { - case M_Cancel: - CancelDialog(); - break; - - case M_Done: // default, close dialog - case M_OK: - { - CloseDialog(); - break; - } - } - } - -//====================>>> vDialog::DialogDisplayed <<<======================= - void vDialog::DialogDisplayed() - { - } - -//==================>>> vDialog::ProcessCmd <<<======================= - void vDialog::ProcessCmd(ItemVal id, ItemVal rv, CmdType ct) - { - // simple interface between command objects and the - // inherited vCmdParent ProcessCmd to the CommandObject which does the work - - if (ct == C_TextIn) // TextIn special - { - if (_DefaultButton == 0) // There is NOTa default button - return; - // change the textin return to the default button - id = _DefaultButton->_cmdId; // get the id of the default cmd - rv = _DefaultButton->_retVal; - ct = (_DefaultButton->dlgCmd)->cmdType; - } - - DialogCommand(id, rv, ct); - } - -//====================>>> vDialog::SetDialogTitle <<<======================= - void vDialog::SetDialogTitle(VCONST char* title) - { - XtVaSetValues(_vHandle, XtNtitle, title, NULL); - } - -//================>>> vDialog::GetDialogPosition <<<======================== - void vDialog::GetDialogPosition(int& left, int& top, int& width, - int& height) VCONST - { - Dimension w,h,b; - Position l,t; - - XtVaGetValues(_vHandle, Nwidth, &w, Nheight, &h, - XNx, &l, XNy, &t, NborderWidth, &b, NULL); - - left = l; top = t; width = w+b+b; height = h+b+b; - - } - -//====================>>> vDialog::SetDialogPosition <<<====================== - void vDialog::SetDialogPosition(int left, int top) - { - Position l = left; - Position t = top; - - XtVaSetValues(_vHandle,XNx,l, XNy,t,NULL); - } - -//====================>>> vDialog::ShowDialog <<<======================= - void vDialog::ShowDialog(VCONST char* msg) - { - // Show the dialog with the default message - - // We will control the position of the dialog box based on - // the parent's location. The user can move the dialog later. - - Position x, y; - Dimension width, height; - Dimension mywidth, myheight; - - - SysDebug1(Build,"vDialog::ShowDialog(%s)\n",msg) - - // First, get the values from our parent - - if (IsDisplayed()) - return; // make this a no-op - - XtVaGetValues(_parentHandle, // parent widget - Nwidth, &width, // get these values - Nheight, &height, - NULL); - - // Now, calculate the center of our parent using its width - // and height, translate them to root widow world coordinates - - XtTranslateCoords(_parentHandle, // Widget - (Position) width/2, // x - (Position) height/2, // y - &x, &y); // coords on root window - - XtVaGetValues(_vHandle, // parent widget - Nwidth, &mywidth, // get these values - Nheight, &myheight, - NULL); - - // x and y are the world coordinates of the center of our parent. - // Adjust them so the dialog will be centered over the parent, - // but not above or left of the parent - - if (myheight == 0 || myheight > height) // I'm taller than my parent - y = y - (height/2) + 35; - else - y = y - (myheight/2); - - if (mywidth == 0 || mywidth > width) - x = x - (width/2) + 35; - else - x = x - (mywidth/2); - - XtVaSetValues(_vHandle, XtNx, x, XtNy, y, NULL); - - // set the message field - - if (msg && *msg) - { - for (DlgCmdList* cc = _cmdList ; cc != 0 ; cc = cc->nextDCL) - { - if (((cc->cmdP)->dlgCmd)->attrs & CA_MainMsg) - { - SetString( ((cc->cmdP)->dlgCmd)->cmdId, msg); - } - } - } - - // Since the dialog isn't necessarily re-created each time it is - // popped up, we need to loop through now to set the original values - - for (DlgCmdList* cc = _cmdList ; cc != 0 ; cc = cc->nextDCL) - { - (cc->cmdP)->SaveItemValue(); - } - - // Finally, make sure form is managed - - if (!XtIsManaged(_wDialog)) - XtManageChild(_wDialog); - - if (!_modal) - { -#ifndef Athena - if (!XtIsManaged(_dialogFrame)) - { - XtManageChild(_dialogFrame); - theApp->XWaitUntilMapped(_dialogFrame); - } -#endif - } - else - theApp->XWaitUntilMapped(_wDialog); - -#ifdef Athena - // Now ready to popup the dialog - if (_modal) - XtPopup(_vHandle, XtGrabExclusive); - else - XtPopup(_vHandle, XtGrabNone); - theApp->XWaitUntilMapped(_vHandle); -#endif - - // V 1.24 - actually, we have to handle close button for - // dialogs because some win managers decorate them anyway - - if (!_addedWDW) - { - _addedWDW = 1; -#ifndef Athena - XmAddWMProtocolCallback(_vHandle, theApp->vx_wm_delete_window, - ignore_d_DW_CB, 0); -#else - Atom WDW = XInternAtom(XtDisplay(_vHandle), "WM_DELETE_WINDOW", False); - XSetWMProtocols(XtDisplay(_vHandle), XtWindow(_vHandle), - &WDW, 1); - XtAddEventHandler(_vHandle, (EventMask)0L, 1, - (XtEventHandler)ignore_d_DW_CB, 0); -#endif - } - -#ifndef DONT_WARP_MOUSEXXX - if (_DefaultButton != 0) // There is a default button - { - Widget wDef = _DefaultButton->wCmd; // get the def button widget - - XWarpPointer(XtDisplay(wDef),None, XtWindow(wDef), - 0,0,0,0, 10, 10); // Warp to button - XSync(XtDisplay(wDef),False); - } -#endif - _IsDisplayed = 1; // The dialog is up - - theApp->CheckEvents(); - DialogDisplayed(); - } -// --------------------------------------------------------------------- diff --git a/v/srcx/vfilesel.cxx b/v/srcx/vfilesel.cxx deleted file mode 100644 index 02f3f26..0000000 --- a/v/srcx/vfilesel.cxx +++ /dev/null @@ -1,708 +0,0 @@ -//=============================================================== -// vfilesel.cxx - vFileSelect class functions - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // our header -#include // we use notice -#include // we use notice -#include // we use notice -#include // for icons - -#include -#include -#include -//#include -#include -#include - -// Define static data of the class - - enum { - fsMSG = 100, - fsFrame, - fsLFN, - fsFN, - fsLCD, - fsCD, - fsLFLT, - fsFLT, - fsLIST, - fsMkdir, - fsRm, - fsSEL, - fsHOME, - fsSHOWDOT, - fsBLNK, - fsBLNK2, - fsLBLDIR, - fsLISTDIR, - fsLBLITEM - }; - - static char* filterList[] = // The default filter list - { - "*", 0 - }; - - static char* emptyList[] = - { - "[no files found yet]", - 0 - }; - -#define home_width 24 -#define home_height 16 -static unsigned char home_bits[] = { - 0x00, 0x80, 0x1f, 0x00, 0x40, 0x20, 0x00, 0x20, 0x40, 0xff, 0xff, 0xff, - 0x01, 0x00, 0x80, 0x01, 0x00, 0x80, 0x01, 0x00, 0xb0, 0xf1, 0x30, 0x98, - 0xf9, 0x19, 0x8c, 0x99, 0x1f, 0x86, 0x0d, 0x0f, 0x83, 0x01, 0x80, 0x81, - 0x01, 0xc0, 0x80, 0x01, 0x00, 0x80, 0x01, 0x00, 0x80, 0xff, 0xff, 0xff}; - - static vIcon home(&home_bits[0], home_height, home_width); // use icon for home - -#define FilterIndex 4 -#define FileListIndex 10 -#define DirListIndex 8 -#define LS "ls -1aLF" - - static CommandObject FileSelectDialog[] = - { - {C_Frame, fsFrame, 0, "", NoList, CA_None, isSens,NoFrame,0,0}, - {C_Label, fsLFLT, 0, "Filter:", - NoList,CA_None,isSens,fsFrame, 0,0}, - - {C_Blank, fsBLNK, 0, " ",NoList,CA_None,isSens,fsFrame,fsLFLT,0}, - - {C_Label, fsMSG, 0, "Select File",NoList, - CA_MainMsg,isSens,fsFrame, fsBLNK,0}, - - {C_ComboBox,fsFLT,0,"ComboBox",(void*)filterList, // index 1 - CA_None,isSens,fsFrame,0,fsLFLT}, - - {C_Label, fsLCD, 0, "Directory:", - NoList,CA_None,isSens,fsFrame, 0,fsFLT}, - {C_Label, fsCD, 0, ".", NoList, - CA_None,isSens,fsFrame,fsLCD,fsFLT}, - - {C_Label, fsLBLDIR, 0, "Directories", - NoList,CA_None,isSens,fsFrame,0,fsLCD}, - - {C_List, fsLISTDIR, 150, "List", (void*)emptyList, // index 6 - CA_ListWidth | CA_Size,isSens,fsFrame,0,fsLBLDIR,16}, - - {C_Label, fsLBLITEM, 0, "Items", - NoList,CA_None,isSens,fsFrame,fsLISTDIR,fsLCD}, - - {C_List, fsLIST, 150, "List", (void*)emptyList, // index 8 - CA_ListWidth | CA_Size,isSens,fsFrame,fsLISTDIR,fsLBLITEM,16}, - - - {C_Label, fsLFN, 0, "Selection", NoList,CA_None,isSens,fsFrame, 0,fsLIST}, - - {C_Blank, fsBLNK2, 0, " ",NoList,CA_None,isSens,fsFrame,fsLFN,fsLIST}, - - {C_CheckBox,fsSHOWDOT,0,"Show \".hidden\"",NoList,CA_None,isSens, - fsFrame,fsBLNK2,fsLIST}, - - - {C_TextIn, fsFN, 0, "", NoList, - CA_Large,isSens,fsFrame,0,fsSHOWDOT}, - - - {C_Button, M_OK, M_OK, " OK ", NoList,CA_DefaultButton, - isSens,fsFrame,0,fsFN}, - {C_Button, fsSEL, fsSEL, " Select ", NoList,CA_None, - isSens,fsFrame,M_OK,fsFN,0,"Select highlighted file"}, - {C_Button, M_Cancel, M_Cancel, " Cancel ", NoList,CA_None, - isSens,fsFrame,fsSEL,fsFN,0,"Cancel file open"}, - {C_IconButton, fsHOME, fsHOME, "Home",(void*)&home, CA_None, - isSens,fsFrame,M_Cancel,fsFN,0,"Change to HOME directory"}, - {C_Button, fsMkdir, 0, " mkdir ", NoList,CA_None, - isSens,fsFrame,fsHOME,fsFN,0,"New directory under current directory"}, - {C_Button, fsRm, 0, " rm ", NoList,CA_None, - isSens,fsFrame,fsMkdir,fsFN,0,"Delete ('rm') selected file"}, - - - {C_EndOfList,0,0,0,0,CA_None,0,0,0} - }; - - - static int dirsort(const char**, const char**); - static int wild_match(const char* , const char*); - -//======================>>> vFileSelect::FileSelect <<<======================= - int vFileSelect::FileSelect(VCONST char* msg, char* filename, - const int maxlen, char** filter, int& filterIndex) - { - // Show the file selection dialog. - // returns 0 on cancel, 1 otherwise - - int ans; - char temp[maxFileLen]; - - if (!filename) - return 0; - - _showHidden = 0; - origFile[0] = 0; - fileList[0] = 0; - dirList[0] = 0; - - // If the user supplies a filter, use it. Otherwise, use the default. - - if (filter != 0 && *filter != 0) - { - _curFilter = filterIndex; // which filter we used - filterPtr = filter; // so we can change - fileFilter = filter[_curFilter]; - FileSelectDialog[FilterIndex].itemList = (void *)filter; - FileSelectDialog[FilterIndex].retVal = _curFilter; - } - else - { - _curFilter = 0; - filterPtr = filterList; // so we can change - fileFilter = filterList[0]; - } - - // Fill this in dynamically so we can have dynamic heap array - - FileSelectDialog[FileListIndex].itemList = (void *)fileList; - FileSelectDialog[DirListIndex].itemList = (void *)dirList; - - GetDirList(".", fileFilter, fileList, maxFiles, dirList, maxDirs); - - dirSel = // No file selected - curSel = -1; // No file selected - - if (!_cmdsAdded) // Only once - { - AddDialogCmds(FileSelectDialog); // Set up standard dialog - _cmdsAdded = 1; - } - - // Read the current directory - - // Note: this SetString won't work on Windows... - - if (getcwd(temp,maxFileLen-1)) // get the current directory - SetString(fsCD,temp); - - strcpy(curDir,temp); // preload input with name - - if (*filename) // provided a base name - strcpy(origFile,filename); - - if (*filename != 0) - { - SetString(fsFN,filename); // the filename provided - } - else - { - strcpy(temp,curDir); // set to curdir - if (strcmp(temp,"/") != 0) - strcat(temp,"/"); - SetString(fsFN,temp); - } - - (void) ShowModalDialog(msg, ans); // show and wait - - if (ans != M_Cancel) - { - (void) GetTextIn(fsFN, filename, maxlen); - filterIndex = _curFilter; // copy back out - } - - return ans != M_Cancel; - } - -//======================>>> vFileSelect::FileSelect <<<======================= - int vFileSelect::FileSelectSave(VCONST char* msg, char* filename, - const int maxlen, char** filter, int& filterIndex) - { - return FileSelect(msg, filename, maxlen, filter, filterIndex); - } - -//====================>>> vFileSelect::DialogCommand <<<======================= - void vFileSelect::DialogCommand(ItemVal id, ItemVal val, CmdType ctype) - { - char temp[maxFileLen]; - - switch (id) - { - case fsFLT: // new filter - { - if (*filterPtr[val] == 0) - break; - _curFilter = val; - fileFilter = filterPtr[_curFilter]; - GetDirList(".", fileFilter, fileList, maxFiles, dirList, maxDirs); - SetValue(fsLIST,0,ChangeList); - SetValue(fsLISTDIR,0,ChangeList); - SetValue(fsLIST,-1,Value); // turn off file highlight - SetValue(fsLISTDIR,-1,Value); // turn off file highlight - dirSel = - curSel = -1; // No file selected - break; - } - - case fsLISTDIR: // item selected - { - if (val != dirSel) // This trick implements double click - { - SetValue(fsLIST,-1,Value); // turn off file highlight - dirSel = val; - break; - } - // else - change dirs - if ( dirSel < 0) // Make sure a valid selection - break; - strcpy(temp,dirList[dirSel]); - int len = strlen(temp); - if (temp[len-1] != '/') // not a directory! - break; - temp[len-1] = 0; // kill the / - GetDirList(temp, fileFilter, fileList, maxFiles, dirList, maxDirs); - if (getcwd(curDir,maxFileLen-1)) // get the current directory - SetString(fsCD,curDir); - else - { - SetString(fsCD,"."); - strcpy(curDir,"."); - } - SetValue(fsLIST,0,ChangeList); - SetValue(fsLISTDIR,0,ChangeList); - SetValue(fsLIST,-1,Value); // turn off file highlight - SetValue(fsLISTDIR,-1,Value); // turn off file highlight - strcpy(temp,curDir); - if (strcmp(temp,"/") != 0) - strcat(temp,"/"); - if (*origFile) - strcat(temp,origFile); - SetString(fsFN,temp); - dirSel = - curSel = -1; // No file selected - break; - } - - case fsLIST: // item selected - { - if (val != curSel) // This trick implements double click - { - SetValue(fsLISTDIR,-1,Value); // turn off file highlight - curSel = val; - break; - } - // else fall through to fsSEL! - } - - // WARNING - fall through from previous case! - - case fsSEL: // Do select - { - if (curSel < 0 && dirSel < 0) // Make sure a valid selection - break; - if (curSel < 0 && dirSel >= 0) // just a directory to select - { - if (!fileList[dirSel] || !*fileList[dirSel]) - break; - strcpy(temp,fileList[dirSel]); - int len = strlen(temp); - if (temp[len-1] != '/') // not a directory! - break; - temp[len-1] = 0; // kill the / - GetDirList(temp, fileFilter, fileList, maxFiles, dirList, maxDirs); - if (getcwd(curDir,maxFileLen-1)) // get the current directory - SetString(fsCD,curDir); - else - { - SetString(fsCD,"."); - strcpy(curDir,"."); - } - SetValue(fsLIST,0,ChangeList); - SetValue(fsLISTDIR,0,ChangeList); - SetValue(fsLIST,-1,Value); // turn off file highlight - SetValue(fsLISTDIR,-1,Value); // turn off file highlight - strcpy(temp,curDir); - if (strcmp(temp,"/") != 0) - strcat(temp,"/"); - if (*origFile) - strcat(temp,origFile); - SetString(fsFN,temp); - dirSel = - curSel = -1; // No file selected - break; - } - - strcpy(temp,fileList[curSel]); - int len = strlen(temp); - if (temp[len-1] == '/') // a directory! - { - temp[len-1] = 0; // kill the / - GetDirList(temp, fileFilter, fileList, maxFiles, dirList, maxDirs); - if (getcwd(curDir,maxFileLen-1)) // get the current directory - SetString(fsCD,curDir); - else - { - SetString(fsCD,"."); - strcpy(curDir,"."); - } - SetValue(fsLIST,0,ChangeList); - SetValue(fsLISTDIR,0,ChangeList); - SetValue(fsLIST,-1,Value); // turn off file highlight - SetValue(fsLISTDIR,-1,Value); // turn off file highlight - strcpy(temp,curDir); - if (strcmp(temp,"/") != 0) - strcat(temp,"/"); - if (*origFile) - strcat(temp,origFile); - SetString(fsFN,temp); - dirSel = - curSel = -1; // No file selected - } - else - { - // Build up the whole name, including the directory. - strcpy(temp,curDir); // the directory - if (strcmp(temp,"/") != 0) - strcat(temp,"/"); // needs trailing / - strcat(temp,fileList[curSel]); // the file - strcpy(origFile,fileList[curSel]); // the file - SetString(fsFN,temp); - } - break; - } - - case fsHOME: // change to home directory - { - char *hp = getenv("HOME"); - - if (hp == 0) - strcpy(temp,"."); - else - strcpy(temp,hp); - // now change to HOME - GetDirList(temp, fileFilter, fileList, maxFiles, dirList, maxDirs); - if (getcwd(curDir,maxFileLen-1)) // get the current directory - SetString(fsCD,curDir); - else - { - SetString(fsCD,"."); - strcpy(curDir,"."); - } - SetValue(fsLIST,0,ChangeList); - SetValue(fsLISTDIR,0,ChangeList); - SetValue(fsLIST,-1,Value); // turn off file highlight - SetValue(fsLISTDIR,-1,Value); // turn off file highlight - strcpy(temp,curDir); - if (strcmp(temp,"/") != 0) - strcat(temp,"/"); - SetString(fsFN,temp); - dirSel = - curSel = -1; // No file selected - break; - } - - case fsRm: // rm a file - { - (void) GetTextIn(fsFN, temp, maxFileLen-1); - if (strlen(temp) < 1 || temp[strlen(temp)-1] == '/') // no name picked! - { - vNoticeDialog note(this); - if (strlen(temp) < maxFileLen - 30) - strcat(temp,"\nis not a file name."); - else - strcpy(temp,"You must select or specify a valid file name."); - note.Notice(temp); - id = 0; // don't allow OK to exit - break; // break if invalid - } - // temp has the name of the file to rm - - vYNReplyDialog yn(this); - if (!yn.AskYN("Delete selected file - are you sure?")) - break; - - (void) remove(temp); // this should do it! - - // now, repaint lists - GetDirList(".", fileFilter, fileList, maxFiles, dirList, maxDirs); - SetValue(fsLIST,0,ChangeList); - SetValue(fsLISTDIR,0,ChangeList); - SetValue(fsLIST,-1,Value); // turn off file highlight - SetValue(fsLISTDIR,-1,Value); // turn off file highlight - strcpy(temp,curDir); - if (strcmp(temp,"/") != 0) - strcat(temp,"/"); - SetString(fsFN,temp); - dirSel = - curSel = -1; // No file selected - break; - } - - case fsMkdir: // mkdir - { - vReplyDialog rp(this); - if (!rp.Reply("Enter name of new directory:", temp,maxFileLen)) - break; - mkdir(temp,0xFFFF); - // now, repaint lists - GetDirList(".", fileFilter, fileList, maxFiles, dirList, maxDirs); - SetValue(fsLIST,0,ChangeList); - SetValue(fsLISTDIR,0,ChangeList); - SetValue(fsLIST,-1,Value); // turn off file highlight - SetValue(fsLISTDIR,-1,Value); // turn off file highlight - dirSel = - curSel = -1; // No file selected - break; - } - - case fsSHOWDOT: - { - _showHidden = val; // need to repaint - GetDirList(".", fileFilter, fileList, maxFiles, dirList, maxDirs); - SetValue(fsLIST,0,ChangeList); - SetValue(fsLISTDIR,0,ChangeList); - SetValue(fsLIST,-1,Value); // turn off file highlight - SetValue(fsLISTDIR,-1,Value); // turn off file highlight - dirSel = - curSel = -1; // No file selected - break; - } - - case M_OK: - { - (void) GetTextIn(fsFN, temp, maxFileLen-1); - if (strlen(temp) < 1 || temp[strlen(temp)-1] == '/') // no name picked! - { - vNoticeDialog note(this); - if (strlen(temp) < maxFileLen - 30) - strcat(temp,"\nis not a file name."); - else - strcpy(temp,"You must select or specify a valid file name."); - note.Notice(temp); - id = 0; // don't allow OK to exit - break; // break if invalid - } - // else fall through to default - } - - // WARNING - fall through from previous case! - default: - { - vModalDialog::DialogCommand(id,val,ctype); - break; - } - } - - if (id == M_OK || id == M_Cancel) - CloseDialog(); - } - -//====================>>> vFileSelect::GetDirList <<<======================= - void vFileSelect::GetDirList(const char *dir, const char* wild, - char** filelist, const int max, char** dirlist, const int maxdir) - { - DIR *dirp; // for reading a directory - - struct dirent *e; - - char fn[200]; - - char** fl; - char** dl; - - struct stat statbuf; // for check - - // make sure we can do this - if (stat(dir, &statbuf) < 0 || (statbuf.st_mode & S_IFDIR) == 0) - return; - - if ((dirp = opendir(dir)) == NULL) - return; - - if (chdir(dir) != 0) // change to new directory - { - SysDebug1(BadVals,"Unable to chdir to %s\n",dir); - return; - } - - // ok - will build a new list, so it is safe to kill the old one. - for (fl = filelist ; *fl ; ++fl) // free the space - { - delete [] *fl; - *fl = 0; - } - for (dl = dirlist ; *dl ; ++dl) // free the space - { - delete [] *dl; - *dl = 0; - } - - fl = filelist; - dl = dirlist; - - int ix, dx; - for (ix = 0, dx = 0; ix < max && dx < maxdir; ) - { - if ((e = readdir(dirp)) == NULL) // read entry - break; - - if (strlen(e->d_name) >= 199) // just ignore too long names - continue; - else - strcpy(fn,e->d_name); // make a copy - - if (strcmp(fn,".") == 0) // skip the "." - { - continue; - } - if (strcmp(fn,"..") == 0) // special entry - { - dl[dx] = new char[4]; - strcpy(dl[dx],"../"); // make it look like ../ - dx++; // bump list counter - continue; - } - if (!_showHidden && *fn == '.') // hide hidden? - { - continue; - } - if (stat(fn, &statbuf) < 0) // need to stat for type - { - fl[ix] = new char[strlen(fn)+1]; // default action - strcpy(fl[ix], fn); - ix++; // bump list counter - continue; - } - // OK, to here, then have a stat check file type - if ((statbuf.st_mode & S_IFDIR) != 0) // this is a dir - { - dl[dx] = new char[strlen(fn)+2]; // space for name + / - strcpy(dl[dx], fn); - strcat(dl[dx],"/"); - dx++; // bump list counter - continue; - } - // this would allow files only, but we will show all for now - // if ((statbuf.st_mode & (S_IFMT & ~S_IFLNK)) == 0) - else if (wild_match(fn,wild)) - { - fl[ix] = new char[strlen(fn)+1]; // space for name + / - strcpy(fl[ix], fn); - ix++; // bump list counter - continue; - } - } - - fl[ix] = 0; // mark end of the list - dl[dx] = 0; - - closedir(dirp); // close directory - - // sort the lists - qsort(fl, ix, sizeof(char *), - (int (*)(const void *,const void *))dirsort); - - qsort(dl, dx, sizeof(char *), - (int (*)(const void *,const void *))dirsort); - } - -//==========================>>> wild_match <<<============================== - static int wild_match(const char* file, const char* wild) - { - // compares list of file suffixes in form .x or *.x e.g.:"*.c *.h" - - char curpat[100] = ""; - int fileLen = strlen(file); - - if (wild == 0 || wild[0] == 0 || strcmp(wild,"*") == 0) - return 1; - - char* pat = curpat; // copy to current pattern - *pat = 0; - - for (const char *cp = wild ; ; ) // scan all suffixes - { - // The X version doesn't handle patterns like XXXX* very well - // It will treat XXX* the same as XXX*.ext the same - oh well... - if (*cp == '*' && *curpat != 0) // pattern of form XXX* found - { // we will be stupid for now - *pat = 0; // finish the pattern - // First, see if we have a match... - if (strstr(file,curpat)== file) - return 1; - for (++cp ; ;++cp) // skip till pattern break - { - if (*cp == ' ' || *cp == '\t' || *cp == 0 || *cp == ';') - break; - } - while (*cp == ' ' || *cp == '\t' || *cp == ';' ) - ++cp; // skip whitespace - // at beginning of next pattern - if (*cp == 0) // all done? - break; - pat = curpat; // start over - *pat = 0; - continue; // try next pattern - } - else if (*cp == '*') - { - ++cp; - continue; // ignore leading *'s - } - // look for separator - means we've build a suffix to check - if (*cp == ' ' || *cp == '\t' || *cp == 0 || *cp == ';') - { - *pat = 0; // end pattern string - int patLen = strlen(curpat); // length of pattern - if (fileLen < patLen) // gotta be >= - { - if (*cp == 0) // out of matches, return 0 - return 0; - } - // a match is possible - else if (strcmp(&file[fileLen-patLen],curpat) == 0) - return 1; - - pat = curpat; // start over - *pat = 0; - while (*cp == ' ' || *cp == '\t' || *cp == ';' ) - ++cp; // skip whitespace - // at beginning of next pattern - if (*cp == 0) // all done? - break; - } - else - *pat++ = *cp++; // copy pattern - } - return 0; - } - -//==========================>>> dirsort <<<============================== - static int dirsort(const char **a, const char **b) - { - // utility function to sort dir entries - const char* astr = *a; - const char* bstr = *b; - const char* aend = astr + strlen(astr) - 1; - const char* bend = bstr + strlen(bstr) - 1; - - if (strncmp(astr, "../", 3) == 0) // this goes first - return -1; - if (strncmp(bstr, "../", 3) == 0) - return 1; - - if (*aend == '/' && *bend != '/') // directories are next - return -1; - if (*aend != '/' && *bend == '/') - return 1; - return strcmp(astr, bstr); // just normal order - } diff --git a/v/srcx/vfinddlg.cpp b/v/srcx/vfinddlg.cpp deleted file mode 100644 index a76d006..0000000 --- a/v/srcx/vfinddlg.cpp +++ /dev/null @@ -1,105 +0,0 @@ -//=============================================================== -// vFinddlg.cxx - vFindDialog class functions - Common Win/X -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // our header -#include // for icon -#include - -// Define static data of the class - - static CommandObject FindDialog[] = - { - - {C_Frame, 79, 0, "",NoList,CA_NoBorder,isSens,NoFrame,0,0}, - {C_Frame, 80, 0, "",NoList,CA_None,isSens,79,0,0}, - - {C_Label, 69, 0, " ",NoList, - CA_None,isSens,80, 0,0}, - {C_Label, 91, 0, "Text to find",NoList, - CA_None,isSens,80, 69,0}, - {C_TextIn, 92, 0, "", NoList, - CA_Large,isSens,80,91,0}, - - - {C_Frame, 81, 0, "",NoList,CA_None,isSens,79,0,80}, - {C_Label, 60, 0, "Search Range",NoList, - CA_None,isSens,81, 0,0}, - {C_RadioButton, 93, 1,"From Cursor",NoList,CA_None, - notSens,81,0,60}, - {C_RadioButton, 94, 0,"Entire File",NoList,CA_None, - notSens,81,0,93}, - - {C_Frame, 82, 0, "",NoList,CA_None,isSens,79,81,80}, - {C_Label, 61, 0, "Search Direction",NoList, - CA_None,isSens,82, 0,0}, - {C_RadioButton, 95, 1,"Forward",NoList,CA_None, - isSens,82,0,61}, - {C_RadioButton, 96, 0,"Backward",NoList,CA_None, - isSens,82,0,95}, - - {C_Frame, 83, 0, "",NoList,CA_None,isSens,79,82,80}, - {C_Label, 62, 0, "Options",NoList, - CA_None,isSens,83, 0,0}, - {C_CheckBox, 97, 0,"Case Sensitive",NoList,CA_None, - isSens,83,0,62}, - - {C_Button, M_OK, M_OK, " Find ", NoList,CA_DefaultButton, - isSens,NoFrame,79,0}, - {C_Button, M_Cancel, M_Cancel, " Cancel ", NoList,CA_None, - isSens,NoFrame,79,M_OK}, - {C_EndOfList,0,0,0,0,CA_None,0,0,0} - }; - -//======================>>> vFindDialog::AskFindPat <<<======================= - int vFindDialog::AskFindPat(char* reply, const int maxlen, int& caseSens, - int& Down, int& Wrap) - { - // Show a message, wait for a reply - // no important return - - int ans; - - if (!reply) - return 0; - - if (!added) - { - FindDialog[vGetcmdIdIndex(92,FindDialog)].title = reply; - AddDialogCmds(FindDialog); // Set up standard dialog - added = 1; - } - - if (*reply) - SetString(92,reply); - SetValue(97,caseSens,Value); - SetValue(94,Wrap,Value); - SetValue(95,Down,Value); - int rID = ShowModalDialog("", ans); // show and WAIT - - if (rID != M_Cancel) - { - (void) GetTextIn(92, reply, maxlen); - caseSens = GetValue(97); - Wrap = GetValue(94); // Entire file? - Down = GetValue(95); // Down? - } - - return rID == M_OK; - } - -//====================>>> vFindDialog::DialogCommand <<<======================= - void vFindDialog::DialogCommand(ItemVal id, ItemVal val, CmdType ctype) - { - vModalDialog::DialogCommand(id,val,ctype); -// if (id == M_OK || id == M_Cancel) -// CloseDialog(); - } -// --------------------------------------------------------------------- diff --git a/v/srcx/vfont.cxx b/v/srcx/vfont.cxx deleted file mode 100644 index 1c19ea0..0000000 --- a/v/srcx/vfont.cxx +++ /dev/null @@ -1,370 +0,0 @@ -//=============================================================== -// vfont.cxx - The font class - X -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include -#include -#include -#include - - static vFontList _FontList; // ONE font list - -//=======================>>> vFont::vFont <<<============================= - vFont::vFont(vFontID fam, int size, vFontID sty, vFontID wt, int und, int ang) - { - SysDebug1(Constructor,"vFont::vFont(%d) constructor\n",ang) - - _family = fam; _pointSize = size; _style = sty; _weight = wt; - _underlined = und; _XFont = 0; _angle = ang; - - } - -//=====================>>> vFont::vFont <<<=========================== - vFont::vFont(const vFont& ft) - { - // Copy constructor - needs to delete object if already - // created, and copy the values as needed - - _XFont = ft._XFont; - _family = ft._family; _style = ft._style; _weight = ft._weight; - _pointSize = ft._pointSize; _underlined = ft._underlined; - _angle = ft._angle; - - } - -//=====================>>> vFont::= <<<=========================== - vFont& vFont::operator =(const vFont& ft) VCONST - { - if (this == &ft) // assigning to self - { - return (vFont &)*this; - } - - // just like the copy constructor - - _XFont = ft._XFont; - _family = ft._family; _style = ft._style; _weight = ft._weight; - _pointSize = ft._pointSize; _underlined = ft._underlined; - _angle = ft._angle; - - return (vFont&) *this; - } - -//=====================>>> vFont::SetFontValues <<<=========================== - void vFont::SetFontValues(vFontID fam, int size, vFontID sty, vFontID wt, - int und, int ang) - { - _XFont = 0; // changing characteristics, so need to reload - - SysDebug(Misc,"SetFontValues()\n"); - - _family = fam; _style = sty; _weight = wt; - _pointSize = size; _underlined = und; _angle = ang; - } - -//=======================>>> vFont::~vFont <<<============================= - vFont::~vFont() - { - SysDebug(Destructor,"vFont::~vFont() destructor\n") - } - -//=================>>> vFont::SetNativeFontString <<<======================== - void vFont::SetNativeFontString(char* fontStr) - { - // string in format fam;sty;wt;pts;und;ang - - char fs[100]; - - char* fam; int famv; - char* sty; int styv; - char* wt; int wtv; - char* pts; int ptsv; - char* und; int undv; - char* ang; int angv; - - - strcpy(fs,fontStr); - fam = fs; - sty = strstr(fam,";"); - *sty++ = 0; - famv = (int) StrToLong(fam); - - wt = strstr(sty,";"); - *wt++ = 0; - styv = (int) StrToLong(sty); - - pts = strstr(wt,";"); - *pts++ = 0; - wtv = (int) StrToLong(wt); - - und = strstr(pts,";"); - *und++ = 0; - ptsv = (int) StrToLong(pts); - - ang = strstr(und,";"); - *ang++ = 0; - - undv = (int) StrToLong(und); - angv = (int) StrToLong(ang); - - SetFontValues((vFontID)famv, ptsv, (vFontID)styv, (vFontID)wtv, undv, angv); - - - - } - -//=================>>> vFont::GetNativeFontString <<<======================== - void vFont::GetNativeFontString(char* fontStr) - { - // string in format fam;sty;wt;pts;und;ang - char buff[20]; - - LongToStr((long)_family, buff); - strcpy(fontStr,buff); strcat(fontStr,";"); - - LongToStr((long)_style, buff); - strcat(fontStr,buff); strcat(fontStr,";"); - - LongToStr((long)_weight, buff); - strcat(fontStr,buff); strcat(fontStr,";"); - - LongToStr((long)_pointSize, buff); - strcat(fontStr,buff); strcat(fontStr,";"); - - LongToStr((long)_underlined, buff); - strcat(fontStr,buff); strcat(fontStr,";"); - - LongToStr((long)_angle, buff); - strcat(fontStr,buff); - - } - -//=======================>>> vFont::LoadFont <<<============================= - void vFont::LoadFont() VCONST - { - // Create the stuff needed for interal font stuff - - if (_XFont != 0) - return; - - // First, check for default fonts... - - vFont* fptr = (vFont*)_FontList.FindFont((vFont&)*this); // see if we already had this font - - if (fptr) // found one - { - *this = *fptr; // copy it - return; - } - - if (_family == vfDefaultSystem) // default system font - { - _XFont = theApp->_XDefaultFont; - } - else if (_family == vfDefaultVariable) // the system default variable font - { - _XFont = XLoadQueryFont(theApp->display(), "variable"); - } - else if (_family == vfDefaultFixed) // the system default variable font - { - _XFont = XLoadQueryFont(theApp->display(), "-*-fixed-bold-*-*-*-*-*-*-*-*-*-*-*"); - } - if (_XFont) - { - _FontList.AddFont((vFont&)*this); - return; // all done now - } - - // To here, then we have to construct an X font descriptor string - - char XFontStr[120]; - char XAltFontStr[120]; - - strcpy(XFontStr,"-*-"); // lead "-*-" - - switch (_family) // add family string - { - case vfSerif: // serifed font - TimesRoman - strcat(XFontStr,"times-"); // font family name - break; - case vfSerif2: // serifed font - TimesRoman - strcat(XFontStr,"new century schoolbook-"); // font family name - break; - case vfSansSerif: // SansSerif - Swiss or Helvetica - strcat(XFontStr,"lucida-"); // font family name - break; - case vfSansSerif2: // SansSerif - Swiss or Helvetica - strcat(XFontStr,"helvetica-"); // font family name - break; - case vfFixed: // fixed font - Courier - strcat(XFontStr,"courier-"); // font family name - break; - case vfFixed2: // fixed font - Courier - strcat(XFontStr,"clean-"); // font family name - break; - case vfDecorative: // decorative - dingbat - strcat(XFontStr,"symbol-"); // font family name - break; - case vfDecorative2: // decorative - dingbat - strcat(XFontStr,"terminal-"); // font family name - break; - default: - strcat(XFontStr,"fixed-"); // font family name - break; - } - - strcpy(XAltFontStr,XFontStr); // for alternate processing - - switch (_weight) // weight is next - { - case vfNormal: // normal style, weight - strcat(XFontStr,"medium-"); - break; - case vfBold: // boldface - strcat(XFontStr,"bold-"); - break; - default: - strcat(XFontStr,"medium-"); - break; - } - - switch (_style) - { - case vfNormal: // normal style - strcat(XFontStr,"r-"); - break; - case vfItalic: // italic style - strcat(XFontStr,"i-"); - break; - default: - strcat(XFontStr,"r-"); - break; - } - - - strcat(XFontStr,"normal-*-*-"); // up to point size now - - strcat(XAltFontStr,"*-*-*-*-*-"); // alt font - - char pt[24]; - - IntToStr(_pointSize,pt); - strcat(pt,"0-*-*-*-*-*-*"); // *10 plus rest of string - strcat(XFontStr,pt); - strcat(XAltFontStr,pt); - - SysDebug1(Misc,"Loading font: %s\n", XFontStr); - // Try to load the font with the full specification string - _XFont = XLoadQueryFont(theApp->display(), XFontStr); - - if (!_XFont) // Try just the family and pt size - { - SysDebug1(Misc," trying: %s\n",XAltFontStr); - _XFont = XLoadQueryFont(theApp->display(), XAltFontStr); - } - - if (!_XFont) // Final bail out is just plain fixed - { - SysDebug(Misc," Load fails - defaulting to fixed\n"); - _XFont = XLoadQueryFont(theApp->display(), "fixed"); - } - - _FontList.AddFont((vFont&)*this); // and add to list - - } - -//========================>>> vFont::XTextW <<<========================== - int vFont::XTextW(VCONST char* str) VCONST - { - int len = strlen(str); // strlen - - LoadFont(); // must be loaded - - // call X to get the length - return XTextWidth(_XFont, str, len); - } - -//====================>>> vFont::XFontH <<<============================= - int vFont::XFontH(int& asc, int& des) VCONST - { - // Return total height of this font. V will use total height, which - // is most often made up of ascent + descent. This is too much - // detail for the kind of apps V will support. - - LoadFont(); // must be loaded - - asc = _XFont->ascent; - des = _XFont->descent; - - int h = _XFont->ascent + _XFont->descent; // &asc might == &des - - SysDebug2(Misc,"Font height %d+%d\n",_XFont->ascent,_XFont->descent); - - return h; - } - -//######################################################################## - - -//======================>>> vFontList::vFontList <<<======================= - vFontList::vFontList() - { - // This will keep a list of this pointers accessed by some id - _list = 0; - } - -//======================>>> vFontList::~vFontList <<<======================= - vFontList::~vFontList() - { - // This will keep a list of this pointers accessed by some id - fontList* next; - for (fontList* tl = _list ; tl != 0 ; tl = next) - { - next = tl->next; // get next one - delete tl; - } - } - -//======================>>> vFontList::AddFont <<<======================= - void vFontList::AddFont(vFont& f) VCONST - { - // Add to list - - if (f._XFont == 0) // don't add non-loaded fonts - return; - - fontList* newList = new fontList; - - newList->font = f; // copy of the font - newList->next = _list; - _list = newList; - } - -//======================>>> vFontList::FindFont <<<======================= - vFont* vFontList::FindFont(vFont& ff) VCONST - { - // see if we have a matching font loaded - - for (fontList* fl = _list ; fl != 0 ; fl = fl->next) - { - if (fl->font._family == ff._family && - fl->font._style == ff._style && - fl->font._weight == ff._weight && - fl->font._pointSize == ff._pointSize && - fl->font._underlined == ff._underlined && - fl->font._angle == ff._angle) - { - return &fl->font; - } - } - return 0; - } - -//######################################################################## diff --git a/v/srcx/vfontsel.cxx b/v/srcx/vfontsel.cxx deleted file mode 100644 index c9500ae..0000000 --- a/v/srcx/vfontsel.cxx +++ /dev/null @@ -1,186 +0,0 @@ -//=============================================================== -// vfontsel.cxx - vFontSelect class functions - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // our header -#include // icons - -// Define static data of the class - -#define prompt_width 32 -#define prompt_height 32 -static unsigned char prompt_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0x1f, 0x04, 0x00, 0x00, 0x20, - 0xe4, 0xff, 0xff, 0x27, 0x14, 0x00, 0x00, 0x28, 0x14, 0xc0, 0x01, 0x28, - 0x14, 0xe0, 0x03, 0x28, 0x14, 0x30, 0x06, 0x28, 0x14, 0x30, 0x06, 0x28, - 0x14, 0x00, 0x03, 0x28, 0x14, 0x80, 0x01, 0x28, 0x14, 0xc0, 0x00, 0x28, - 0x14, 0xc0, 0x00, 0x28, 0x14, 0xc0, 0x00, 0x28, 0x14, 0xc0, 0x00, 0x28, - 0x14, 0x00, 0x00, 0x28, 0x14, 0xc0, 0x00, 0x28, 0x14, 0x00, 0x00, 0x28, - 0xe4, 0xff, 0xff, 0x27, 0x04, 0x00, 0x00, 0x20, 0xf8, 0xff, 0xff, 0x1f, - 0xfe, 0xff, 0xff, 0x7f, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, - 0x02, 0x00, 0xe0, 0x47, 0x02, 0x00, 0x00, 0x40, 0xfa, 0xff, 0xff, 0x5f, - 0xae, 0xaa, 0xaa, 0x6a, 0x56, 0x55, 0x55, 0x55, 0xaa, 0xaa, 0xaa, 0x6a, - 0xfe, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00}; - -#ifdef GENERICNAMES - static char* familyList[] = - { - "Serif", "Serif2", "Sans Serif", "Sans Serif2", - "Decorative", "Decorative 2", - "Fixed", "Fixed2", - "System Fixed", "System Variable", "System Default", 0 - }; -#else - static char* familyList[] = - { - "Times", "New Century Schoolbook", "Lucida", "Helvetica", - "Symbol", "Terminal", - "Courier", "Clean", - "System Fixed", "System Variable", "System Default", 0 - }; -#endif - static vFontID familyMap[] = - { - vfSerif, vfSerif2, vfSansSerif,vfSansSerif2, - vfDecorative, vfDecorative2, - vfFixed, vfFixed2, - vfDefaultFixed, vfDefaultVariable, vfDefaultSystem, - vfEndOfList - }; - - static char* styleList[] = { "Normal", "Italic", 0 }; - static vFontID styleMap[] = { vfNormal, vfItalic, vfEndOfList}; - - static char* weightList[] = { "Normal", "Bold", 0}; - static vFontID weightMap[] = { vfNormal, vfBold, vfEndOfList}; - - static char* sizeList[] = { "8", "9", "10", "11", "12", "13", "14", - "16", "18", "20", "24", "25", "30", "35", "40", 0}; - static int sizeMap[] = { 8, 9, 10, 11, 12, 13, 14, - 16, 18, 20, 24, 25, 30, 35, 40, 0}; - - static int underline = 0; - - static vIcon prompt((unsigned char*)&prompt_bits[0],prompt_height, - prompt_width); - - - const int famIX = 4; - const int styIX = 7; - const int wtIX = 10; - const int szIX = 13; - const int undIX = 14; - - static CommandObject SelFontDialog[] = - { - {C_Icon, 10, 0, "SelFont?", (void*)&prompt, CA_None, isSens,NoFrame,0,0}, - {C_Label, 1, 1, "Select Font",NoList, - CA_MainMsg ,isSens,NoFrame, 10,0}, - - - {C_Frame, 20, 0 , "",NoList,CA_None,isSens,NoFrame, 0, 10}, - {C_Label, 21, 21, "Family:",NoList,CA_None,isSens, 20, 0, 0}, - - {C_ComboBox,22,2, "", (void*)familyList, CA_NoNotify, isSens, 20,0,21}, - - {C_Frame, 30, 0 , "",NoList,CA_None,isSens,NoFrame, 20, 10}, - {C_Label, 31, 31, "Style:",NoList,CA_None,isSens,30, 0, 0}, - {C_ComboBox,32,0, "", (void*)styleList, CA_NoNotify, isSens, 30,0,31}, - - {C_Frame, 40, 0 , "",NoList,CA_None,isSens,NoFrame, 30, 10}, - {C_Label, 41, 41, "Weight:",NoList,CA_None,isSens,40, 0, 0}, - {C_ComboBox,42,1, "", (void*)weightList, CA_NoNotify, isSens, 40,0,41}, - - {C_Frame, 50, 0 , "",NoList,CA_None,isSens,NoFrame, 40, 10}, - {C_Label, 51, 51, "Size:",NoList,CA_None,isSens,50, 0, 0}, - {C_ComboBox,52,1, "", (void*)sizeList, CA_NoNotify, isSens, 50,0,51}, - - - {C_CheckBox, 61, 0, "Underlined",NoList,CA_None,isSens,NoFrame,0,20}, - - {C_Button, M_Cancel, M_Cancel, " Cancel ", NoList,CA_None, - isSens,NoFrame,20,61}, - {C_Button, M_OK, M_OK, " OK ", NoList, CA_DefaultButton, - isSens,NoFrame,M_Cancel,61}, - {C_EndOfList,0,0,0,0,CA_None,0,0,0} - }; - -//======================>>> vFontSelect::FontSelect <<<======================= - int vFontSelect::FontSelect(vFont& font,const char* msg, int fixedOnly) - { - // Select a font - // @@@ need to add support for fixedOnly - - int ans, ix; - - // Set to values of the supplied font - vFontID vfam = font.GetFamily(); - int ptsz = font.GetPointSize(); - vFontID vsty = font.GetStyle(); - vFontID vwt = font.GetWeight(); - int vund = font.GetUnderlined(); - - for (ix = 0 ; familyMap[ix] != vfEndOfList ; ++ix) - if (familyMap[ix] == vfam) - { - SelFontDialog[famIX].retVal = ix; - break; - } - - for (ix = 0 ; sizeMap[ix] != 0 ; ++ix) - if (sizeMap[ix] == ptsz) - { - SelFontDialog[szIX].retVal = ix; - break; - } - for (ix = 0 ; styleMap[ix] != vfEndOfList ; ++ix) - if (styleMap[ix] == vsty) - { - SelFontDialog[styIX].retVal = ix; - break; - } - for (ix = 0 ; weightMap[ix] != vfEndOfList ; ++ix) - if (weightMap[ix] == vwt) - { - SelFontDialog[wtIX].retVal = ix; - break; - } - SelFontDialog[undIX].retVal = vund; - - if (!_added) - { - AddDialogCmds(SelFontDialog); // Set up standard dialog - _added = 1; - } - - (void) ShowModalDialog((char*)msg, ans); // show and wait - - if (ans == M_Cancel) - return 0; - int fam = GetValue(22); // get family value - int sty = GetValue(32); - int wt = GetValue(42); - int sz = GetValue(52); - int und = GetValue(61); - - font.SetFontValues(familyMap[fam], sizeMap[sz], styleMap[sty], - weightMap[wt], und); - - return ans == M_OK; - } - -//====================>>> vFontSelect::DialogCommand <<<======================= - void vFontSelect::DialogCommand(ItemVal id, ItemVal val, CmdType ctype) - { - vModalDialog::DialogCommand(id,val,ctype); - if (id == M_OK || id == M_Cancel) - CloseDialog(); - } -// --------------------------------------------------------------------- diff --git a/v/srcx/vframec.cxx b/v/srcx/vframec.cxx deleted file mode 100644 index 9416d30..0000000 --- a/v/srcx/vframec.cxx +++ /dev/null @@ -1,196 +0,0 @@ -//=============================================================== -// vframec.cxx - a frame for holding commands -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // Motif/Athena mapping -#include -#include // our definitions -#include // a command parent -#include - -extern "C" -{ -#include - -#ifndef Athena -#include -#include -#include -#else -#include -#endif - -} - -#ifndef Athena // -------------------------------------- - -#define formWidgetC xmFormWidgetClass -#define Ncallback XmNactivateCallback -#define Nheight XmNheight -#define Nlabel XmNlabelString -#define NmappedWhenManaged XmNmappedWhenManaged -#define Nwidth XmNwidth -#define NborderWidth XmNborderWidth - -//@@ These use athena parent for now -#define Nresizable(x) // XtNresizable,x, - -#define setLabel(x,y) XmString x = XmStringCreateSimple(y); -#define freeLabel(x) XmStringFree(x); - -#else //------------------------------------------------------ - -#define formWidgetC formWidgetClass -#define NborderWidth XtNborderWidth -#define Ncallback XtNcallback -#define Nheight XtNheight -#define Nlabel XtNlabel -#define NmappedWhenManaged XtNmappedWhenManaged -#define Nwidth XtNwidth -#define Nresizable(x) XtNresizable,x, -#define setLabel(x,y) char* x = y; -#define freeLabel(x) - -#endif // ----------------------------------------------------- - - -//=====================>>> vFrameCmd::vFrameCmd <<<======================= - vFrameCmd::vFrameCmd(vCmdParent* dp, CommandObject* dc) : - vCmd(dp, dc) - { - initialize(); - } - -//=====================>>> vFrameCmd::~vFrameCmd <<<======================= - vFrameCmd::~vFrameCmd() - { - - SysDebug(Destructor,"vFrameCmd::~vFrameCmd() destructor\n") - - } - -//=====================>>> vFrameCmd::initialize <<<======================= - void vFrameCmd::initialize(void) - { - // build a button command for use in a parent window - - - SysDebug(Constructor,"vFrameCmd::vFrameCmd() constructor\n") - - CopyToLocal(); - - Widget WfHoriz = _parentWin->getWidgetFromId(dlgCmd->cRightOf); - Widget WfVert = _parentWin->getWidgetFromId(dlgCmd->cBelow); - -#ifndef Athena - int border = (dlgCmd->attrs & CA_NoBorder) ? 0 : 3; // border? -#else - int border = (dlgCmd->attrs & CA_NoBorder) ? 0 : 1; // border? -#endif - - int map = !(dlgCmd->attrs & CA_Hidden); - -#ifndef Athena - - int margin, spacing; - - if (dlgCmd->attrs & CA_NoSpace) // Tight spacing? - { - margin = 0; - spacing = 0; - } - else - { - margin = 3; - spacing = 2; - } - wBox = XtVaCreateManagedWidget( - "vFrameWrap", // name - xmFrameWidgetClass, // class - wParent, // parent - Nresizable(TRUE) - NmappedWhenManaged, map, - XmNmarginHeight,margin, - XmNmarginWidth,margin, - XmNshadowThickness,border, - XmNshadowType,XmSHADOW_ETCHED_IN, - NULL); - - wCmd = XtVaCreateManagedWidget( - "vFrame", // name - formWidgetC, // class - wBox, // parent - XmNverticalSpacing,spacing, - XmNhorizontalSpacing,spacing, - Nresizable(TRUE) - NULL); - -#else - wBox = XtVaCreateManagedWidget( - "vFrame", // name - formWidgetC, // class - wParent, // parent - Nresizable(TRUE) - NmappedWhenManaged, map, - NborderWidth, border, - NULL); -#endif - - if (WfVert != 0) - XtVaSetValues(wBox, Nbelow(WfVert) NULL); - if (WfHoriz != 0) - XtVaSetValues(wBox, NrightOf(WfHoriz) NULL); - - -#ifdef Athena - if (dlgCmd->attrs & CA_NoSpace) // Tight spacing? - { - XtVaSetValues(wBox, // the widget to set - XtNdefaultDistance,0, - NULL); - } - - XtVaSetValues(wBox, // the widget to set - XtNbackground, _vDialogBG, NULL); - - wCmd = 0; // duplicate to simplify SetCmdVal -#endif - } - -//================>>> vFrameCmd::SetCmdVal <<<============================ - void vFrameCmd::SetCmdVal(ItemVal val, ItemSetType st) - { - - SysDebug1(Misc,"vFrameCmd::SetCmdVal(val:%d)\n",val) - - if (st == Hidden) // hide or unhide - { - if (val) - { - ::XtUnmapWidget(wBox); // unmap this widget - } - else - { - ::XtMapWidget(wBox); // unmap this widget - } - } - else if (st == Value && dlgCmd->cmdType == C_ToggleFrame) // Toggle? - { - if (val) // have to hide/show me first - { - ::XtMapWidget(wBox); // unmap this widget - } - else - { - ::XtUnmapWidget(wBox); // unmap this widget - } - _parentWin->SetFrameChildren(_cmdId,val); // and now set value of childen - } - } diff --git a/v/srcx/vicon.cxx b/v/srcx/vicon.cxx deleted file mode 100644 index 50b3dc7..0000000 --- a/v/srcx/vicon.cxx +++ /dev/null @@ -1,395 +0,0 @@ -//=============================================================== -// vIcon - V icon - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include -#include -#include -#include -#define _XDisplay (theApp->display()) - - GC vIcon::_GC = 0; - GC vIcon::_insGC = 0; - -//====================>>> vIcon::vIcon <<<========================== - vIcon::vIcon(unsigned char* ic, int h, int w, int d, IconType it) - { - icon = ic; height = h; width = w; depth = d; - _pm = 0; _inspm = 0; - iType = it; - } - -//====================>>> vIcon::~vIcon <<<========================== - vIcon::~vIcon() - { - if (_pm != 0) - { - XFreePixmap(theApp->display(),_pm); - _pm = 0; - } - if (_inspm != 0) - { - XFreePixmap(theApp->display(),_inspm); - _inspm = 0; - } - } - -//====================>>> vIcon::GetXPM <<<========================== - Pixmap vIcon::GetXPM(int cmd, unsigned long pbg) VCONST - { - unsigned int r, g, b; - - if (_GC == 0) // No GC yet - { - XGCValues values; // to setup values - - values.line_style = LineSolid; // only solid lines for now - values.line_width = 1; // width 1 - values.fill_style = FillSolid; - values.function = GXcopy; - values.foreground = theApp->Xfg(); - values.background = theApp->Xbg(); - - // Make a shared GC for all pixmaps - - _GC = XtAllocateGC(theApp->vHandle(), 0, - GCForeground | GCBackground | GCFunction | GCLineStyle | - GCLineWidth | GCFillStyle , - &values, - GCForeground | GCBackground | GCFunction | GCLineStyle | // changable - GCLineWidth | GCFillStyle | GCFont, - 0); - } - - if (_pm != 0) // Pixmap already mapped? - return _pm; - - if (depth == 1) // monochrome bitmap - { - unsigned long fg, bg; - if (theApp->Xdepth() <= 1) // I don't know why , but - { // but monochrome works differently... - bg = (unsigned long) XBlackPixel(theApp->display(),0); - fg = (unsigned long) XWhitePixel(theApp->display(),0); - } - else - { - fg = (unsigned long) XBlackPixel(theApp->display(),0); -#ifdef Athena - if (cmd == 1) - bg = (unsigned long) _vDialogBG; - else if (cmd == 2) - bg = (unsigned long) _vControlFace; - else -#endif - if (cmd == 3) // supplied fg, bg - { - bg = pbg; - } - else - bg = (unsigned long) theApp->Xbg(); - } - _pm = XCreatePixmapFromBitmapData( - _XDisplay, // our display - DefaultRootWindow(_XDisplay), // a Drawable - (char*)icon, // the bitmap data - width, // width and height - height, - fg, bg, - DefaultDepth(_XDisplay,DefaultScreen(_XDisplay))); - } - else if (depth <= 8) // color icon - { - Pixel mappedColors[256]; // for mapped colors - unsigned char *from = icon; // to retrieve data - - unsigned int numColors = (unsigned int) *from++ + 1; // how many colors to map - - unsigned long bg; - if (cmd == 3) // supplied fg, bg - { - bg = pbg; // use supplied color - } - else - bg = theApp->Xbg(); // default - - for (unsigned int ix = 0 ; ix < numColors ; ++ix) // map the colors - { - r = ((unsigned int)*from++); - g = ((unsigned int)*from++); - b = ((unsigned int)*from++); - - // Now, map the RGB to a Pixmap index - - mappedColors[ix] = vXAllocColor(r,g,b); - } - - // Colors mapped, from now points to beginning of data - // First, create a pixmap to draw into - - _pm = XCreatePixmap( - _XDisplay, // our display - DefaultRootWindow(_XDisplay), // a Drawable - width, // width and height - height, - theApp->Xdepth()); // same depth as display - - // Now draw into the pixmap - XSetBackground(_XDisplay, _GC, bg); // the basics - XSetFillStyle(_XDisplay,_GC,FillSolid); - int prevPix = -1; // no previous color - unsigned int transPix = *(from + width*(height-1)); - for (int row = 0 ; row < height ; ++row) - { - for (int col = 0 ; col < width ; ++col) - { - unsigned int pix = (unsigned int)*from++; // get pixel - if (pix != prevPix) - { - if (pix == transPix) - XSetForeground(_XDisplay, _GC, bg); - else - XSetForeground(_XDisplay, _GC, mappedColors[pix]); - } - prevPix = pix; // remember last color - XDrawPoint(_XDisplay, _pm, _GC, col, row); - } - } - } - else if (depth == 24) - { - unsigned char *from = icon; // to retrieve data - Pixel Pix; - - // First, create a pixmap to draw into - - _pm = XCreatePixmap( - _XDisplay, // our display - DefaultRootWindow(_XDisplay), // a Drawable - width, // width and height - height, - theApp->Xdepth()); // same depth as display - - // Now draw into the pixmap - XSetBackground(_XDisplay, _GC, theApp->Xbg()); // the basics - XSetFillStyle(_XDisplay,_GC,FillSolid); - Pixel PrevPix = (Pixel) -1; // no previous Pixel - for (int row = 0 ; row < height ; ++row) - { - for (int col = 0 ; col < width ; ++col) - { - r = ((unsigned int)*from++); - g = ((unsigned int)*from++); - b = ((unsigned int)*from++); - - // Now, map the RGB to a Pixmap index - - Pix = vXAllocColor(r,g,b); - if (Pix != PrevPix) - { - XSetForeground(_XDisplay, _GC, Pix); - } - PrevPix = Pix; // remember last color - XDrawPoint(_XDisplay, _pm, _GC, col, row); - } - } - } - return _pm; - } - -//====================>>> vIcon::GetInsensXPM <<<========================== - Pixmap vIcon::GetInsensXPM(int cmd, unsigned long pbg) VCONST - { - unsigned int r, g, b; - - - if (_insGC == 0) // No GC yet - { - XGCValues values; // to setup values - - values.line_style = LineSolid; // only solid lines for now - values.line_width = 1; // width 1 - values.fill_style = FillSolid; - values.function = GXcopy; - values.foreground = theApp->Xfg(); - values.background = theApp->Xbg(); - - // Make a shared GC for all pixmaps - - _insGC = XtAllocateGC(theApp->vHandle(), 0, - GCForeground | GCBackground | GCFunction | GCLineStyle | - GCLineWidth | GCFillStyle , - &values, - GCForeground | GCBackground | GCFunction | GCLineStyle | // changable - GCLineWidth | GCFillStyle | GCFont , - 0); - - } - - if (_inspm != 0) // Pixmap already mapped? - return _inspm; - - if (depth == 1) // monochrome bitmap - { - unsigned long fg, bg; - if (theApp->Xdepth() <= 1) // I don't know why , but - { // but monochrome works differently... - bg = (unsigned long) XBlackPixel(theApp->display(),0); - fg = (unsigned long) XWhitePixel(theApp->display(),0); - } - else - { - fg = (unsigned long) _vDarkControlShadow; // this is insensitve -#ifdef Athena - if (cmd == 1) - bg = (unsigned long) _vDialogBG; - else if (cmd == 2) - bg = (unsigned long) _vControlFace; - else -#endif - if (cmd == 3) // supplied fg, bg - { - bg = pbg; - } - else - bg = (unsigned long) theApp->Xbg(); - } - _inspm = XCreatePixmapFromBitmapData( - _XDisplay, // our display - DefaultRootWindow(_XDisplay), // a Drawable - (char*)icon, // the bitmap data - width, // width and height - height, - fg, bg, - DefaultDepth(_XDisplay,DefaultScreen(_XDisplay))); - } - else if (depth <= 8) // color icon - { - Pixel mappedColors[256]; // for mapped colors - unsigned char *from = icon; // to retrieve data - - unsigned int numColors = (unsigned int) *from++ + 1; // how many colors to map - - unsigned long bg; - if (cmd == 3) // supplied fg, bg - { - bg = pbg; // use supplied color - } - else - bg = theApp->Xbg(); // default - - for (unsigned int ix = 0 ; ix < numColors ; ++ix) // map the colors - { - r = ((unsigned int)*from++); - g = ((unsigned int)*from++); - b = ((unsigned int)*from++); - - // Now, map the RGB to a Pixmap index - - mappedColors[ix] = vXAllocColor(r,g,b); - } - - // Colors mapped, from now points to beginning of data - // First, create a pixmap to draw into - - _inspm = XCreatePixmap( - _XDisplay, // our display - DefaultRootWindow(_XDisplay), // a Drawable - width, // width and height - height, - theApp->Xdepth()); // same depth as display - - // Now draw into the pixmap - XSetBackground(_XDisplay, _insGC, theApp->Xbg()); // the basics - XSetFillStyle(_XDisplay,_insGC,FillStippled); - int prevPix = -1; // no previous color - unsigned int transPix = *(from + width*(height-1)); - for (int row = 0 ; row < height ; ++row) - { - for (int col = 0 ; col < width ; ++col) - { - unsigned int pix = (unsigned int)*from++; // get pixel - if (pix != prevPix) - { - if (pix == transPix) - XSetForeground(_XDisplay, _insGC, bg); - else - XSetForeground(_XDisplay, _insGC, mappedColors[pix]); - } - prevPix = pix; // remember last color - XDrawPoint(_XDisplay, _inspm, _insGC, col, row); - } - } - - // now stipple - XSetForeground(_XDisplay, _insGC, (unsigned long) _vControlFace); - for (int row = 0 ; row < height ; row++) - { - int start = 0; - if ((row/2)*2 == row) - start = 1; - for (int col = start ; col < width ; col+=2) - { - XDrawPoint(_XDisplay, _inspm, _insGC, col++, row); - } - } - } - else if (depth == 24) - { - unsigned char *from = icon; // to retrieve data - Pixel Pix; - - // First, create a pixmap to draw into - - _inspm = XCreatePixmap( - _XDisplay, // our display - DefaultRootWindow(_XDisplay), // a Drawable - width, // width and height - height, - theApp->Xdepth()); // same depth as display - - // Now draw into the pixmap - XSetBackground(_XDisplay, _insGC, theApp->Xbg()); // the basics - XSetFillStyle(_XDisplay,_insGC,FillStippled); - Pixel PrevPix = (Pixel) -1; // no previous Pixel - for (int row = 0 ; row < height ; ++row) - { - for (int col = 0 ; col < width ; ++col) - { - r = ((unsigned int)*from++); - g = ((unsigned int)*from++); - b = ((unsigned int)*from++); - - // Now, map the RGB to a Pixmap index - - Pix = vXAllocColor(r,g,b); - if (Pix != PrevPix) - { - XSetForeground(_XDisplay, _insGC, Pix); - } - PrevPix = Pix; // remember last color - XDrawPoint(_XDisplay, _inspm, _insGC, col, row); - } - } - // now stipple - XSetForeground(_XDisplay, _insGC, (unsigned long) _vControlFace); - for (int row = 0 ; row < height ; row++) - { - int start = 0; - if ((row/2)*2 == row) - start = 1; - for (int col = start ; col < width ; col+=2) - { - XDrawPoint(_XDisplay, _inspm, _insGC, col++, row); - } - } - } - return _inspm; - } diff --git a/v/srcx/vlabelc.cxx b/v/srcx/vlabelc.cxx deleted file mode 100644 index 50cab2e..0000000 --- a/v/srcx/vlabelc.cxx +++ /dev/null @@ -1,263 +0,0 @@ -//=============================================================== -// vlabelc.cxx - label Cmd -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // Motif/Athena mapping -#include // our definitions -#include // a command parent -#include // for icons -#include - -#undef USE3D // doesn't work yet... - -extern "C" -{ - -#ifndef Athena -#include -#include -#else -#include -#include -#endif - -#ifdef USE3D -#include -#endif -} - -#ifndef Athena - -#define lblWidgetClass xmLabelWidgetClass -#define NborderWidth XmNborderWidth -#define Ncallback XmNactivateCallback -#define Nheight XmNheight -#define Nlabel XmNlabelString -#define NmappedWhenManaged XmNmappedWhenManaged -#define Nwidth XmNwidth -//@@ These use athena parent for now -#define Nresizable(x) // XtNresizable,x, - -#define setLabel(x,y) XmString x = XmStringCreateSimple(y); -#define freeLabel(x) XmStringFree(x); - -#else //------------------------------------------------------ - -#define lblWidgetClass labelWidgetClass -#define NborderWidth XtNborderWidth -#define Ncallback XtNcallback -#define Nheight XtNheight -#define Nlabel XtNlabel -#define NmappedWhenManaged XtNmappedWhenManaged -#define Nwidth XtNwidth -#define Nresizable(x) XtNresizable,x, -#define setLabel(x,y) VCONST char* x = y; -#define freeLabel(x) - -#endif // ----------------------------------------------------- - -//=====================>>> vLabelCmd::vLabelCmd <<<======================= - vLabelCmd::vLabelCmd(vCmdParent* dp, CommandObject* dc): - vCmd(dp, dc) - { - initialize(); - } - -//=====================>>> vLabelCmd::~vLabelCmd <<<======================= - vLabelCmd::~vLabelCmd() - { - - SysDebug(Destructor,"vLabelCmd::~vLabelCmd() destructor\n") - } - -//=====================>>> vLabelCmd::initialize <<<======================= - void vLabelCmd::initialize(void) - { - // build a button command for use in a parent window - - - SysDebug(Constructor,"vLabelCmd::vLabelCmd() constructor\n") - - CopyToLocal(); // make local copies - - Widget WfHoriz = _parentWin->getWidgetFromId(dlgCmd->cRightOf); - Widget WfVert = _parentWin->getWidgetFromId(dlgCmd->cBelow); - - Pixmap pixmap = 0; // normally, no pixmap - - int map = !(dlgCmd->attrs & CA_Hidden); - - if (dlgCmd->cmdType == C_Icon && _itemList != 0) // icon - { - vIcon* ip = (vIcon *) _itemList; // to access bitmap - -#ifndef Athena - unsigned long wbg; - XtVaGetValues(wParent, XmNbackground, &wbg, 0); // get bg - - pixmap = ip->GetXPM(3, wbg); - - wCmd = XtVaCreateManagedWidget( - "vLabel", // name - lblWidgetClass, // class - wParent, // parent - XmNlabelType, XmPIXMAP, - XmNlabelPixmap, pixmap, - XmNmarginTop,0, - XmNmarginBottom,0, - XmNmarginLeft,0, - XmNmarginRight,0, - NborderWidth,0, // label only, no border - Nresizable(TRUE) - NmappedWhenManaged, map, - NULL); -#else - - pixmap = ip->GetXPM(1); // get the pixmap - - wCmd = XtVaCreateManagedWidget( - "vLabel", // name - lblWidgetClass, // class - wParent, // parent - XtNbitmap, pixmap, // the pixmap - XtNinternalWidth,0, - XtNinternalHeight,0, - XtNbackground, _vDialogBG, - NborderWidth,0, // label only, no border - Nresizable(TRUE) - NmappedWhenManaged, map, - NULL); -#endif - - if (WfVert != 0) - XtVaSetValues(wCmd, Nbelow(WfVert) NULL); - if (WfHoriz != 0) - XtVaSetValues(wCmd, NrightOf(WfHoriz) NULL); - } - else if (dlgCmd->cmdType == C_Blank) - { - // a blank is always unmapped - setLabel(tmp,_title) - - wCmd = XtVaCreateManagedWidget( - "vLabel", // name - lblWidgetClass, // class - wParent, // parent - Nlabel, tmp, // label - NborderWidth,0, // label only, no border - NmappedWhenManaged,FALSE, // just the space! -#ifndef Athena - XmNmarginTop,2, - XmNmarginBottom,2, - XmNmarginLeft,2, - XmNmarginRight,2, -#else - XtNinternalWidth,2, - XtNinternalHeight,3, // adjust to make same height as button -#endif - Nresizable(TRUE) - NULL); - if (WfVert != 0) - XtVaSetValues(wCmd, Nbelow(WfVert) NULL); - if (WfHoriz != 0) - XtVaSetValues(wCmd, NrightOf(WfHoriz) NULL); - freeLabel(tmp) - } - else // (dlgCmd->cmdType == C_Label) - { - int borderW = (dlgCmd->cmdType == C_BoxedLabel) ? 1 : 0; - - setLabel(tmp,_title) -#ifdef USE3D - if (dlgCmd->cmdType == C_BoxedLabel) - { - wCmd = XtVaCreateManagedWidget( - "vLabel", // name - label3dWidgetClass, // class - wParent, // parent - XtNlabel, tmp, // label - "shadowWidth",2, // border width -// XtNinternalWidth,2, -// XtNinternalHeight,3, // adjust to make same height as button - Nresizable(TRUE) - NmappedWhenManaged, map, - NULL); - if (WfVert != 0) - XtVaSetValues(wCmd, Nbelow(WfVert) NULL); - if (WfHoriz != 0) - XtVaSetValues(wCmd, NrightOf(WfHoriz) NULL); - } - else -#endif - wCmd = XtVaCreateManagedWidget( - "vLabel", // name - lblWidgetClass, // class - wParent, // parent - Nlabel, tmp, // label - NborderWidth,borderW, // border width -#ifndef Athena - XmNmarginTop,2, - XmNmarginBottom,2, - XmNmarginLeft,2, - XmNmarginRight,2, -#else - XtNinternalWidth,2, - XtNinternalHeight,3, // adjust to make same height as button -#endif - Nresizable(TRUE) - NmappedWhenManaged, map, - NULL); - - if (WfVert != 0) - XtVaSetValues(wCmd, Nbelow(WfVert) NULL); - if (WfHoriz != 0) - XtVaSetValues(wCmd, NrightOf(WfHoriz) NULL); - - freeLabel(tmp) - } -#ifdef Athena - XtVaSetValues(wCmd, // the widget to set - XtNbackground, _vDialogBG, NULL); -#endif - - wBox = 0; // no Box, but make copy for placement - - } - -//================>>> vLabelCmd::SetCmdVal <<<============================ - void vLabelCmd::SetCmdVal(ItemVal val, ItemSetType st) - { - - if (st == Hidden) // hide or unhide - { - if (val) - { - XtUnmapWidget(wCmd); // unmap this widget - } - else - { - XtMapWidget(wCmd); // unmap this widget - } - } - } - -//================>>> vLabelCmd::SetCmdStr <<<============================ - void vLabelCmd::SetCmdStr(VCONST char* str) - { - - SysDebug1(Misc,"vLabelCmd::SetCmdStr(str:%s)\n",str) - - _title = str; - setLabel(tmp,str) - XtVaSetValues(wCmd, // the widget to set - Nlabel, tmp, // label - NULL); - freeLabel(tmp) - } diff --git a/v/srcx/vlistc.cxx b/v/srcx/vlistc.cxx deleted file mode 100644 index 6feb0d2..0000000 --- a/v/srcx/vlistc.cxx +++ /dev/null @@ -1,683 +0,0 @@ -//=============================================================== -// vlistc.cxx - ListCmd -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // Motif/Athena mapping -#include // our definitions -#include // a command parent -#include -#include - -extern "C" -{ -#include - -#ifndef Athena -#include -#include - -#else // ### ATHENA - -#include -#ifndef DONTUSEx3D -#include -#define sbWidgetClass scrollbar3dWidgetClass -#define sbThickness 15 -#else -#include -#define sbWidgetClass scrollbarWidgetClass -#define sbThickness 10 -#endif -#include - -#endif - -} - -#define DefaultWidth 32 - -#ifndef Athena -#define Nsensitive XmNsensitive -#else -#define Nsensitive XtNsensitive -#endif - - static char* EmptyItem = ""; // null item for short lists - -//=================>>> vListCmd::vListCmd <<<======================= - vListCmd::vListCmd(vCmdParent* dp, CommandObject* dc) : - vCmd(dp, dc) - { - // Create bitmaps if need to - -#ifdef Athena - _fscale = 0.0; - _scale = 0; -#endif - _maxWidth = DefaultWidth; - initialize(); // and initialize - } - -//=======================>>> vListCmd::~vListCmd <<<======================= - vListCmd::~vListCmd() - { - - SysDebug(Constructor,"vListCmd::~vListCmd() Destructor\n") -#ifndef Athena - // now, free the XmString list we created - for (int iy = 0 ; iy < _listItems ; ++iy) - XmStringFree(_strList[iy]); - XtFree((char*)_strList); -#endif - - } - -//=====================>>> vListCmd::initialize <<<======================= - void vListCmd::initialize(void) - { - - static char empty[] = " "; -#ifdef Athena - XtCallbackRec scrollProcList[] = - { - { CScrollProcCB, this }, - { (XtCallbackProc) 0, (XtPointer) 0} - }; - - XtCallbackRec jumpProcList[] = - { - { CJumpProcCB, this }, - { (XtCallbackProc) 0, (XtPointer) 0} - }; -#endif - - Dimension listHeight; - - SysDebug(Constructor,"vListCmd::vListCmd() constructor\n") - - CopyToLocal(); // make local copies - - // First, setup the list - - _listRows = 8; - if (dlgCmd->attrs & CA_Size) // specifying size - { - if (dlgCmd->size > 0 && dlgCmd->size <= MAX_LIST) - _listRows = dlgCmd->size; - } - -#ifdef Athena - for (int ix = 0 ; ix < _listRows ; ++ix) - _workList[ix] = 0; -#endif - - SetupList(); - - // determine positions - - Widget WfHoriz = _parentWin->getWidgetFromId(dlgCmd->cRightOf); - Widget WfVert = _parentWin->getWidgetFromId(dlgCmd->cBelow); - - // We will put a box around the list and the scrollbar in Athena - - int map = !(dlgCmd->attrs & CA_Hidden); - - if (dlgCmd->attrs & CA_ListWidth && dlgCmd->retVal > 0) // Specifying width - _maxWidth = dlgCmd->retVal; - else if (dlgCmd->attrs & CA_Large) - { - if (_maxWidth > DefaultWidth) - _maxWidth = (_maxWidth * 3) / 2; // 150% - else - _maxWidth = DefaultWidth * 2; - } - -#ifndef Athena - - wBox = XtVaCreateManagedWidget( - "vListFrame", // name - xmFormWidgetClass, // class - wParent, // parent - XmNborderWidth,0, // no border around list and scrollbar - XtNmappedWhenManaged, map, - NULL); - - // convert list to XmStrings - - if (_numItems == 0) // gotta fake it out for initial - { - ++_numItems; - _strList = (XmStringTable) XtMalloc((_numItems+1) * sizeof (XmString*)); - _listItems = _numItems; - _strList[0] = XmStringCreateLocalized(empty); - _strList[_numItems] = 0; // 1.24 - } - else - { - _strList = (XmStringTable) XtMalloc((_numItems+1) * sizeof (XmString*)); - _listItems = _numItems; - for (int ix = 0 ; ix < _numItems ; ++ix) - _strList[ix] = XmStringCreateLocalized(_fullList[ix]); - _strList[_numItems] = 0; // 1.24 - } - - // Create a scrolled list - // We need to use the Arg list to set values because some - // can't be reset after the list is created. - - Arg args[12]; - int argc; - argc = 0; - XtSetArg(args[argc], XmNscrollBarDisplayPolicy,XmSTATIC); argc++; - XtSetArg(args[argc], XmNvisualPolicy,XmCONSTANT); argc++; - XtSetArg(args[argc], XmNscrollingPolicy,XmAUTOMATIC); argc++; - XtSetArg(args[argc], XmNitems, (XmString)_strList); argc++; - XtSetArg(args[argc], XmNitemCount, _listItems); argc++; - XtSetArg(args[argc], XmNwidth, _maxWidth + 8); argc++; - XtSetArg(args[argc], XmNvisibleItemCount,_listRows); argc++; - XtSetArg(args[argc], XmNlistSizePolicy,XmCONSTANT); argc++; - - wCmd = XmCreateScrolledList(wBox,"vList",args,argc); - - // add callback for action - XtAddCallback(wCmd, XmNsingleSelectionCallback, CListCmdCB, (XtPointer)this); - XtAddCallback(wCmd, XmNbrowseSelectionCallback, CListCmdCB, (XtPointer)this); - - // place in Frame - - if (WfVert != 0) - XtVaSetValues(wBox, Nbelow(WfVert) NULL); - if (WfHoriz != 0) - XtVaSetValues(wBox, NrightOf(WfHoriz) NULL); - - XtManageChild(wCmd); // have to manage the list child! - -#else // ################ ATHENA - - wBox = XtVaCreateManagedWidget( - "vListFrame", // name - formWidgetClass, // class - wParent, // parent - XtNorientation, XtEhorizontal, - XtNborderWidth,1, // border around list and scrollbar - XtNdefaultDistance, 1, - XtNresizable, True, - XtNmappedWhenManaged, map, - XtNbackground, _vControlFace, - NULL); - - if (WfVert != 0) - XtVaSetValues(wBox, Nbelow(WfVert) NULL); - if (WfHoriz != 0) - XtVaSetValues(wBox, NrightOf(WfHoriz) NULL); - - wCmd = XtVaCreateManagedWidget( - "vList", // name - listWidgetClass, // class - wBox, // parent - XtNdefaultColumns, 1, // 1 column - XtNforceColumns, True, // force columns - XtNlist, _workList, // the work list - XtNlongest, _maxWidth, // widest string - XtNnumberStrings, _listRows, // _listRows strings - XtNverticalList, TRUE, // we are a vertical list - XtNrowSpacing, 1, - XtNresizable, True, - NULL); - - // add callback for action - XtAddCallback(wCmd, XtNcallback, CListCmdCB, (XtPointer)this); - - // Create the scroll bar - - XtVaGetValues(wCmd, XtNheight, &listHeight, NULL); - - Dimension min_thumb = 10; - - _wScroll = XtVaCreateManagedWidget( - "vListScroll", // name - sbWidgetClass, // class - wBox, // parent - XtNscrollProc, scrollProcList, // callback for scrolling - XtNjumpProc, jumpProcList, // callback for scrolling - XtNminimumThumb,min_thumb, - XtNthickness, sbThickness, // how wide - XtNlength,listHeight, // high as list - XtNfromHoriz, wCmd, - XtNresizable, TRUE, -#ifndef DONTUSEx3D - XtNbackground, _vControlFace, - XtNscrollbar3dBackground, _vControlBG, -#endif - NULL); - - SetScroll(_ScrlShown, _ScrlTop); - -#endif // End of Motif/Athena sections - - - // Need to set to insensitive if it is set insensitive - if (!_Sensitive) - { - XtVaSetValues(wCmd, // the widget to set - Nsensitive, 0, // change to insensitive - NULL); -#ifdef Athena - XtVaSetValues(_wScroll, // the widget to set - Nsensitive, 0, // change to insensitive - NULL); -#endif - } - - } - -//==================>>> vListCmd::GetCmdValue <<<========================= - int vListCmd::GetCmdValue(ItemVal id) VCONST - { - if (id != _cmdId) - return -1; - return _curSelection; - } - -//=====================>>> vListCmd::SetCmdVal <<<========================= - void vListCmd::SetCmdVal(ItemVal val, ItemSetType st) - { - - SysDebug2(Misc,"vListCmd::SetCmdVal(val:%d, type:%d)\n",val,st) - - static char empty[] = " "; - - if (st == ChangeList || st == ChangeListPtr) - { - if (st == ChangeListPtr) - _itemList = dlgCmd->itemList; - - int oldMax = _maxWidth; // track current max width - - SetupList(); // resetup the list - - if (oldMax > _maxWidth) - _maxWidth = oldMax; // don't let it get narrower - -#ifndef Athena - XmListDeleteAllItems(wCmd); // clear the list - - // cleanup old copy of the list - if (_strList != 0) - { - // now, free the XmString list we created - for (int iy = 0 ; iy < _listItems ; ++iy) - XmStringFree(_strList[iy]); - XtFree((char*)_strList); - } - - // reallocate - _strList = (XmStringTable) XtMalloc((_numItems+1) * sizeof (XmString*)); - - for (int ix = 0 ; ix < _numItems ; ++ix) - { - if (!*_fullList[ix]) - _strList[ix] = XmStringCreateLocalized(empty); - else - _strList[ix] = XmStringCreateLocalized(_fullList[ix]); - } - _strList[_numItems] = 0; // 1.24 - _listItems = _numItems; - -//1.24 XmListAddItemsUnselected(wCmd, _strList, _numItems, 1); // add the new list - - if (_numItems > 0) - XtVaSetValues(wCmd, - XmNitemCount, _numItems, // 1.24 - XmNitems, _strList, // 1.24 - XmNwidth, _maxWidth+20, // widest string - NULL); -#else - // turn them all off! - XawListChange(wCmd, _workList, _listRows, _maxWidth, True); - SetScroll(_ScrlShown, _ScrlTop); -#endif - SetCmdVal(val,Value); - return; - - } - else if (st == Hidden) // hide or unhide - { - if (val) - { - XtUnmapWidget(wBox); // unmap this widget - } - else - { - XtMapWidget(wBox); // unmap this widget - } - } - else if (st == Value) - { - if (val >= _numItems ) - return; - - if (val < 0) // unselect - { - _curSelection = -1; - // turn them all off! -#ifndef Athena - XmListDeselectAllItems(wCmd); -#else - XawListChange(wCmd, _workList, _listRows, _maxWidth, True); -#endif - return; - } - - // Now set appropriate _curSelection, scroll, and highlight - - _curSelection = val; // change the current value - - // if the selection is already on the screen, then highlight it - // See if the currently selected item is on the list, and rehighlight - -#ifndef Athena - int newSel = _curSelection; - if (newSel >= 0 && newSel < _listRows) - { - XmListDeselectAllItems(wCmd); - XmListSelectPos(wCmd, newSel+1, 0); - } - // Need to set explicitly if not yet realized - if (!XtIsRealized(wCmd)) - XtVaSetValues(wCmd, - XmNwidth, _maxWidth+20, // widest string - NULL); - -#else // ##### ATHENA - - int newSel = _curSelection - _workMapsTo; - - if (newSel >= 0 && newSel < _listRows) - { - XawListChange(wCmd, _workList, _listRows, _maxWidth, True); - XawListHighlight(wCmd, newSel); - } - else // have to scroll - { - DoScroll(_curSelection - _workMapsTo); // change what is displayed - } - - // Need to set explicitly if not yet realized - if (!XtIsRealized(wCmd)) - { - XtVaSetValues(wCmd, - XtNlongest, _maxWidth, // widest string - NULL); - } -#endif - } - else if (st == Sensitive) - { - _Sensitive = val; -#ifndef Athena - XtVaSetValues(wBox, // the widget to set - Nsensitive, val, // change to val - NULL); -#else - XtVaSetValues(wCmd, // the widget to set - Nsensitive, val, // change to val - NULL); - XtVaSetValues(_wScroll, // the widget to set - Nsensitive, val, // change to val - NULL); -#endif - } - } - -//====================>>> vListCmd::ListCmdCB <<<======================= - void vListCmd::ListCmdCB(int index) - { - _curSelection = index + _workMapsTo; // change the current selection - - if (_curSelection >= _numItems ) - _curSelection = -1; - - if (!(dlgCmd->attrs & CA_NoNotify)) // Notify on each selection? - _parentWin->ProcessCmd(_cmdId, _curSelection, dlgCmd->cmdType); - } - -#ifdef Athena -//====================>>> vListCmd::DoScroll <<<========================== - void vListCmd::DoScroll(int cnt) - { - // Scroll the list by cnt lines - - int newTop; - int maxMap = _numItems - _listRows; - - if (_numItems <= _listRows) // not big enough to scroll - return; - - newTop = _workMapsTo + cnt; // where we would go - if (cnt > 0) // scrolling up - { - if (_workMapsTo == maxMap) // already at bottom - return; - _workMapsTo = (newTop > maxMap) ? maxMap : newTop; - } - else - { - if (_workMapsTo == 0) // already at top - return; - _workMapsTo = (newTop < 0) ? 0 : newTop; - } - - // Now redraw list - for (int ix = 0 ; ix < _listRows ; ++ix) - { - _workList[ix] = _fullList[ix + _workMapsTo]; - } - - XawListChange(wCmd, _workList, _listRows, _maxWidth, True); - - // See if the currently selected item is on the list, and rehighlight - int newSel = _curSelection - _workMapsTo; - - if (newSel >= 0 && newSel < _listRows) - { - XawListHighlight(wCmd, newSel); - } - // _workMapsTo varies from 0 to _numItems - _listRows - // _ScrlTop varies from 0 to 100 - _ScrlShown - - // Use _scale to transform the current _workMapsTo to a _ScrlTop - - if (_workMapsTo == (_numItems - _listRows)) // Account for integer scaling - _ScrlTop = 100 - _ScrlShown; - - if (_fscale != 0.0) - _ScrlTop = (int)((float)_workMapsTo * _fscale); - else if (_scale != 0) - _ScrlTop = _workMapsTo * _scale; - else - _ScrlTop = (int) ((float)_workMapsTo * _scale); - - SetScroll(_ScrlShown, _ScrlTop); - } - -//====================>>> vListCmd::JumpProcCB <<<======================= - void vListCmd::JumpProcCB(int percent) - { - int shown = _ScrlShown; - int min_top; - int newMap; - - min_top = 100 - shown; - - if (percent > min_top) // have to fix it - { - SetScroll(shown, min_top); - percent = min_top; - } - - // See if we have changed anything - if (_fscale != 0.0) - { - newMap = (int)((float)percent / _fscale) + 1; - if (newMap == 1) // Kludge to get to 0 - newMap = 0; - } - else if (_scale == 0) // nothing to change - { - return; - } - else - newMap = (int)((float)percent / _scale); - - if (newMap != _workMapsTo) // we've changed the screen - { - DoScroll(newMap - _workMapsTo); // change what is displayed - } - } - -//====================>>> vListCmd::SetScroll <<<======================= - void vListCmd::SetScroll(int Shown, int Top) - { - Arg args[3]; // Used to pass float value - - union - { - XtArgVal arg_value; - float float_value; - } shown_value, top_value; - - shown_value.float_value = float (Shown / 100.0); - top_value.float_value = float (Top / 100.0); - - if (sizeof (float) > sizeof (XtArgVal)) - { - XtSetArg(args[0], XtNtopOfThumb, &top_value); - XtSetArg(args[1], XtNshown, &shown_value); - } - else - { - XtSetArg(args[0], XtNtopOfThumb, top_value.arg_value); - XtSetArg(args[1], XtNshown, shown_value.arg_value); - } - - XtSetValues(_wScroll, args, 2); // change it! - } - -//====================>>> vListCmd::ScrollProcCB <<<======================= - void vListCmd::ScrollProcCB(int position) - { - if (position > 0) // scroll list up one line - DoScroll(1); - else - DoScroll(-1); // scroll list down one line - - } -#endif // Athena scrolling stuff - -//====================>>> vListCmd::SetupList <<<======================= - void vListCmd::SetupList(void) - { - // Set up the list for use - - int width, len; - - // First, count how many items are in the supplied list - - _workMapsTo = 0; - _curSelection = -1; - - _fullList = (char**)_itemList; // list - - for ( _numItems = 0 ; _fullList && _fullList[_numItems] != 0 ; ++_numItems) - { -#ifdef Athena - if (_numItems < _listRows) // copy only first _listRows - { - _workList[_numItems] = _fullList[_numItems]; - } -#endif - - len = strlen(_fullList[_numItems]); // strlen - width = XTextWidth(theApp->_XDefaultFont, - _fullList[_numItems], len); - if (width > _maxWidth) - _maxWidth = width; // track largest so far - } - -#ifdef Athena - // Note that at this point _numItems is how many items are - // in the user supplied list. We can use this number to null - // out the rest of the displayed list. - if (_numItems < _listRows) - { - for (int ix = _numItems ; ix < _listRows ; ++ix ) - { - _workList[ix] = EmptyItem; - } - } - - // Now set the scrollbar size limits - if (_numItems > _listRows) - { - _ScrlShown = (_listRows * 100) / _numItems; - } - else - _ScrlShown = 100; - - if (_numItems > _listRows) - { - _fscale = 0.0; - _scale = (100 - _ScrlShown) / (_numItems - _listRows); - if (_scale == 0) - { - _fscale = ((100. - (float)_ScrlShown) / ((float)_numItems - (float)_listRows)); - } - } - else - _scale = 0; // will leave top at 0 - - _ScrlTop = 0; -#endif - - } - -extern "C" -{ -//============================>>> CListCmdCB <<<============================= - void CListCmdCB(Widget w, XtPointer This, XtPointer lr) - { -#ifndef Athena - // need to adjust Motif's indexing from 1 to our indexing from 0 - XmListCallbackStruct* xml = (XmListCallbackStruct*) lr; - ((vListCmd*)This)->ListCmdCB(xml->item_position - 1); -#else - ((vListCmd*)This)->ListCmdCB(((XawListReturnStruct*)lr)->list_index); -#endif - } - -#ifdef Athena -//============================>>> CJumpProcCB <<<============================= - void CJumpProcCB(Widget w, XtPointer This, XtPointer pc_ptr) - { - - float percent = *(float*)pc_ptr; // get the percent back - - ((vListCmd*)This)->JumpProcCB((int)(percent*100.)); - } - -//============================>>> CScollProcCB <<<============================= - void CScrollProcCB(Widget w, XtPointer This, XtPointer position) - { - int pos = (int)position; - ((vListCmd*)This)->ScrollProcCB(pos); - } -#endif // Athena only -} diff --git a/v/srcx/vmemdc.cxx b/v/srcx/vmemdc.cxx deleted file mode 100644 index 1ae4cf4..0000000 --- a/v/srcx/vmemdc.cxx +++ /dev/null @@ -1,159 +0,0 @@ -//=============================================================== -// vMemoryDC - a memory drawing canvas -// -// Copyright (C) 1995,1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include -#include - -//================>>> vMemoryDC::vMemoryDC <<<======================== - vMemoryDC::vMemoryDC(int width, int height) - { - XColor fg; - XColor bg; - - _physHeight = height; // V 1.15a - _physWidth = width; - - SysDebug(Constructor,"vMemoryDC::vMemoryDC() constructor\n") - - _GC = _XorGC = 0; - - _GCFont = - _font = theApp->GetDefaultFont(); // get the default font - - _XDisplay = theApp->display(); - - if (_physWidth == 0) - _physWidth = theApp->DefaultWidth(); - if (_physHeight == 0) - _physHeight = theApp->DefaultHeight(); - - // Create the Pixmap to draw into - - _pixmap = XCreatePixmap(_XDisplay, theApp->xWindow(), - _physWidth, _physHeight, theApp->Xdepth()); - - if (_pixmap == 0) - return; - - _GC = makeGC(); // make a normal GC to use - _XorGC = makeXorGC(); // make a GC to use - - _pen.SetPenToPixel(_canvasFG); - _brush.SetBrushToPixel(_canvasFG); - - SetPen(_pen); - SetBrush(_brush); - - } - -//================>>> vMemoryDC::~vMemoryDC <<<======================== - vMemoryDC::~vMemoryDC() - { - SysDebug(Destructor,"vMemoryDC::~vMemoryDC() destructor\n") - - if (_XorGC) // Free the GCs - XFreeGC(_XDisplay, _XorGC); - if (_GC) - XFreeGC(_XDisplay, _GC); - if (_pixmap != 0) - XFreePixmap(_XDisplay, _pixmap); // free the pixmap - - } - -//=====================>>> vMemoryDC::GetDrawable <<<====================== - Drawable vMemoryDC::GetDrawable() VCONST - { - return (Drawable) _pixmap; - } - -//=====================>>> vMemoryDC::Clear <<<========================== - void vMemoryDC::Clear(void) - { - // Clear by setting to background color - XSetForeground(_XDisplay, _GC, _canvasBG); - XFillRectangle(_XDisplay, _pixmap, _GC, 0,0, _physWidth, _physHeight); - } - -//=====================>>> vMemoryDC::makeGC <<<========================= - GC vMemoryDC::makeGC() - { - // This one gets a default GC to used for the base canvas - - GC gc; // local copy - XGCValues values; // to setup values - Pixel fg, bg; - - int n = 0; - - // set colors according to type of canvas - - _canvasFG = theApp->Xfg(); - _canvasBG = theApp->Xbg(); - - - values.line_style = LineSolid; // only solid lines for now - values.line_width = 1; // width 1 - values.fill_style = FillSolid; - values.function = GXcopy; - values.foreground = _canvasFG; - values.background = _canvasBG; - - // This not a shared GC for memory canvases. - - gc = XCreateGC(_XDisplay, GetDrawable(), - GCForeground | GCBackground | GCFunction | GCLineStyle | - GCLineWidth | GCFillStyle , - &values); - - // set the font - - // Be sure the font is loaded - _font.LoadFont(); - - XSetFont(theApp->display(), gc, _font.GetXFont()->fid); - - return gc; - } - -//=====================>>> vMemoryDC::makeXorGC <<<========================== - GC vMemoryDC::makeXorGC() - { - // This one gets a default GC to used for the base canvas - - GC gc; // local copy - XGCValues values; // to setup values - - int n = 0; - - // set colors according to type of canvas - - values.line_width = 1; // width 1 - values.function = GXxor; - - if (_canvasFG == 0) - values.foreground = ~0; // force black - else - values.foreground = _canvasFG; - - // This not a shared GC for memory canvases. - - gc = XCreateGC(_XDisplay, GetDrawable(), - GCForeground | GCFunction | GCLineWidth, - &values); - - return gc; - } - -//================>>> vMemoryDC::SetBackground <<<========================== - void vMemoryDC::SetBackground(VCONST vColor& color) - { - vXDC::SetBackground(color); - } diff --git a/v/srcx/vmenu.cxx b/v/srcx/vmenu.cxx deleted file mode 100644 index 2351c18..0000000 --- a/v/srcx/vmenu.cxx +++ /dev/null @@ -1,814 +0,0 @@ -//=============================================================== -// vMenu.cxx - vMenuPane class functions - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // our header -#include - -extern "C" -{ -#include -#include - -#ifndef Athena -#include -#include -#include -#include -#define setLabel(x,y) XmString x = XmStringCreateLocalized(y); -#define freeLabel(x) XmStringFree(x); -#define Ncallback XmNactivateCallback -#define Nsensitive XmNsensitive -#define Nlabel XmNlabelString - -#else // ATHENA - -#include -#include -#include -#include -#include - -#define setLabel(x,y) char* x = y; -#define freeLabel(x) -#define Ncallback XtNcallback -#define Nsensitive XtNsensitive -#define Nlabel XtNlabel - -#endif - -} - -#include // we need access to vcmdwin - -#include - -// Define static data of the class - -#define menux_width 9 -#define menux_height 9 -static char menux_bits[] = { - 0xff, 0x01, 0x83, 0x01, 0x45, 0x01, 0x29, 0x01, 0x11, 0x01, 0x29, 0x01, - 0x45, 0x01, 0x83, 0x01, 0xff, 0x01}; -static Pixmap menux_bitmap = 0; // the check for menus - -#define menuclr_width 9 -#define menuclr_height 9 -static char menuclr_bits[] = { - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; -static Pixmap menuclr_bitmap = 0; // the no-check for menus - -#define rtarrow_width 9 -#define rtarrow_height 9 -static char rtarrow_bits[] = { - 0x03, 0x00, 0x0f, 0x00, 0x3f, 0x00, 0xff, 0x00, 0xff, 0x01, 0xff, 0x00, - 0x3f, 0x00, 0x0f, 0x00, 0x03, 0x00}; -static Pixmap rtarrow_bitmap = 0; // right arrow for submenus - - -static void subMenuAction(Widget, XEvent *, String *, Cardinal *); - -#ifdef Athena -static XtActionsRec submenu_action = { "popupSubmenu", - (XtActionProc)subMenuAction }; -static XtTranslations SMtrans = 0, SMtrans2 = 0; -#endif - -static char curLbl[100]; // for fixed labels -static char _Mnemonic; - -//==================>>> vMenuPane::vMenuPane <<<=========================== - vMenuPane::vMenuPane(VCONST vMenu* menu) : vPane(P_Menu) - { - int i; - - // set up menus ----------------------------------------------- - - SysDebug(Constructor,"vMenuPane::vMenuPane() constructor\n") - - - _nextMenuButton = 0; // no menus defined so far - - for (i = 0 ; i < MAX_MENU_BUTTONS ; ++i) - { - _mb[i].label = 0; // null out menu button array - _mb[i].XMenuButton = 0; - _mb[i].SubMenu = 0; - } - - // copy the menus as defined to our array - - for (i = 0 ; i < MAX_MENU_BUTTONS && &menu[i] != 0 && menu[i].label; ++i) - { - _mb[i].label = menu[i].label; - _mb[i].SubMenu = menu[i].SubMenu; - } - _nextSubMenu = // we will start submenus here - _nextMenuButton = i; // this many menus defined - - } - -//==================>>> vMenuPane::vMenuPane <<<=========================== - vMenuPane::vMenuPane(const vMenuPane& m) : vPane(m) - { - - vSysError("V Semantics do not allow copy constructors."); - } - -//====================>>> vMenuPane::~vMenuPane <<<======================= - vMenuPane::~vMenuPane() // destructor - { - - SysDebug(Destructor,"vMenuPane::~vMenuPane() destructor\n") - - for (int i = 0 ; i < _nextSubMenu ; ++i) // all menus - { - delete _mb[i].mInfo; // free the space - } - - } - -//======================>>> vMenuPane::fixLabel <<<======================== - void vMenuPane::fixLabel(VCONST char* lbl, VCONST char* key, - int isMainMenu) VCONST - { - // copy label to global curLbl - - VCONST char* cp; - int ix = 0; - - _Mnemonic = 0; - -#ifndef Athena - if (!isMainMenu) - { - curLbl[0] = ' '; curLbl[1] = ' '; ix = 2; - } -#endif - for (cp = lbl ; *cp && ix < 99 ; ++cp) // Scan label - { - if (*cp != '&') - { - curLbl[ix++] = *cp; - } - else - _Mnemonic = *(cp+1); - } - -#ifdef Athena // ATHENA ONLY - if (key && *key) - { - curLbl[ix++] = ' '; curLbl[ix++] = ' '; curLbl[ix++] = '<'; - for (cp = key ; *cp && ix < 99 ; ++cp) - { - if (*cp != '&') - { - curLbl[ix++] = *cp; - } - } - curLbl[ix++] = '>'; - } -#endif - - curLbl[ix] = 0; // finish off - } - -//======================>>> vMenuPane::doAddMenu <<<======================== - void vMenuPane::doAddMenu(int id, Widget parent) - { - // create a button on the menu button bar - - - fixLabel(_mb[id].label,0,1); // copy the label - setLabel(tmp,curLbl); - -#ifndef Athena - - // Motif does things in the reverse order of Athena -- - // create a menu popup off the menubar, then add - // a cascade buttong to that - - if (parent == 0) - { - _mb[id].XPopUp = - XmCreatePulldownMenu(_baseW,"pulldown",0,0); -//# XtManageChild(_mb[id].XPopUp); - } - else - { - _mb[id].XPopUp = parent; // a submenu - } - - // Create the cascade button - - if (parent == 0) - { - _mb[id].XMenuButton = XtVaCreateManagedWidget( - "vMenuButton", // name for widget - xmCascadeButtonWidgetClass, // widget class - _baseW, // parent widget - Nlabel, tmp, // display name - XmNsubMenuId,_mb[id].XPopUp, - XmNmnemonic, _Mnemonic, - NULL); // argument list - } - else - { - _mb[id].XMenuButton = parent; // a submenu - } - -#else - - if (parent == 0) // adding a top level menu - { - _mb[id].XMenuButton = XtVaCreateManagedWidget( - "vMenuButton", // name for widget - menuButtonWidgetClass, // widget class - _baseW, // parent widget - XtNlabel, tmp, // display name - XtNmenuName, _mb[id].label, - XtNbackground, _vMenuBarBG, - XtNborderWidth,0, // label only, no border - NULL); // argument list - } - else - { - _mb[id].XMenuButton = parent; // a submenu - } - - // Create the Popup Shell needed for this menu - if (parent == 0) - { - _mb[id].XPopUp = XtVaCreatePopupShell( - _mb[id].label, - simpleMenuWidgetClass, // menu - _mb[id].XMenuButton, // parent - XtNbackground, _vMenuBarBG, - NULL); - } - else - { - _mb[id].XPopUp = XtVaCreatePopupShell( - _mb[id].label, // name - simpleMenuWidgetClass, // menu - _mb[id].XMenuButton, // parent - XtNtranslations, SMtrans2, // need these to work right - XtNbackground, _vMenuBarBG, - NULL); - } -#endif - - freeLabel(tmp); - - // loop through the list - - _mb[id].mInfo = 0; // empty list so far - - vMenu* item = _mb[id].SubMenu; // The first item in list - - MenuInfo* info; // for current info - for (int ix = 0 ; item[ix].label != 0 ; ++ix) - { - info = new MenuInfo; // new space or current tem - info->NxtInfo = _mb[id].mInfo; // add to front of list - _mb[id].mInfo = info; // fix front pointer - info->ItemIndex = ix; // index to item list - info->SubMenuIndex = 0; // no submenu normally - - if (item[ix].menuId == M_Line) - { -#ifndef Athena - info->WItem = XtVaCreateManagedWidget( - "-", // widget name - xmSeparatorWidgetClass, // widget class - _mb[id].XPopUp, // parent widget - NULL); // argument list -#else - info->WItem = XtVaCreateManagedWidget( - "-", // widget name - smeLineObjectClass, // widget class - _mb[id].XPopUp, // parent widget - XtNvertSpace, 0, - XtNleftMargin,15, // room for check-mark - XtNrightMargin,10, - XtNbackground, _vMenuBarBG, - NULL); // argument list -#endif - } - else if (item[ix].SubMenu != 0) // a submenu - { - if(_nextSubMenu >= MAX_MENU_BUTTONS) - { - SysDebug(BadVals,"Too many submenus!\n"); - continue; - } - fixLabel(item[ix].label); - setLabel(tmp,curLbl); - -#ifndef Athena - // Create a pulldown for pullright - - info->WItem = XmCreatePulldownMenu(_mb[id].XPopUp, - "vPullRight",0,0); -//# XtManageChild(info->WItem); - - // Create the cascade button - - _mb[id].XMenuButton = XtVaCreateManagedWidget( - "vMenuButton", // name for widget - xmCascadeButtonWidgetClass, // widget class - _mb[id].XPopUp, // parent widget - Nlabel, tmp, // display name - XmNsubMenuId,info->WItem, - XmNmnemonic, _Mnemonic, - NULL); // argument list - -#else // ATHENA - - info->WItem = XtVaCreateManagedWidget( - item[ix].label, - smeBSBObjectClass, // widget class - _mb[id].XPopUp, // parent widget - XtNlabel,tmp, // item[ix].label, // the label on the item - Nsensitive,item[ix].sensitive, // if sensitive - XtNvertSpace, 25, - XtNleftMargin,15, // room for check-mark - XtNrightMargin,10, - XtNrightBitmap, // set the left side - rtarrow_bitmap, // to the X checkbox - NULL); // argument list - - // Override the PARENT to grab motion, which will cause - // the popup menu to come up - - XtOverrideTranslations(_mb[id].XPopUp, SMtrans); -#endif - freeLabel(tmp); - - // we will create a submenu - // copy the definitions, track the new index - - int sub = _nextSubMenu++; // get our index, bump for next time - - _mb[sub].label = item[ix].label; - _mb[sub].XMenuButton = 0; - _mb[sub].SubMenu = item[ix].SubMenu; - info->SubMenuIndex = sub; // no submenu normally - // Now, recursively call doAddMenu with the submenu -#ifndef Athena - doAddMenu(sub,info->WItem); -#else - doAddMenu(sub,_mb[id].XPopUp); -#endif - } - else - { - // create the item widget - - fixLabel(item[ix].label, item[ix].keyLabel); -#ifndef Athena -// -//@@@ Note: we don't yet support accelerators on Motif -- we -// have to convert the X keycode to a Motif "AltX" format... -// - if (item[ix].checked) // was it checked? - curLbl[0] = '*'; // flaky checks - - setLabel(tmp,curLbl); - - info->WItem = XtVaCreateManagedWidget( - item[ix].label, - xmPushButtonWidgetClass, // widget class - _mb[id].XPopUp, // parent widget - Nlabel,tmp, // item[ix].label, // the label on the item - Nsensitive,item[ix].sensitive, // if sensitive - XmNfillOnSelect,1, - XmNindicatorOn,0, - XmNshadowThickness,1, - XmNindicatorType,XmN_OF_MANY, - NULL); // argument list - -#else - setLabel(tmp,curLbl); - info->WItem = XtVaCreateManagedWidget( - item[ix].label, - smeBSBObjectClass, // widget class - _mb[id].XPopUp, // parent widget - XtNlabel,tmp, // item[ix].label, // the label on the item - Nsensitive,item[ix].sensitive, // if sensitive - XtNvertSpace, 25, - XtNleftMargin,15, // room for check-mark - XtNrightMargin,10, - XtNbackground, _vMenuBarBG, - NULL); // argument list - - if (item[ix].checked) // was it checked? - { - XtVaSetValues(info->WItem, // to this menu item - XtNleftBitmap, // set the left side - menux_bitmap, // to the X checkbox - NULL); - } -#endif - - - // and add the call back for each item - freeLabel(tmp); - - XtAddCallback(info->WItem, - Ncallback, CmenuCB, (XtPointer)this); - } - } - } - -//====================>>> vMenuPane::CheckAccel <<<====================== - int vMenuPane::CheckAccel(vKey vkey, unsigned int shift, ItemVal& id) VCONST - { - // scan all menus in this window to see if this keystroke - // matches an accelerator key - -#ifdef Athena - vMenu* item; - - // Search all menus in this list - for (int ix = 0 ; ix < _nextSubMenu ; ++ix) - { - MenuInfo* info; // for current info - - // scan the list of info for each menu entry - - for (info = _mb[ix].mInfo ; info != 0 ; info = info->NxtInfo) - { - item = _mb[ix].SubMenu; // The current item in list - // see if its menuId is the same as the one we are setting - if (item[info->ItemIndex].accel == vkey - && item[info->ItemIndex].kShift == shift - && item[info->ItemIndex].sensitive) // V 1.25, 6/1/00 - { - id = item[info->ItemIndex].menuId; - return 1; - } - } - } -#endif - - id = 0; - return 0; // assume 0 if not found - } - -//====================>>> vMenuPane::GetPaneValue <<<====================== - int vMenuPane::GetPaneValue(ItemVal id, int& val) VCONST - { - // scan all menus in this window to retrieve the what value - // then scan button bar if not found - - vMenu* item; - - // Search all menus in this list - for (int ix = 0 ; ix < _nextSubMenu ; ++ix) - { - MenuInfo* info; // for current info - - // scan the list of info for each menu entry - - for (info = _mb[ix].mInfo ; info != 0 ; info = info->NxtInfo) - { - item = _mb[ix].SubMenu; // The current item in list - // see if its menuId is the same as the one we are setting - if (item[info->ItemIndex].menuId == id) - { - // Ah Ha! We found the value we want - val = item[info->ItemIndex].checked; - return 1; - } - } - } - - val = 0; - return 0; // assume 0 if not found - } - -//====================>>> vMenuPane::GetMenuThis <<<====================== - vMenuPane* vMenuPane::GetMenuThis(Widget w) - { - for (int ix = 0 ; ix < _nextSubMenu ; ++ix) - { - if (_mb[ix].XPopUp == w) - return this; - } - return 0; - } - -//======================>>> vMenuPane::initialize <<<======================= - void vMenuPane::initialize(vWindow* pWin, Widget pWidget, - Widget drawCanvas, Widget drawArea) - { - // First, create the Pixmaps, but only once! - - pWin->vAddMenuBar(); // Set up menubar - - vPane::initialize(pWin, pWidget); // initialize these - -#ifdef Athena - if (menux_bitmap == 0) // need to create stuff - { - // The bitmaps - - menux_bitmap = XCreateBitmapFromData( - XtDisplay(_parentWin->vHandle()), // our display - DefaultRootWindow(XtDisplay(_parentWin->vHandle() )), // a Drawable - menux_bits, // the menux bitmap data - menux_width, // from the file - menux_height); - - menuclr_bitmap = XCreateBitmapFromData( - XtDisplay(_parentWin->vHandle()), // our display - DefaultRootWindow(XtDisplay(_parentWin->vHandle())), // a Drawable - menuclr_bits, // the menux bitmap data - menuclr_width, // from the file - menuclr_height); - - rtarrow_bitmap = XCreateBitmapFromData( - XtDisplay(_parentWin->vHandle()), // our display - DefaultRootWindow(XtDisplay(_parentWin->vHandle())), // a Drawable - rtarrow_bits, // the rtarrow bitmap data - rtarrow_width, // from the file - rtarrow_height); - - // the action for submenus - - XtAppAddActions(XtWidgetToApplicationContext(_parentWin->vHandle()), - &submenu_action, 1); - } - - if (SMtrans == 0) // The translations needed - { - SMtrans = XtParseTranslationTable( - ": highlight() popupSubmenu()"); - SMtrans2 = XtParseTranslationTable( - ": unhighlight() MenuPopdown()\n: notify()\ - unhighlight() MenuPopdown()\n: highlight()"); - } -#endif - - // Now we have to add our menus - - for (int i = 0 ; i < _nextMenuButton ; ++i) - { - doAddMenu(i, 0); - } - } - -//============================>>> vMenuPane::menuCB <<<========================== - void vMenuPane::menuCB(Widget w) - { - // menu button class callback - // - // We will do some work here - // scan all menus until we find the widget - - vMenu* item; - ItemVal menu_val = 0; - - // Scan all menus in this window looking for widget corresponding - // to the widget that generated the callback - for (int ix = 0 ; ix < _nextSubMenu ; ++ix) - { - MenuInfo* info; // for current info - - for (info = _mb[ix].mInfo ; info != 0 ; info = info->NxtInfo) - { - if (info->WItem == w) // found it! - { - item = _mb[ix].SubMenu; // The first item in list - menu_val = item[info->ItemIndex].menuId; - goto FoundIt; - } - } - } -FoundIt: - _parentWin->MenuCommand(menu_val); - } - -extern "C" -{ -//============================>>> CmenuCB <<<========================== - void CmenuCB(Widget w, XtPointer ItmPtr, XtPointer call_data) - { - // menu button "C" Call Back - // ItmPtr will have the this pointer of our object - - ((vMenuPane*)ItmPtr)->menuCB(w); - } -} - -//==================>>> vMenuPane::SetPaneValue <<<======================== - void vMenuPane::SetPaneValue(ItemVal id, int val, ItemSetType setType) - { - // Set the given item on or off - - vMenu* item; - - // Search all menus in this list - for (int ix = 0 ; ix < _nextSubMenu ; ++ix) - { - MenuInfo* info; // for current info - - // scan the list of info for each menu entry - for (info = _mb[ix].mInfo ; info != 0 ; info = info->NxtInfo) - { - item = _mb[ix].SubMenu; // The current item in list - // see if its menuId is the same as the one we are setting - if (item[info->ItemIndex].menuId == id) - { - // Ah Ha! We found the value we want - switch (setType) - { - case Value: // check box - case Checked: // check box - item[info->ItemIndex].checked = val; - if (val) // turning it on - { -// OK, I know this isn't the best, but I tried and couldn't -// get ToggleButtons to work like I wanted, so I'm faking -// check marks with an '*'. If Motif had nice lefthand -// Bitmaps like Athena.... -#ifndef Athena - fixLabel(item[info->ItemIndex].label); - curLbl[0] = '*'; - setLabel(tmp,curLbl); - XtVaSetValues(info->WItem, // to this menu item - Nlabel,tmp, - NULL); - freeLabel(tmp); -#else - XtVaSetValues(info->WItem, // to this menu item - XtNleftBitmap, // set the left side - menux_bitmap, // to the X checkbox - NULL); -#endif - } - else - { -#ifndef Athena - fixLabel(item[info->ItemIndex].label); - setLabel(tmp,curLbl); - XtVaSetValues(info->WItem, // to this menu item - Nlabel,tmp, - NULL); - freeLabel(tmp); -#else - XtVaSetValues(info->WItem, // to this menu item - XtNleftBitmap, // set the left side - menuclr_bitmap, // to the X clearbox - NULL); -#endif - } - break; - - case Sensitive: // sensitive - item[info->ItemIndex].sensitive = val; - XtVaSetValues(info->WItem, // set sens or not - Nsensitive, val, // how to set - NULL); - break; - } // end switch - } - } - } - } - -//================>>> vMenuPane::SetPaneString <<<======================== - void vMenuPane::SetPaneString(ItemVal id, VCONST char* str) - { - // Set the given item on or off - - vMenu* item; - - // Search all menus in this window - for (int ix = 0 ; ix < _nextSubMenu ; ++ix) - { - MenuInfo* info; // for current info - - // scan the list of info for each menu entry - for (info = _mb[ix].mInfo ; info != 0 ; info = info->NxtInfo) - { - item = _mb[ix].SubMenu; // The current item in list - - if (item[info->ItemIndex].menuId == id) - { - // Ah Ha! We found the value we want - fixLabel(str); -#ifndef Athena - item[info->ItemIndex].label = str; - // This is flakey, but you have to check for check here - if (item[info->ItemIndex].checked) - curLbl[0] = '*'; -#endif - setLabel(tmp,curLbl); - - XtVaSetValues(info->WItem, // change label - Nlabel, tmp, - NULL); - - freeLabel(tmp); - } - } - } - } - -//==================>>> vMenuPane::doSubMenu <<<======================== - void vMenuPane::doSubMenu(Widget parent, Widget subitem, int x, int y) - { - // Maybe popup a submenu - - // Scan all menus in this window looking for widget corresponding - // to the widget that generated the callback - for (int ix = 0 ; ix < _nextSubMenu ; ++ix) - { - if (_mb[ix].XPopUp == parent) - { - MenuInfo* info; // for current info - for (info = _mb[ix].mInfo ; info != 0 ; info = info->NxtInfo) - { - if (info->WItem == subitem) - { - vMenu* item = _mb[ix].SubMenu; // The first item in list - - // look at static definition to see if this one had a - // submenu. If so, then it is the one we are looking for. - if (item[info->ItemIndex].SubMenu != 0) - { - // get the popup shell for the submenu and pop it up. - Widget submenu = _mb[info->SubMenuIndex].XPopUp; - XtVaSetValues(submenu, XtNx, x, XtNy, y, NULL); - XtPopup(submenu, XtGrabExclusive); - theApp->XWaitUntilMapped(submenu); - return; - } - } - } - break; - } - } - // we didn't find a value - } - -//================>>> subMenuAction <<<======================== - static void subMenuAction(Widget w, XEvent *event, - String *params, Cardinal *nparams) - { -#ifdef Athena - Dimension width, height; - int x, y; - Widget cw = XawSimpleMenuGetActiveEntry(w); - - if (cw == 0 || event->type != MotionNotify) - return; - - x = event->xmotion.x; - y = event->xmotion.y; - - XtVaGetValues(w, XtNwidth, &width, XtNheight, &height, NULL); - - if (x < 0 || x >= width || y < 0 || y >= height) - return; - - /* - ** Only the second half of the menu is sensitve to pulls - */ - if (x < (width - (width / 3))) - return; - - vMenuPane* mypane = theApp->GetMenuThis(w); - - if (mypane == 0) - return; - - // Don't mess with this too much -- the sub menu seems to need - // to popup over the cursor, or it loses track of things. - x = event->xmotion.x_root - 10 ; // Make sure cursor shows - y = event->xmotion.y_root - 10 ; - - mypane->doSubMenu(w, cw, x, y); - -#ifdef ITWORKS - for (cur = rightHead; cur != NULL && cur->widget != cw; cur = cur->next) - ; - - if (cur == NULL) - return; - - XtVaSetValues(cur->shell, XtNx, x, XtNy, y, NULL); - - XtPopup(cur->shell, XtGrabExclusive); -#endif -#endif - } diff --git a/v/srcx/vmodald.cxx b/v/srcx/vmodald.cxx deleted file mode 100644 index c1894fc..0000000 --- a/v/srcx/vmodald.cxx +++ /dev/null @@ -1,117 +0,0 @@ -//=============================================================== -// vdialog.cxx - vdialog class functions - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // our header -#include - -// Define static data of the class -// ... none ... - -//=================>>> vModalDialog::vModalDialog <<<===================== - vModalDialog::vModalDialog(vBaseWindow* creator, VCONST char* title) : - vDialog(creator, 1, title) // constructor - { - - SysDebug(Constructor,"vModalDialog::vModalDialog() constructor\n") - - } - -//=================>>> vModalDialog::vModalDialog <<<===================== - vModalDialog::vModalDialog(vApp* creator, VCONST char* title) : - vDialog(creator, 1, title) // constructor - { - - SysDebug(Constructor,"vModalDialog::vModalDialog(vApp)) constructor\n") - - } - -//===============>>> vModalDialog::~vModalDialog <<<======================= - vModalDialog::~vModalDialog() - { - - SysDebug(Destructor,"vModalDialog::~vModalDialog() destructor\n") - - } - -//==================>>> vModalDialog::CloseDialog <<<======================= - void vModalDialog::CloseDialog(void) - { - _mdDone = 1; // We are done now, so save values - vDialog::CloseDialog(); - } - -//=================>>> vModalDialog::DialogCommand <<<====================== - void vModalDialog::DialogCommand(ItemVal id, ItemVal retval, CmdType ctype) - { - // After the user has selected a command from the dialog, - // this routine is called with the value - - vDialog::DialogCommand(id, retval, ctype); - - _mdItemVal = retval; // for full modal return - _mdItemID = id; // must go after above call - _mdCmdType = ctype; - - if (id == M_Cancel || id == M_Done || id == M_OK) - { - _mdDone = 1; // We are done now, so save values - } - } - -//================>>> vModalDialog::ShowModalDialog <<<====================== - ItemVal vModalDialog::ShowModalDialog(VCONST char* msg, ItemVal& retval) - { - // This is a fully modal version that will allow the user a simple - // wait for an answer without needing the DialogCommand method - - - ShowDialog(msg); // Display the dialog - - WaitForX(&_mdDone); // Wait till we're done - - retval = _mdItemVal; - return _mdItemID; // return the value - } - -//===================>>> vModalDialog::ShowDialog <<<======================= - void vModalDialog::ShowDialog(VCONST char* msg) - { - // Show the dialog with the default message - - _mdDone = 0; // not done with the dialog - - vDialog::ShowDialog(msg); // now just use our superclass - } - -//=========================>>> vModalDialog::WaitForX <<<======================== - void vModalDialog::WaitForX(int* flag) - { - // Sometimes we just need to get synchronous. We probably could - // define a bunch of extra, awkward callbacks, but sometimes - // it is more sensible just to wait. - // - // The only obvious way to wait in X is to take over the - // event loop while waiting for some state variable to change. - // One of the events will cause the variable to change to 1, - // and we can then exit from here. Note that the XtAppNextEvent - // will block if there aren't any events, so this isn't just - // a busy loop - the system will be free to do useful things. - - XEvent an_event; // need this variable - - *flag = 0; // The caller provides the flag - - while (! *flag) // Wait for an event to set the flag - { - XtAppProcessEvent(theApp->appContext(),XtIMAll); // handle events - } - // After here, the regular event loop will take over - } diff --git a/v/srcx/vnotice.cxx b/v/srcx/vnotice.cxx deleted file mode 100644 index 6e1ef44..0000000 --- a/v/srcx/vnotice.cxx +++ /dev/null @@ -1,72 +0,0 @@ -//=============================================================== -// vnotice.cxx - vNoticeDialog class functions - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // our header -#include // our header - -// Define static data of the class - -#define bang_width 40 -#define bang_height 32 -static unsigned char bang_bits[] = { - 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, - 0x7e, 0x00, 0x00, 0x00, 0x00, 0xe7, 0x00, 0x00, 0x00, 0x00, 0xc3, 0x00, - 0x00, 0x00, 0x80, 0x83, 0x01, 0x00, 0x00, 0xc0, 0x99, 0x03, 0x00, 0x00, - 0xc0, 0x34, 0x03, 0x00, 0x00, 0xe0, 0x6a, 0x07, 0x00, 0x00, 0x70, 0x76, - 0x0e, 0x00, 0x00, 0x70, 0x6a, 0x0e, 0x00, 0x00, 0x38, 0x76, 0x1c, 0x00, - 0x00, 0x18, 0x6a, 0x18, 0x00, 0x00, 0x1c, 0x76, 0x38, 0x00, 0x00, 0x0e, - 0x6a, 0x70, 0x00, 0x00, 0x06, 0x76, 0x60, 0x00, 0x00, 0x07, 0x6a, 0xe0, - 0x00, 0x80, 0x03, 0x76, 0xc0, 0x01, 0x80, 0x03, 0x6a, 0xc0, 0x01, 0xc0, - 0x01, 0x76, 0x80, 0x03, 0xc0, 0x00, 0x6a, 0x00, 0x03, 0xe0, 0x00, 0x34, - 0x00, 0x07, 0x70, 0x00, 0x18, 0x00, 0x0e, 0x70, 0x00, 0x00, 0x00, 0x0e, - 0x38, 0x00, 0x3c, 0x00, 0x1c, 0x1c, 0x00, 0x76, 0x00, 0x38, 0x1c, 0x00, - 0x6a, 0x00, 0x38, 0x0e, 0x00, 0x76, 0x00, 0x70, 0x0f, 0x00, 0x3c, 0x00, - 0xf0, 0x1f, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xfc, - 0xff, 0xff, 0xff, 0x3f}; - - static vIcon bang(&bang_bits[0], bang_height, bang_width); - - static CommandObject NoticeDialog[] = - { - {C_Icon, 1, 0, "Notice", (void*)&bang, CA_None,isSens,NoFrame, 0, 0}, - - {C_Text, 2, 0, "UserMessage", - NoList, CA_NoBorder | CA_MainMsg, isSens, NoFrame, 1,0}, - - {C_Button, M_OK, M_OK, " OK ", NoList,CA_DefaultButton,isSens,NoFrame, 0, 1}, - {C_EndOfList,0,0,0,0,CA_None,0,0,0} - }; - -//======================>>> vNoticeDialog::Notice <<<======================= - void vNoticeDialog::Notice(VCONST char* msg) - { - // Show a message, and OK - // no important return - - int dummy; - - if (!_cmdsAdded) // Only once - { - AddDialogCmds(NoticeDialog); // Set up standard dialog - _cmdsAdded = 1; - } - (void) ShowModalDialog(msg,dummy); // show and wait - } - -//====================>>> vNoticeDialog::DialogCommand <<<======================= - void vNoticeDialog::DialogCommand(ItemVal id, ItemVal val, CmdType ctype) - { - vModalDialog::DialogCommand(id,val,ctype); -// if (id == M_OK) -// CloseDialog(); - } - -// --------------------------------------------------------------------- diff --git a/v/srcx/vos.cxx b/v/srcx/vos.cxx deleted file mode 100644 index 0e0a92b..0000000 --- a/v/srcx/vos.cxx +++ /dev/null @@ -1,264 +0,0 @@ -//=============================================================== -// vos.cpp - Interface to OS dependent stuff (For Unix) -// -// Copyright (C) 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include -#include // for getusername -#include -#include -#include - -#include -#include - -#ifdef sun -extern "C" int gethostname(char* name, int namlen); -#endif -const int MaxCompNameLen = 256; - -//=========================>>> vOS::vOS <<<========================== - vOS::vOS() - { - // Constructor - // This will be used to determing which OS we are running - // under: e.g., NT vs 95 - } - -//=========================>>> vOS::~vOS <<<========================== - vOS::~vOS() - { - // Destructor - } - -//=========================>>> vOS::vGetUserName <<<========================== - int vOS::vGetEnvVal(char* name, char* val, int maxlen) - { - char *ep = getenv(name); - if (ep != 0 && strlen(ep) < maxlen) - { - strcpy(val, ep); - return strlen(val); - } - return 0; - } - -//=========================>>> vOS::vDeleteFile <<<========================== - int vOS::vDeleteFile(const char* filename) - { - return remove(filename) == 0; - } - -//=========================>>> vOS::vRenameFile <<<========================== - int vOS::vRenameFile(const char* oldFilename, const char* newFilename) - { - int pid; - static char *mvarg[4]; - static int status; - - if (rename((char*)oldFilename,(char*)newFilename) != 0) - { - mvarg[0] = "/bin/mv"; - mvarg[1] = (char*)oldFilename; - mvarg[2] = (char*)newFilename; - mvarg[3]=0; - pid = fork(); - if (pid == 0) - { - extern char **environ; - execve("/bin/mv",mvarg,environ); - return 0; - } -// wait(&status); -// if (status > 255) /* error return */ -// { -// return 0; -// } - } - } - -//=========================>>> vOS::vChDrive <<<========================== - int vOS::vChDrive(int drive) - { - return 1; // no op on unix - } - -//=========================>>> vOS::vGetUserName <<<========================== - int vOS::vGetUserName( char* s, int len) - { - // Set s to user name - struct passwd *pw; - uid_t uid; - - uid = getuid(); - if ((pw = getpwuid(uid)) != 0 && - pw->pw_name != 0 && *(pw->pw_name) != 0) - { - strncpy(s, pw->pw_name, len); - return 1; - } - - strcpy(s,"Unknown"); - return 0; /* a number is not a name */ - - } - - -//====================>>> vOS::vGetHostName <<<========================== - void vOS::vGetHostName(char* s, int len) - { - // Get host name - gethostname((char *)s, len); // tested on linux only - } - -//=========================>>> vOS::vGetPid <<<========================== - long vOS::vGetPid() - { - // return process ID - - return (long) getpid(); - } - - -//=========================>>> vOS::vGetCWD <<<========================== - int vOS::vGetCWD(char* buf, int len) - { - // Get name of current directory - - if (getcwd((char *)buf, len) == NULL) - { - strcpy(buf, "."); - return 0; - } - return 1; - } - -//=========================>>> vOS::vChDir <<<========================== - int vOS::vChDir(const char *path) - { - if (path[0] == 0) /* just checking... */ - return 0; - - if (*path == 0) /* drive name only */ - return 0; - - return chdir(path) == 0; - } - -//=========================>>> vOS::vSleep <<<========================== - void vOS::vSleep(long MSec) - { - usleep(MSec * 1000); - } - -//=========================>>> vOS::vRunProcess <<<========================== - int vOS::vRunProcess(const char* cmd, const char* StdOut, const char* StdErr, - const int Wait, const int minimize) - { - int ret = 1; - -// We will support two modes - a wait mode that lets us redirect -// stdout and stderr, and a don't wait mode that doesn't allow -// redirection. This might get fixed somday if someone wants -// to fix it.... - -// Execute command via the shell, but redirects stdin/stdout/stderr first. -// stdout/stderr are appended, not overwritten. - - if (Wait) - { - if (StdOut && *StdOut) // change stdout - { - if (!freopen(StdOut, "w", stdout)) - return 0; - } - if (StdErr && *StdErr) // change stdout - { - if (!freopen(StdErr, "w", stderr)) - return 0; - } - ret = system(cmd); - } - else // no wait - { - if (StdOut && *StdOut) // change stdout - { - if (!freopen(StdOut, "w", stdout)) - return 0; - } - if (StdErr && *StdErr) // change stdout - { - if (!freopen(StdErr, "w", stderr)) - return 0; - } - char args[256]; - strcpy(args,cmd); // make a copy to work with - strcat(args," &"); - ret = system(args); - -#ifdef OLDWAY -#define EXEC_FAILED 122 /* Exit code when shell didn't execute. Don't use - 127, some shell use that already */ - - char* argv[10]; // up to 10 args - int argcnt; - char args[256]; - int inquote; - - pid_t pid; - - int status = -1; - - - if (strlen(cmd) >= 255) // don't allow too much! - return EXEC_FAILED; - - strcpy(args,cmd); // make a copy to work with - - char* p = args; - - for (argcnt = 0; *p && argcnt < 10 ; ++argcnt) - { - inquote = 0; - argv[argcnt] = p; // current arg - while (*p && (inquote || (*p != ' ' && *p != '\t'))) - { - if (*p == '"') - inquote = !inquote; - ++p; - } - if (*p == 0) - continue; - *p++ = 0; // terminate the arg - while (*p && (*p == ' ' || *p == '\t')) - ++p; // skip white space - } - argv[argcnt] = 0; - - if ((pid = fork()) == -1) /* maybe we should use vfork() */ - { - return EXEC_FAILED; - } - else if (pid == 0) // CHILD - do the execvp - { - execvp(argv[0], argv); // should not return! - exit(EXEC_FAILED); // exec failed, return failure code - } - else // PARENT FORK - { - // Wait until child has exited. -#ifdef WAIT_EXECVP - wait(&status); -#endif - ret = 0; - } -#endif - } - return ret; - } diff --git a/v/srcx/vpopmenu.cxx b/v/srcx/vpopmenu.cxx deleted file mode 100644 index c6d34b1..0000000 --- a/v/srcx/vpopmenu.cxx +++ /dev/null @@ -1,64 +0,0 @@ -//=============================================================== -// vPopMenu.cxx - vPopupMenu class functions - X -// -// Copyright (C) 1995-1999 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // our header -#include // we need access to vcmdwin - -//==================>>> vPopupMenu::vPopupMenu <<<=========================== - vPopupMenu::vPopupMenu(VCONST vMenu* menu, VCONST vWindow* pWin) - { - - // set up menus ----------------------------------------------- - - SysDebug(Constructor,"vPopupMenu::vPopupMenu() constructor\n") - - } - -//==================>>> vPopupMenu::vPopupMenu <<<=========================== - vPopupMenu::vPopupMenu(const vPopupMenu& /* m */) - { - - vSysError("V Semantics do not allow copy constructors."); - } - -//====================>>> vPopupMenu::~vPopupMenu <<<======================= - vPopupMenu::~vPopupMenu() // destructor - { - - } - -//====================>>> vPopupMenu::ShowMenu <<<====================== - void vPopupMenu::ShowMenu(int x, int y) - { - } - -//====================>>> vPopupMenu::GetValue <<<====================== - int vPopupMenu::GetValue(ItemVal id) VCONST - { - // scan all menus in this window to retrieve the what value - // then scan button bar if not found - - return 0; // assume 0 if not found - } - -//==================>>> vPopupMenu::SetValue <<<======================== - void vPopupMenu::SetValue(ItemVal id, int val, ItemSetType setType) - { - // Set the given item on or off - - } - -//================>>> vPopupMenu::SetString <<<======================== - void vPopupMenu::SetString(ItemVal id, VCONST char* str) - { - // Set the given item on or off - - } diff --git a/v/srcx/vpopmenumin.cxx b/v/srcx/vpopmenumin.cxx deleted file mode 100644 index c6d34b1..0000000 --- a/v/srcx/vpopmenumin.cxx +++ /dev/null @@ -1,64 +0,0 @@ -//=============================================================== -// vPopMenu.cxx - vPopupMenu class functions - X -// -// Copyright (C) 1995-1999 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // our header -#include // we need access to vcmdwin - -//==================>>> vPopupMenu::vPopupMenu <<<=========================== - vPopupMenu::vPopupMenu(VCONST vMenu* menu, VCONST vWindow* pWin) - { - - // set up menus ----------------------------------------------- - - SysDebug(Constructor,"vPopupMenu::vPopupMenu() constructor\n") - - } - -//==================>>> vPopupMenu::vPopupMenu <<<=========================== - vPopupMenu::vPopupMenu(const vPopupMenu& /* m */) - { - - vSysError("V Semantics do not allow copy constructors."); - } - -//====================>>> vPopupMenu::~vPopupMenu <<<======================= - vPopupMenu::~vPopupMenu() // destructor - { - - } - -//====================>>> vPopupMenu::ShowMenu <<<====================== - void vPopupMenu::ShowMenu(int x, int y) - { - } - -//====================>>> vPopupMenu::GetValue <<<====================== - int vPopupMenu::GetValue(ItemVal id) VCONST - { - // scan all menus in this window to retrieve the what value - // then scan button bar if not found - - return 0; // assume 0 if not found - } - -//==================>>> vPopupMenu::SetValue <<<======================== - void vPopupMenu::SetValue(ItemVal id, int val, ItemSetType setType) - { - // Set the given item on or off - - } - -//================>>> vPopupMenu::SetString <<<======================== - void vPopupMenu::SetString(ItemVal id, VCONST char* str) - { - // Set the given item on or off - - } diff --git a/v/srcx/vpopmenutry.cxx b/v/srcx/vpopmenutry.cxx deleted file mode 100644 index 22c7b81..0000000 --- a/v/srcx/vpopmenutry.cxx +++ /dev/null @@ -1,821 +0,0 @@ -//=============================================================== -// vPopMenu.cxx - vPopupMenu class functions - X -// -// Copyright (C) 1995-1999 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - - -#include -#include - - -#include -#include - -extern "C" -{ -#include -#include - -#ifndef Athena - -#include -//#include -#include -#include -#define setLabel(x,y) XmString x = XmStringCreateLocalized(y); -#define freeLabel(x) XmStringFree(x); -#define Ncallback XmNactivateCallback -#define Nsensitive XmNsensitive -#define Nlabel XmNlabelString - - extern XEvent* VGlobalButtonPressedEvent; // nasty but easy - -#else // ATHENA -#ifdef AthenaWorks - -#include -#include -#include -#include -#include - -#define setLabel(x,y) char* x = y; -#define freeLabel(x) -#define Ncallback XtNcallback -#define Nsensitive XtNsensitive -#define Nlabel XtNlabel -#endif - -#endif - -} - - -// Define static data of the class - -#define menux_width 9 -#define menux_height 9 - -static char menux_bits[] = { - 0xff, 0x01, 0x83, 0x01, 0x45, 0x01, 0x29, 0x01, 0x11, 0x01, 0x29, 0x01, - 0x45, 0x01, 0x83, 0x01, 0xff, 0x01}; -static Pixmap menux_bitmap = 0; // the check for menus - -#define menuclr_width 9 -#define menuclr_height 9 -static char menuclr_bits[] = { - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; -static Pixmap menuclr_bitmap = 0; // the no-check for menus - -#define rtarrow_width 9 -#define rtarrow_height 9 -static char rtarrow_bits[] = { - 0x03, 0x00, 0x0f, 0x00, 0x3f, 0x00, 0xff, 0x00, 0xff, 0x01, 0xff, 0x00, - 0x3f, 0x00, 0x0f, 0x00, 0x03, 0x00}; -static Pixmap rtarrow_bitmap = 0; // right arrow for submenus - - -static void subMenuAction(Widget, XEvent *, String *, Cardinal *); - -#ifdef Athena -#ifdef AthenaWorks -static XtActionsRec submenu_action = { "popupSubmenu", - (XtActionProc)subMenuAction }; -static XtTranslations SMtrans = 0, SMtrans2 = 0; -#endif -#endif - -static char curLbl[100]; // for fixed labels -static char _Mnemonic; - -//==================>>> vPopupMenu::vPopupMenu <<<=========================== - vPopupMenu::vPopupMenu(VCONST vMenu* menu, VCONST vWindow* pWin) - { - int i; - - // set up menus ----------------------------------------------- - - SysDebug(Constructor,"vPopupMenu::vPopupMenu() constructor\n") - - - _parentWin = pWin; - initDone = 0; - - _nextMenuButton = 0; // no menus defined so far - - for (i = 0 ; i < MAX_MENU_BUTTONS ; ++i) - { - _mb[i].label = 0; // null out menu button array - _mb[i].XMenuButton = 0; - _mb[i].SubMenu = 0; - _mb[i].mInfo = 0; - } - - _mb[0].label = ""; - _mb[0].SubMenu = menu; - _nextSubMenu = // we will start submenus here - _nextMenuButton = 1; // this many menus defined - _topLevelMenu = 0; - - } - -//==================>>> vPopupMenu::vPopupMenu <<<=========================== - vPopupMenu::vPopupMenu(const vPopupMenu& m) - { - - vSysError("V Semantics do not allow copy constructors."); - } - -//====================>>> vPopupMenu::~vPopupMenu <<<======================= - vPopupMenu::~vPopupMenu() // destructor - { - - SysDebug(Destructor,"vPopupMenu::~vPopupMenu() destructor\n") - - if (_topLevelMenu != 0) // delete top + childern - XtDestroyWidget(_topLevelMenu); - - for (int i = 0 ; i < _nextSubMenu ; ++i) // all menus - { - delete _mb[i].mInfo; // free the space - } - - } - -//======================>>> vPopupMenu::fixLabel <<<======================== - void vPopupMenu::fixLabel(VCONST char* lbl, VCONST char* key) VCONST - { - // copy label to global curLbl - - VCONST char* cp; - int ix = 0; - - _Mnemonic = 0; - -#ifndef Athena - curLbl[0] = ' '; curLbl[1] = ' '; ix = 2; // to add * checkmark -#endif - - for (cp = lbl ; *cp && ix < 99 ; ++cp) // Scan label - { - if (*cp != '&') - { - curLbl[ix++] = *cp; - } - else - _Mnemonic = *(cp+1); - } - -#ifdef Athena // ATHENA ONLY -#ifdef AthenaWorks - if (key && *key) - { - curLbl[ix++] = ' '; curLbl[ix++] = ' '; curLbl[ix++] = '<'; - for (cp = key ; *cp && ix < 99 ; ++cp) - { - if (*cp != '&') - { - curLbl[ix++] = *cp; - } - } - curLbl[ix++] = '>'; - } -#endif -#endif - - curLbl[ix] = 0; // finish off - } - -//======================>>> vPopupMenu::doAddMenu <<<======================== - void vPopupMenu::doAddMenu(int id, Widget parent) - { - // create a button on the menu button bar - - - // fixLabel(_mb[id].label,0); // copy the label - // setLabel(tmp,curLbl); - - - _mb[id].XPopUp = parent; // a submenu - _mb[id].XMenuButton = parent; // a submenu - -//@@ need something different here for Athena - this part is -// mostly why Athena isn't supported at the moment... - - // freeLabel(tmp); - - // loop through the list - - _mb[id].mInfo = 0; // empty list so far - - vMenu* item = _mb[id].SubMenu; // The first item in list - - PMenuInfo* info; // for current info - for (int ix = 0 ; item[ix].label != 0 ; ++ix) - { - info = new PMenuInfo; // new space or current tem - info->NxtInfo = _mb[id].mInfo; // add to front of list - _mb[id].mInfo = info; // fix front pointer - info->ItemIndex = ix; // index to item list - info->SubMenuIndex = 0; // no submenu normally - - if (item[ix].menuId == M_Line) - { -#ifndef Athena - info->WItem = XtVaCreateManagedWidget( - "-", // widget name - xmSeparatorWidgetClass, // widget class - _mb[id].XPopUp, // parent widget - NULL); // argument list -#else -#ifdef AthenaWorks - info->WItem = XtVaCreateManagedWidget( - "-", // widget name - smeLineObjectClass, // widget class - _mb[id].XPopUp, // parent widget - XtNvertSpace, 0, - XtNleftMargin,15, // room for check-mark - XtNrightMargin,10, - XtNbackground, _vMenuBarBG, - NULL); // argument list -#endif -#endif - } - else if (item[ix].SubMenu != 0) // a submenu - { - if(_nextSubMenu >= MAX_MENU_BUTTONS) - { - SysDebug(BadVals,"Too many submenus!\n"); - continue; - } - fixLabel(item[ix].label); - setLabel(tmp,curLbl); - -#ifndef Athena - // Create a pulldown for pullright - - info->WItem = XmCreatePulldownMenu(_mb[id].XPopUp, - "vPullRight",0,0); -//# XtManageChild(info->WItem); - - // Create the cascade button - - _mb[id].XMenuButton = XtVaCreateManagedWidget( - "vMenuButton", // name for widget -// xmCascadeButtonWidgetClass, // widget class - xmPushButtonWidgetClass, // widget class - _mb[id].XPopUp, // parent widget - Nlabel, tmp, // display name - XmNsubMenuId,info->WItem, - XmNmnemonic, _Mnemonic, - NULL); // argument list - -#else // ATHENA -#ifdef AthenaWorks - - info->WItem = XtVaCreateManagedWidget( - item[ix].label, - smeBSBObjectClass, // widget class - _mb[id].XPopUp, // parent widget - XtNlabel,tmp, // item[ix].label, // the label on the item - Nsensitive,item[ix].sensitive, // if sensitive - XtNvertSpace, 25, - XtNleftMargin,15, // room for check-mark - XtNrightMargin,10, - XtNrightBitmap, // set the left side - rtarrow_bitmap, // to the X checkbox - NULL); // argument list - - // Override the PARENT to grab motion, which will cause - // the popup menu to come up - - XtOverrideTranslations(_mb[id].XPopUp, SMtrans); -#endif -#endif - freeLabel(tmp); - - // we will create a submenu - // copy the definitions, track the new index - - int sub = _nextSubMenu++; // get our index, bump for next time - - _mb[sub].label = item[ix].label; - _mb[sub].XMenuButton = 0; - _mb[sub].SubMenu = item[ix].SubMenu; - info->SubMenuIndex = sub; // no submenu normally - // Now, recursively call doAddMenu with the submenu -#ifndef Athena - doAddMenu(sub,info->WItem); -#else -#ifdef AthenaWorks - doAddMenu(sub,_mb[id].XPopUp); -#endif -#endif - } - else - { - // create the item widget - - fixLabel(item[ix].label, item[ix].keyLabel); -#ifndef Athena -// -//@@@ Note: we don't yet support accelerators on Motif -- we -// have to convert the X keycode to a Motif "AltX" format... -// - if (item[ix].checked) // was it checked? - curLbl[0] = '*'; // flaky checks - - setLabel(tmp,curLbl); - - info->WItem = XtVaCreateManagedWidget( - item[ix].label, - xmPushButtonWidgetClass, // widget class - _mb[id].XPopUp, // parent widget - Nlabel,tmp, // item[ix].label, // the label on the item - Nsensitive,item[ix].sensitive, // if sensitive - XmNfillOnSelect,1, - XmNindicatorOn,0, - XmNshadowThickness,1, - XmNindicatorType,XmN_OF_MANY, - NULL); // argument list - - // and add the call back for each item - freeLabel(tmp); - - XtAddCallback(info->WItem, - Ncallback, CPmenuCB, (XtPointer)this); -#else -#ifdef AthenaWorks - setLabel(tmp,curLbl); - info->WItem = XtVaCreateManagedWidget( - item[ix].label, - smeBSBObjectClass, // widget class - _mb[id].XPopUp, // parent widget - XtNlabel,tmp, // item[ix].label, // the label on the item - Nsensitive,item[ix].sensitive, // if sensitive - XtNvertSpace, 25, - XtNleftMargin,15, // room for check-mark - XtNrightMargin,10, - XtNbackground, _vMenuBarBG, - NULL); // argument list - - if (item[ix].checked) // was it checked? - { - XtVaSetValues(info->WItem, // to this menu item - XtNleftBitmap, // set the left side - menux_bitmap, // to the X checkbox - NULL); - } - // and add the call back for each item - freeLabel(tmp); - - XtAddCallback(info->WItem, - Ncallback, CPmenuCB, (XtPointer)this); -#endif -#endif - - } - } - } - -//====================>>> vPopupMenu::GetValue <<<====================== - int vPopupMenu::GetValue(ItemVal id) VCONST - { - // scan all menus in this window to retrieve the what value - // then scan button bar if not found - - vMenu* item; - - // Search all menus in this list - for (int ix = 0 ; ix < _nextSubMenu ; ++ix) - { - PMenuInfo* info; // for current info - - // scan the list of info for each menu entry - - for (info = _mb[ix].mInfo ; info != 0 ; info = info->NxtInfo) - { - item = _mb[ix].SubMenu; // The current item in list - // see if its menuId is the same as the one we are setting - if (item[info->ItemIndex].menuId == id) - { - // Ah Ha! We found the value we want - return item[info->ItemIndex].checked; - } - } - } - - return 0; // assume 0 if not found - } - -#ifdef Athena -//====================>>> vPopupMenu::GetMenuThis <<<====================== - vPopupMenu* vPopupMenu::GetMenuThis(Widget w) - { - for (int ix = 0 ; ix < _nextSubMenu ; ++ix) - { - if (_mb[ix].XPopUp == w) - return this; - } - return 0; - } -#endif - -//======================>>> vPopupMenu::initialize <<<======================= - void vPopupMenu::initialize() - { - // First, create the Pixmaps, but only once! - - if (_topLevelMenu != 0) // already done! - return; - -#ifdef Athena -#ifdef AthenaWorks - if (menux_bitmap == 0) // need to create stuff - { - // The bitmaps - - menux_bitmap = XCreateBitmapFromData( - XtDisplay(_parentWin->vHandle()), // our display - DefaultRootWindow(XtDisplay(_parentWin->vHandle() )), // a Drawable - menux_bits, // the menux bitmap data - menux_width, // from the file - menux_height); - - menuclr_bitmap = XCreateBitmapFromData( - XtDisplay(_parentWin->vHandle()), // our display - DefaultRootWindow(XtDisplay(_parentWin->vHandle())), // a Drawable - menuclr_bits, // the menux bitmap data - menuclr_width, // from the file - menuclr_height); - - rtarrow_bitmap = XCreateBitmapFromData( - XtDisplay(_parentWin->vHandle()), // our display - DefaultRootWindow(XtDisplay(_parentWin->vHandle())), // a Drawable - rtarrow_bits, // the rtarrow bitmap data - rtarrow_width, // from the file - rtarrow_height); - - // the action for submenus - - XtAppAddActions(XtWidgetToApplicationContext(_parentWin->vHandle()), - &submenu_action, 1); - } - - if (SMtrans == 0) // The translations needed - { - SMtrans = XtParseTranslationTable( - ": highlight() popupSubmenu()"); - SMtrans2 = XtParseTranslationTable( - ": unhighlight() MenuPopdown()\n: notify()\ - unhighlight() MenuPopdown()\n: highlight()"); - } - - -// _topLevelMenu = XtVaCreatePopupShell( -// _mb[id].label, -// simpleMenuWidgetClass, // menu -// _mb[id].XMenuButton, // parent -// XtNbackground, _vMenuBarBG, -// NULL); - - // Now we have to add our menus - - doAddMenu(0, _topLevelMenu); -#endif -#else // Motif - -#define TESTIT -#ifdef TESTIT - XmString line, square, circle, exit, exit_acc; - - line = XmStringCreateLocalized ("Line"); - square = XmStringCreateLocalized ("Square"); - circle = XmStringCreateLocalized ("Circle"); - exit = XmStringCreateLocalized ("Exit"); - exit_acc = XmStringCreateLocalized ("Ctrl+C"); - _topLevelMenu = XmVaCreateSimplePopupMenu (_parentWin->vHandle(), - "popup", NULL, // popup_cb, - XmVaPUSHBUTTON, line, 'L', NULL, NULL, - XmVaPUSHBUTTON, square, 'S', NULL, NULL, - XmVaPUSHBUTTON, circle, 'C', NULL, NULL, - XmVaSEPARATOR, - XmVaPUSHBUTTON, exit, 'x', "Ctrlc", exit_acc, - NULL); - XmStringFree (line); - XmStringFree (square); - XmStringFree (circle); - XmStringFree (exit); - XmStringFree (exit_acc); - -#else - _topLevelMenu = XmCreatePopupMenu(_parentWin->vHandle(),"popupmenu",0,0); - // Now we have to add our menus - - - (void) XtVaCreateManagedWidget( - "TestMe", - xmPushButtonWidgetClass, // widget class - _topLevelMenu, // parent widget - NULL); // argument list - -// doAddMenu(0, _topLevelMenu); - -#endif -#endif - - } - -//============================>>> vPopupMenu::menuCB <<<========================== - void vPopupMenu::menuCB(Widget w) - { - // menu button class callback - // - // We will do some work here - // scan all menus until we find the widget - - vMenu* item; - ItemVal menu_val = 0; - - // Scan all menus in this window looking for widget corresponding - // to the widget that generated the callback - for (int ix = 0 ; ix < _nextSubMenu ; ++ix) - { - PMenuInfo* info; // for current info - - for (info = _mb[ix].mInfo ; info != 0 ; info = info->NxtInfo) - { - if (info->WItem == w) // found it! - { - item = _mb[ix].SubMenu; // The first item in list - menu_val = item[info->ItemIndex].menuId; - goto FoundIt; - } - } - } -FoundIt: return; -//@@@@@ _parentWin->MenuCommand(menu_val); - } - -extern "C" -{ -//============================>>> CPmenuCB <<<========================== - void CPmenuCB(Widget w, XtPointer ItmPtr, XtPointer call_data) - { - // menu button "C" Call Back - // ItmPtr will have the this pointer of our object - - ((vPopupMenu*)ItmPtr)->menuCB(w); - } -} - -//==================>>> vPopupMenu::SetValue <<<======================== - void vPopupMenu::SetValue(ItemVal id, int val, ItemSetType setType) - { - // Set the given item on or off - - vMenu* item; - - // Search all menus in this list - for (int ix = 0 ; ix < _nextSubMenu ; ++ix) - { - PMenuInfo* info; // for current info - - // scan the list of info for each menu entry - for (info = _mb[ix].mInfo ; info != 0 ; info = info->NxtInfo) - { - item = _mb[ix].SubMenu; // The current item in list - // see if its menuId is the same as the one we are setting - if (item[info->ItemIndex].menuId == id) - { - // Ah Ha! We found the value we want - switch (setType) - { - case Value: // check box - case Checked: // check box - item[info->ItemIndex].checked = val; - if (val) // turning it on - { -// OK, I know this isn't the best, but I tried and couldn't -// get ToggleButtons to work like I wanted, so I'm faking -// check marks with an '*'. If Motif had nice lefthand -// Bitmaps like Athena.... -#ifndef Athena - fixLabel(item[info->ItemIndex].label); - curLbl[0] = '*'; - setLabel(tmp,curLbl); - XtVaSetValues(info->WItem, // to this menu item - Nlabel,tmp, - NULL); - freeLabel(tmp); -#else -#ifdef AthenaWorks - XtVaSetValues(info->WItem, // to this menu item - XtNleftBitmap, // set the left side - menux_bitmap, // to the X checkbox - NULL); -#endif -#endif - } - else - { -#ifndef Athena - fixLabel(item[info->ItemIndex].label); - setLabel(tmp,curLbl); - XtVaSetValues(info->WItem, // to this menu item - Nlabel,tmp, - NULL); - freeLabel(tmp); -#else -#ifdef AthenaWorks - XtVaSetValues(info->WItem, // to this menu item - XtNleftBitmap, // set the left side - menuclr_bitmap, // to the X clearbox - NULL); -#endif -#endif - } - break; - - case Sensitive: // sensitive - item[info->ItemIndex].sensitive = val; - XtVaSetValues(info->WItem, // set sens or not - Nsensitive, val, // how to set - NULL); - break; - } // end switch - } - } - } - } - -//================>>> vPopupMenu::SetString <<<======================== - void vPopupMenu::SetString(ItemVal id, VCONST char* str) - { - // Set the given item on or off - - vMenu* item; - - // Search all menus in this window - for (int ix = 0 ; ix < _nextSubMenu ; ++ix) - { - PMenuInfo* info; // for current info - - // scan the list of info for each menu entry - for (info = _mb[ix].mInfo ; info != 0 ; info = info->NxtInfo) - { - item = _mb[ix].SubMenu; // The current item in list - - if (item[info->ItemIndex].menuId == id) - { - // Ah Ha! We found the value we want - fixLabel(str); -#ifndef Athena - item[info->ItemIndex].label = str; - // This is flakey, but you have to check for check here - if (item[info->ItemIndex].checked) - curLbl[0] = '*'; -#endif - setLabel(tmp,curLbl); - - XtVaSetValues(info->WItem, // change label - Nlabel, tmp, - NULL); - - freeLabel(tmp); - } - } - } - } - -//==================>>> vPopupMenu::doSubMenu <<<======================== - void vPopupMenu::doSubMenu(Widget parent, Widget subitem, int x, int y) - { - // Maybe popup a submenu - - // Scan all menus in this window looking for widget corresponding - // to the widget that generated the callback - for (int ix = 0 ; ix < _nextSubMenu ; ++ix) - { - if (_mb[ix].XPopUp == parent) - { - PMenuInfo* info; // for current info - for (info = _mb[ix].mInfo ; info != 0 ; info = info->NxtInfo) - { - if (info->WItem == subitem) - { - vMenu* item = _mb[ix].SubMenu; // The first item in list - - // look at static definition to see if this one had a - // submenu. If so, then it is the one we are looking for. - if (item[info->ItemIndex].SubMenu != 0) - { - // get the popup shell for the submenu and pop it up. - Widget submenu = _mb[info->SubMenuIndex].XPopUp; - XtVaSetValues(submenu, XtNx, x, XtNy, y, NULL); - XtPopup(submenu, XtGrabExclusive); - theApp->XWaitUntilMapped(submenu); - return; - } - } - } - break; - } - } - // we didn't find a value - } - -//================>>> subMenuAction <<<======================== - static void subMenuAction(Widget w, XEvent *event, - String *params, Cardinal *nparams) - { -#ifdef Athena -#ifdef AthenaWorks - Dimension width, height; - int x, y; - Widget cw = XawSimpleMenuGetActiveEntry(w); - - if (cw == 0 || event->type != MotionNotify) - return; - - x = event->xmotion.x; - y = event->xmotion.y; - - XtVaGetValues(w, XtNwidth, &width, XtNheight, &height, NULL); - - if (x < 0 || x >= width || y < 0 || y >= height) - return; - - /* - ** Only the second half of the menu is sensitve to pulls - */ - if (x < (width - (width / 3))) - return; - - vPopupMenu* mypane = theApp->GetMenuThis(w); - - if (mypane == 0) - return; - - // Don't mess with this too much -- the sub menu seems to need - // to popup over the cursor, or it loses track of things. - x = event->xmotion.x_root - 10 ; // Make sure cursor shows - y = event->xmotion.y_root - 10 ; - - mypane->doSubMenu(w, cw, x, y); - -#ifdef ITWORKS - for (cur = rightHead; cur != NULL && cur->widget != cw; cur = cur->next) - ; - - if (cur == NULL) - return; - - XtVaSetValues(cur->shell, XtNx, x, XtNy, y, NULL); - - XtPopup(cur->shell, XtGrabExclusive); -#endif -#endif -#endif - } - -//====================>>> vPopupMenu::ShowMenu <<<====================== - void vPopupMenu::ShowMenu(int x, int y) - { - if (!initDone) - { - initDone = 1; - initialize(); - } - - XButtonPressedEvent bp; - - - bp.type = ButtonPress; - bp.display = theApp->display(); - bp.window = 0; - bp.root = 0; - bp.subwindow = 0; - bp.time = 0; - bp.x = x; - bp.y = y; - bp.x_root = x; - bp.x_root = y; - bp.state = 0; - bp.same_screen = 1; - bp.button = 0; - - XmMenuPosition(_topLevelMenu, - (XButtonPressedEvent *)VGlobalButtonPressedEvent); - XtManageChild(_topLevelMenu); -// XtPopup(XtParent(_topLevelMenu),XtGrabNonexclusive); -// XtMapWidget(XtParent(_topLevelMenu)); -// XtMapWidget(_topLevelMenu); - - } diff --git a/v/srcx/vprogrsc.cxx b/v/srcx/vprogrsc.cxx deleted file mode 100644 index 03faf1a..0000000 --- a/v/srcx/vprogrsc.cxx +++ /dev/null @@ -1,414 +0,0 @@ -//=============================================================== -// vprogrsc.cxx - Progress Bar -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // Motif/Athena mapping -#include // our definitions -#include // a command parent -#include -#include -#include -#include - -extern "C" -{ -#include -#include - -#ifndef Athena -#include -#include -#include -#include -#else - -#include -#include -#include -#include -#ifndef DONTUSEx3D -#include -#else -#include -#endif -#endif -} - -#ifndef Athena // -------------------------------------- - -#define lblWidgetClass xmLabelWidgetClass -#define Nheight XmNheight -#define Nlabel XmNlabelString -#define NmappedWhenManaged XmNmappedWhenManaged -#define Nwidth XmNwidth -//@@ These use athena parent for now -#define Nresizable(x) XmNrecomputeSize,x, - -#define setLabel(x,y) XmString x = XmStringCreateSimple(y); -#define freeLabel(x) XmStringFree(x); - -#else //------------------------------------------------------ - -#define lblWidgetClass labelWidgetClass -#define Nheight XtNheight -#define Nlabel XtNlabel -#define NmappedWhenManaged XtNmappedWhenManaged -#define Nwidth XtNwidth -#define Nresizable(x) XtNresizable,x, -#define setLabel(x,y) char* x = y; -#define freeLabel(x) - -#endif // ----------------------------------------------------- - -static Cursor barCursor = 0; - -//=================>>> vProgressCmd::vProgressCmd <<<======================= - vProgressCmd::vProgressCmd(vCmdParent* dp, CommandObject* dc) : - vCmd(dp, dc) - { - initialize(); // and initialize - } - -//=======================>>> vProgressCmd::~vProgressCmd <<<======================= - vProgressCmd::~vProgressCmd() - { - - SysDebug(Constructor,"vProgressCmd::~vProgressCmd() Destructor\n") - - } - -//=====================>>> vProgressCmd::initialize <<<======================= - void vProgressCmd::initialize() - { - - SysDebug(Constructor,"vProgressCmd::vProgressCmd() constructor\n") - - CopyToLocal(); // make local copies - - // Create bitmaps if need to - -#ifdef Athena - if (barCursor == 0) - { - barCursor = XCreateFontCursor(theApp->display(),XC_top_left_arrow); - } -#endif - - Widget WfHoriz = _parentWin->getWidgetFromId(dlgCmd->cRightOf); - Widget WfVert = _parentWin->getWidgetFromId(dlgCmd->cBelow); - - _isVert = (dlgCmd->attrs & CA_Vertical); - _perCent = (dlgCmd->attrs & CA_Percent); - - Dimension ProgressHeight = (dlgCmd->attrs & CA_Large) ? 180 : 110; - if ((dlgCmd->attrs) & CA_Small) - ProgressHeight = 60; - - if (dlgCmd->size > 0) - ProgressHeight = dlgCmd->size; // they gave size - - _ScrlTop = 0; // Always at top - - int* minMax = (int *)_itemList; // giving range? - _minVal = 0; _maxVal = 100; // default min/max - if (minMax != 0) // They gave a range list - { - _minVal = minMax[0]; - _maxVal = minMax[1]; - } - if (_minVal > _maxVal) - { - SysDebug2(BadVals,"vProgressCmd:vProgressCmd - bad range %d to %d\n",_minVal,_maxVal) - _minVal = 0; _maxVal = 100; // make some sense! - } - - if (_retVal < _minVal) // set a legal value for the top - _curVal = _minVal; - else if (_retVal > _maxVal) - _curVal = _maxVal; - else - _curVal = _retVal; - - int map = !(dlgCmd->attrs & CA_Hidden); - - // Create the surrounding box -#ifndef Athena - if (_isVert) - { - wCmd = XtVaCreateManagedWidget( - "vProgressBox", - xmRowColumnWidgetClass, - wParent, // parent - XmNorientation,XmVERTICAL, - XmNspacing,0, - XmNresizeWidth,1, // looks very ugly to resize -// XmNresizeHeight,1, - NmappedWhenManaged, map, - NULL); - } - else - { - wCmd = XtVaCreateManagedWidget( - "vProgressBox", - xmRowColumnWidgetClass, - wParent, // parent - XmNorientation, XmHORIZONTAL, - XmNspacing,0, -// XmNresizeWidth,1, // looks very ugly to resize - XmNresizeHeight,1, - NmappedWhenManaged, map, - NULL); - } -#else - wCmd = XtVaCreateManagedWidget( - "vProgressBox", - boxWidgetClass, - wParent, // parent - XtNorientation, (_isVert) ? XtorientVertical : XtorientHorizontal, - XtNresizable, TRUE, - XtNhSpace,0, - XtNvSpace,0, -#ifndef DONTUSEx3D - XtNborderWidth,0, - XtNbackground, _vControlFace, -#else - XtNbackground, _vControlBG, -#endif - NmappedWhenManaged, map, - NULL); -#endif - if (WfVert != 0) - XtVaSetValues(wCmd, Nbelow(WfVert) NULL); - if (WfHoriz != 0) - XtVaSetValues(wCmd, NrightOf(WfHoriz) NULL); - - int fw = 0; - - if ((dlgCmd->attrs) & CA_NoLabel) - _wLabel = 0; - else - { - - setLabel(tmp, " "); - - fw = XTextWidth(theApp->_XDefaultFont,"999%",4); - - _wLabel = XtVaCreateManagedWidget( - "vProgressLabel", // name - lblWidgetClass, // class - wCmd, // parent -#ifndef Athena - XmNborderWidth,0, - XmNmarginTop,1, - XmNmarginBottom,1, - XmNrecomputeSize,0, - XmNalignment,XmALIGNMENT_END, -#else - XtNinternalHeight,1, // Narrow height - XtNbackground, _vControlBG, - Nresizable(FALSE) // don't resize -#endif - Nwidth,fw+4, // width of "WWW" - Nlabel,tmp, // blank label - NULL); - freeLabel(tmp) - } - - int thickness = 15; - - if (_isVert && fw != 0) - thickness = fw + 6; - else - thickness = theApp->_XDefaultFont->ascent + - theApp->_XDefaultFont->descent + 4; - -#ifndef Athena - int h = thickness; - int w = ProgressHeight; - if (_isVert) // Different hw - { - w = thickness; h = ProgressHeight; - } - - _wScroll = XtVaCreateManagedWidget( - "vProgressBar", // name - xmScrollBarWidgetClass, // class - wCmd, // parent - XmNorientation, (_isVert) ? XmVERTICAL : XmHORIZONTAL, - XmNminimum,0, // go from 1 to 100 - XmNmaximum,100, - XmNshowArrows,False, // No arrows - XmNheight, h, - XmNwidth, w, -// XmNsensitive, 0, // Looks very ugly if not sensitive - ignore input - XmNborderWidth, 0, // no border -// XmNprocessingDirection, (_isVert ? XmMAX_ON_BOTTOM : XmMAX_ON_RIGHT), - NULL); - - -#else // Athena - _wScroll = XtVaCreateManagedWidget( - "vProgressBar", // name -#ifndef DONTUSEx3D - slider3dWidgetClass, // class -#else - scrollbarWidgetClass, // class -#endif - wCmd, // parent - XtNorientation, (_isVert) ? XtorientVertical : XtorientHorizontal, - XtNminimumThumb,1, // 0 doesn't work! causes NO thumb - XtNthickness, thickness, // how wide - XtNlength,ProgressHeight, // high as Progress - XtNresizable, TRUE, - XtNsensitive, 0, // not sensitive to input - XtNborderWidth, 0, // no border - XtNthumb,None, - XtNbackground, _vControlFace, - XtNscrollDCursor, barCursor, - XtNscrollHCursor, barCursor, - XtNscrollLCursor, barCursor, - XtNscrollRCursor, barCursor, - XtNscrollUCursor, barCursor, - XtNscrollVCursor, barCursor, -#ifndef DONTUSEx3D - XtNisProgress,1, - XtNslider3dBackground, _vDialogBG, - XtNforeground,_vControlBG, -#endif - NULL); -#ifndef DONTUSEx3D - if (theApp->Xdepth() > 1) - XtVaSetValues(_wScroll, - XtNforeground, _vControlFace, - NULL); -#endif - -#endif - - SetCmdVal(_curVal,Value); // set scroll and label - wBox = 0; - } - -//==================>>> vProgressCmd::GetCmdValue <<<========================= - int vProgressCmd::GetCmdValue(ItemVal id) VCONST - { - if (id != _cmdId) - return -1; - return _curVal; - } - -//=====================>>> vProgressCmd::mapVal <<<========================= - int vProgressCmd::mapVal(int val) - { - float range = (float)(_maxVal - _minVal); - if (range == 0) - return 100; - float fval = (float)(val - _minVal) * (100. / range); - return (int) fval; - } - -//=====================>>> vProgressCmd::SetCmdVal <<<========================= - void vProgressCmd::SetCmdVal(ItemVal val, ItemSetType st) - { - - SysDebug2(Misc,"vProgressCmd::SetCmdVal(val:%d, type:%d)\n",val,st) - - if (st == Value) - { - if (val > _maxVal || val < _minVal ) - return; - _retVal = - _curVal = val; - // Now set appropriate _curVal, scroll, and highlight - _ScrlShown = mapVal(_curVal); - SetScroll(_ScrlShown, _ScrlTop); - - // Set label if there! - if (_wLabel != 0) // has a label - { - char buff[20]; - IntToStr(_curVal,buff); // string representation - if (_perCent) - strcat(buff,"%"); - setLabel(tmp,buff) - XtVaSetValues(_wLabel, - Nlabel,tmp, -#ifndef Athena - XmNalignment,XmALIGNMENT_CENTER, -#endif - NULL); - freeLabel(tmp) - } - } - else if (st == Hidden) // hide or unhide - { - if (val) - { - XtUnmapWidget(wCmd); // unmap this widget - } - else - { - XtMapWidget(wCmd); // unmap this widget - } - } - } - -//====================>>> vProgressCmd::SetScroll <<<======================= - void vProgressCmd::SetScroll(int Shown, int Top) - { - Arg args[3]; // Used to pass float value - - int shown = Shown; - int top = Top; // work with local copies - -#ifndef Athena - if (shown < 1) shown = 1; - if (shown > 100) shown = 100; - - if (_isVert) - { - // Need these to get thing to show up correctly - XtVaSetValues(_wScroll, XmNsliderSize,1,0); - XtVaSetValues(_wScroll, XmNvalue,100-shown,0); - } - XtVaSetValues(_wScroll, XmNsliderSize,shown,0); -#else - if (_isVert) - { - top = 100 - shown; -#ifdef DONTUSEx3D - if (top >= 100) // Bug in Xt scroll bar - top = 99; -#endif - } - - union - { - XtArgVal arg_value; - float float_value; - } shown_value, top_value; - - shown_value.float_value = float (shown / 100.0); - top_value.float_value = float (top / 100.0); - - if (sizeof (float) > sizeof (XtArgVal)) - { - XtSetArg(args[0], XtNtopOfThumb, &top_value); - XtSetArg(args[1], XtNshown, &shown_value); - } - else - { - XtSetArg(args[0], XtNtopOfThumb, top_value.arg_value); - XtSetArg(args[1], XtNshown, shown_value.arg_value); - } - - XtSetValues(_wScroll, args, 2); // change it! -#endif - } diff --git a/v/srcx/vpsdc.cxx b/v/srcx/vpsdc.cxx deleted file mode 100644 index c754e7c..0000000 --- a/v/srcx/vpsdc.cxx +++ /dev/null @@ -1,1444 +0,0 @@ -//=============================================================== -// vPostScriptDC - a PostScript canvas for drawing -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - - -#include - -#include - -#include // for icons - -#include -#include -#include -#include -#include - -// define entries for font tables - -#define fHelv 0 -#define fHelvObl 1 -#define fHelvBold 2 -#define fHelvBoldObl 3 -#define fTimesRoman 4 -#define fTimesItal 5 -#define fTimesBold 6 -#define fTimesBoldItal 7 -#define fSymbol 8 -#define fCourier 9 -#define fCourierObl 10 -#define fCourierBold 11 -#define fCourierBoldObl 12 - - static const char *fontNames[] = - { - "Helvetica", "Helvetica-Oblique", "Helvetica-Bold", "Helvetica-BoldOblique", - "Times-Roman", "Times-Italic", "Times-Bold", "Times-BoldItalic", - "Symbol", - "Courier", "Courier-Oblique", "Courier-Bold", "Courier-BoldOblique", - 0 - }; - -// These tables have the width in 1/1000's of a point for a 1 point size -// character, as determined by PostScript .afm files. Thus, -// 278 means a 1 point character is .278 points wide. -static short fontW[][256] = { -{ /*Helvetica*/ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 278, 278, 355, 556, 556, 889, 667, 222, 333, 333, 389, 584, 278, 333, 278, 278, - 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 278, 278, 584, 584, 584, 556, -1015, 667, 667, 722, 722, 667, 611, 778, 722, 278, 500, 667, 556, 833, 722, 778, - 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 278, 278, 278, 469, 556, - 222, 556, 556, 500, 556, 556, 278, 556, 556, 222, 222, 500, 222, 833, 556, 556, - 556, 556, 333, 500, 278, 556, 500, 722, 500, 500, 500, 334, 260, 334, 584, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 333, 556, 556, 167, 556, 556, 556, 556, 191, 333, 556, 333, 333, 500, 500, - 0, 556, 556, 556, 278, 0, 537, 350, 222, 333, 333, 556,1000,1000, 0, 611, - 0, 333, 333, 333, 333, 333, 333, 333, 333, 0, 333, 333, 0, 333, 333, 333, -1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0,1000, 0, 370, 0, 0, 0, 0, 556, 778,1000, 365, 0, 0, 0, 0, - 0, 889, 0, 0, 0, 278, 0, 0, 222, 611, 944, 611, 0, 0, 0, 0 -}, - -{ /*Helvetica-Oblique*/ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 278, 278, 355, 556, 556, 889, 667, 222, 333, 333, 389, 584, 278, 333, 278, 278, - 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 278, 278, 584, 584, 584, 556, -1015, 667, 667, 722, 722, 667, 611, 778, 722, 278, 500, 667, 556, 833, 722, 778, - 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 278, 278, 278, 469, 556, - 222, 556, 556, 500, 556, 556, 278, 556, 556, 222, 222, 500, 222, 833, 556, 556, - 556, 556, 333, 500, 278, 556, 500, 722, 500, 500, 500, 334, 260, 334, 584, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 333, 556, 556, 167, 556, 556, 556, 556, 191, 333, 556, 333, 333, 500, 500, - 0, 556, 556, 556, 278, 0, 537, 350, 222, 333, 333, 556,1000,1000, 0, 611, - 0, 333, 333, 333, 333, 333, 333, 333, 333, 0, 333, 333, 0, 333, 333, 333, -1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0,1000, 0, 370, 0, 0, 0, 0, 556, 778,1000, 365, 0, 0, 0, 0, - 0, 889, 0, 0, 0, 278, 0, 0, 222, 611, 944, 611, 0, 0, 0, 0 -}, - -{ /*Helvetica-Bold*/ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 278, 333, 474, 556, 556, 889, 722, 278, 333, 333, 389, 584, 278, 333, 278, 278, - 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 333, 333, 584, 584, 584, 611, - 975, 722, 722, 722, 722, 667, 611, 778, 722, 278, 556, 722, 611, 833, 722, 778, - 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 333, 278, 333, 584, 556, - 278, 556, 611, 556, 611, 556, 333, 611, 611, 278, 278, 556, 278, 889, 611, 611, - 611, 611, 389, 556, 333, 611, 556, 778, 556, 556, 500, 389, 280, 389, 584, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 333, 556, 556, 167, 556, 556, 556, 556, 238, 500, 556, 333, 333, 611, 611, - 0, 556, 556, 556, 278, 0, 556, 350, 278, 500, 500, 556,1000,1000, 0, 611, - 0, 333, 333, 333, 333, 333, 333, 333, 333, 0, 333, 333, 0, 333, 333, 333, -1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0,1000, 0, 370, 0, 0, 0, 0, 611, 778,1000, 365, 0, 0, 0, 0, - 0, 889, 0, 0, 0, 278, 0, 0, 278, 611, 944, 611, 0, 0, 0, 0 -}, - -{ /*Helvetica-BoldOblique*/ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 278, 333, 474, 556, 556, 889, 722, 278, 333, 333, 389, 584, 278, 333, 278, 278, - 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 333, 333, 584, 584, 584, 611, - 975, 722, 722, 722, 722, 667, 611, 778, 722, 278, 556, 722, 611, 833, 722, 778, - 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 333, 278, 333, 584, 556, - 278, 556, 611, 556, 611, 556, 333, 611, 611, 278, 278, 556, 278, 889, 611, 611, - 611, 611, 389, 556, 333, 611, 556, 778, 556, 556, 500, 389, 280, 389, 584, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 333, 556, 556, 167, 556, 556, 556, 556, 238, 500, 556, 333, 333, 611, 611, - 0, 556, 556, 556, 278, 0, 556, 350, 278, 500, 500, 556,1000,1000, 0, 611, - 0, 333, 333, 333, 333, 333, 333, 333, 333, 0, 333, 333, 0, 333, 333, 333, -1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0,1000, 0, 370, 0, 0, 0, 0, 611, 778,1000, 365, 0, 0, 0, 0, - 0, 889, 0, 0, 0, 278, 0, 0, 278, 611, 944, 611, 0, 0, 0, 0 -}, - -{ /*Times-Roman*/ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 250, 333, 408, 500, 500, 833, 778, 333, 333, 333, 500, 564, 250, 333, 250, 278, - 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 278, 278, 564, 564, 564, 444, - 921, 722, 667, 667, 722, 611, 556, 722, 722, 333, 389, 722, 611, 889, 722, 722, - 556, 722, 667, 556, 611, 722, 722, 944, 722, 722, 611, 333, 278, 333, 469, 500, - 333, 444, 500, 444, 500, 444, 333, 500, 500, 278, 278, 500, 278, 778, 500, 500, - 500, 500, 333, 389, 278, 500, 500, 722, 500, 500, 444, 480, 200, 480, 541, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 333, 500, 500, 167, 500, 500, 500, 500, 180, 444, 500, 333, 333, 556, 556, - 0, 500, 500, 500, 250, 0, 453, 350, 333, 444, 444, 500,1000,1000, 0, 444, - 0, 333, 333, 333, 333, 333, 333, 333, 333, 0, 333, 333, 0, 333, 333, 333, -1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 889, 0, 276, 0, 0, 0, 0, 611, 722, 889, 310, 0, 0, 0, 0, - 0, 667, 0, 0, 0, 278, 0, 0, 278, 500, 722, 500, 0, 0, 0, 0 -}, - -{ /*Times-Italic*/ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 250, 333, 420, 500, 500, 833, 778, 333, 333, 333, 500, 675, 250, 333, 250, 278, - 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 333, 333, 675, 675, 675, 500, - 920, 611, 611, 667, 722, 611, 611, 722, 722, 333, 444, 667, 556, 833, 667, 722, - 611, 722, 611, 500, 556, 722, 611, 833, 611, 556, 556, 389, 278, 389, 422, 500, - 333, 500, 500, 444, 500, 444, 278, 500, 500, 278, 278, 444, 278, 722, 500, 500, - 500, 500, 389, 389, 278, 500, 444, 667, 444, 444, 389, 400, 275, 400, 541, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 389, 500, 500, 167, 500, 500, 500, 500, 214, 556, 500, 333, 333, 500, 500, - 0, 500, 500, 500, 250, 0, 523, 350, 333, 556, 556, 500, 889,1000, 0, 500, - 0, 333, 333, 333, 333, 333, 333, 333, 333, 0, 333, 333, 0, 333, 333, 333, - 889, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 889, 0, 276, 0, 0, 0, 0, 556, 722, 944, 310, 0, 0, 0, 0, - 0, 667, 0, 0, 0, 278, 0, 0, 278, 500, 667, 500, 0, 0, 0, 0 -}, - -{ /*Times-Bold*/ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 250, 333, 555, 500, 500,1000, 833, 333, 333, 333, 500, 570, 250, 333, 250, 278, - 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 333, 333, 570, 570, 570, 500, - 930, 722, 667, 722, 722, 667, 611, 778, 778, 389, 500, 778, 667, 944, 722, 778, - 611, 778, 722, 556, 667, 722, 722,1000, 722, 722, 667, 333, 278, 333, 581, 500, - 333, 500, 556, 444, 556, 444, 333, 500, 556, 278, 333, 556, 278, 833, 556, 500, - 556, 556, 444, 389, 333, 556, 500, 722, 500, 500, 444, 394, 220, 394, 520, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 333, 500, 500, 167, 500, 500, 500, 500, 278, 500, 500, 333, 333, 556, 556, - 0, 500, 500, 500, 250, 0, 540, 350, 333, 500, 500, 500,1000,1000, 0, 500, - 0, 333, 333, 333, 333, 333, 333, 333, 333, 0, 333, 333, 0, 333, 333, 333, -1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0,1000, 0, 300, 0, 0, 0, 0, 667, 778,1000, 330, 0, 0, 0, 0, - 0, 722, 0, 0, 0, 278, 0, 0, 278, 500, 722, 556, 0, 0, 0, 0 -}, - -{ /*Times-BoldItalic*/ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 250, 389, 555, 500, 500, 833, 778, 333, 333, 333, 500, 570, 250, 333, 250, 278, - 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 333, 333, 570, 570, 570, 500, - 832, 667, 667, 667, 722, 667, 667, 722, 778, 389, 500, 667, 611, 889, 722, 722, - 611, 722, 667, 556, 611, 722, 667, 889, 667, 611, 611, 333, 278, 333, 570, 500, - 333, 500, 500, 444, 500, 444, 333, 500, 556, 278, 278, 500, 278, 778, 556, 500, - 500, 500, 389, 389, 278, 556, 444, 667, 500, 444, 389, 348, 220, 348, 570, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 389, 500, 500, 167, 500, 500, 500, 500, 278, 500, 500, 333, 333, 556, 556, - 0, 500, 500, 500, 250, 0, 500, 350, 333, 500, 500, 500,1000,1000, 0, 500, - 0, 333, 333, 333, 333, 333, 333, 333, 333, 0, 333, 333, 0, 333, 333, 333, -1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 944, 0, 266, 0, 0, 0, 0, 611, 722, 944, 300, 0, 0, 0, 0, - 0, 722, 0, 0, 0, 278, 0, 0, 278, 500, 722, 500, 0, 0, 0, 0 -} -}; -//================>>> vPostScriptDC::vPostScriptDC <<<======================== - vPostScriptDC::vPostScriptDC(const int scalePrinting) - { - // scalePrinting is necessary to get Ms-Windows to print narrow - // lines on output. It is not currently used by the X version. - - SysDebug(Constructor,"vPostScriptDC::vPostScriptDC() constructor\n") - - _font = theApp->GetDefaultFont(); // get the default font - pstream = 0; - _fontIndex = fCourier; - iconPM = 0; - _curColor.Set(0,0,0); // make black - - _physHeight = _printer.GetHeight(); - _physWidth = _printer.GetWidth(); - - } - -//================>>> vPostScriptDC::~vPostScriptDC <<<======================== - vPostScriptDC::~vPostScriptDC() - { - - SysDebug(Destructor,"vPostScriptDC::~vPostScriptDC() destructor\n") - } - -//================>>> vPostScriptDC::BeginPrinting <<<======================== -// int vPostScriptDC::BeginPrinting() - int vPostScriptDC::BeginPrinting(char *filename, int ask, int isColor) - { - char fn[100]; - - if (pstream) // should not happen... - { - pstream->close(); - return 0; - } - - // get an output stream to print to - if (!(pstream = _printer.OpenPrinter())) - return 0; - - // Write the PostScript header we need. - - char date[20], time[20]; - - vGetLocalDate(date); vGetLocalTime(time); - - // write the required header - - char* dname = _printer.GetDocName(); - - { - char msg[300]; - vNoticeDialog note(theApp); - strcpy(msg,"Printing to: \n"); - if (strcmp(dname,"|lpr") == 0) - strcat(msg,"Printer (lpr)"); - else if (dname[0] == '|') - { - strcat(msg,"pipe: "); strcat(msg,dname); - } - else - { - strcat(msg,"file: "); strcat(msg,dname); - } - - note.Notice(msg); - } - - const char* port = (_printer.GetPortrait()) ? "Portrait\n" : "Landscape\n"; - char* papername = _printer.GetPaperName(); - - *pstream << "%!PS-Adobe-2.0\n" - << "%Creator: V\n" - << "%%CreationDate: " << date << " - " << time << "\n" - << "%%Orientation: " - << port - << "%%DocumentPaperSizes: " << papername << "\n" - << "%%Pages: (atend)\n" - << "%%PageOrder: Ascend\n" - << "%%Title: " << dname << "\n" - << "%%DocumentFonts: Courier\n" - << "%%EndComments\n"; - - // Write the ellipse def - *pstream << -"/ellipsedict 8 dict def\n\ -ellipsedict /mtrx matrix put\n\ -/ellipse\n\ -{ ellipsedict begin\n\ - /endangle exch def\n\ - /startangle exch def\n\ - /yrad exch def\n\ - /xrad exch def\n\ - /y exch def\n\ - /x exch def\n\ - /savematrix mtrx currentmatrix def\n\ - x y translate\n\ - xrad yrad scale\n\ - 0 0 1 startangle endangle arc\n\ - savematrix setmatrix\n\ - end\n\ - } def\n"; - - // write other defs we need - *pstream << "%EndProlog\n"; - - _pages = 0; - - BeginPage(); - *pstream << "0.5 setlinewidth /Courier [10 0 0 -10 0 0] selectfont\n"; // make sure we have a font set - return 1; - - } - -//================>>> vPostScriptDC::BeginPage <<<======================== - void vPostScriptDC::BeginPage() - { - if (!pstream) - return; - ++_pages; // bump number of pages so far - - // Put out the %%Page directive - *pstream << "%%Page " << _pages << " " << _pages << "\n"; - *pstream << "initgraphics"; - if (!_printer.GetPortrait()) - *pstream << " 90 rotate"; - *pstream << " [1 0 0 -1 0 "; - if (_printer.GetPortrait()) - *pstream << _physHeight; - else - *pstream << "0"; - *pstream << "] concat\n"; - } - -//================>>> vPostScriptDC::EndPage <<<======================== - void vPostScriptDC::EndPage() - { - if (!pstream) - return; - *pstream << "showpage\n"; - } - -//================>>> vPostScriptDC::EndPrinting <<<======================== - void vPostScriptDC::EndPrinting() - { - if (!pstream) - return; - - EndPage(); - - *pstream << "%%Trailer\n" - << "%%Pages: " << _pages << "\n" - << "%%EOF\n"; - - _printer.ClosePrinter(); // close the printer - pstream = 0; - - } - -//=====================>>> vPostScriptDC::Clear <<<========================== - void vPostScriptDC::Clear(void) - { - // no op - } - -//==================>>> vPostScriptDC::ClearRect <<<========================== - void vPostScriptDC::ClearRect(int x, int y, int width, int height) - { - // no op - } - -//==================>>> vPostScriptDC::DrawColorPoints <<<====================== - void vPostScriptDC::DrawColorPoints(int x, int y, int nPoints, vColor* pointList) - { - // Draw a bunch of color points. - - char hexval[4]; - - if (nPoints < 1) - return; - - int xx = Scale(x+_tx); - int yy = Scale(y+_ty); - - unsigned char bval; - - // This code adapted from 24 bit icon code - - *pstream << "\ngsave 32 dict begin\n/pix24 " - << nPoints * 3 << " string def\n" - << xx << " " << yy << " translate " - << nPoints << " " << 1 << " scale\n" - << nPoints << " " << 1 << " 8 [" - << nPoints << " 0 0 " << 1 << " 0 0]\n" - << "{currentfile pix24 readhexstring pop} false 3 colorimage\n"; - - for (int c8 = 0 ; c8 < nPoints ; c8++) - { - bval = pointList[c8].r(); // red - ByteToStr(bval,hexval); - *pstream << hexval; - - bval = pointList[c8].g(); // green - ByteToStr(bval,hexval); - *pstream << hexval; - - bval = pointList[c8].b(); // blue - ByteToStr(bval,hexval); - *pstream << hexval; - } - - *pstream << "\nend grestore\n"; - - } - -//====================>>> vPostScriptDC::DrawEllipse <<<========================== - void vPostScriptDC::DrawEllipse(int x, int y, int width, int height) - { - static const int angle = (360 * 64); - - if (!pstream) - return; - - if (height == 0 || width == 0) // ignore 0 h/w - return; - - int xx = Scale(x+_tx); - int yy = Scale(y+_ty); - int w = Scale(width); - int h = Scale(height); - - if (w < 0) // convert to something we like - { - w = -w; // make a positive width - xx = xx - w; // translate x - } - if (h < 0) - { - h = -h; // positive h - yy = yy - h; // translate x - } - - if (_brush.brushStyle != vTransparent) - { - SetGCtoBrush(); - *pstream << "newpath\n" - << (xx + (w / 2)) << " " << (yy + (h / 2)) << " " - << (w / 2) << " " << (h / 2) << " 0 360 ellipse\n" - << "fill\n"; - } - - if (_pen.penStyle != vTransparent) - { - SetGCtoPen(); - *pstream << "newpath\n" - << (xx + (w / 2)) << " " << (yy + (h / 2)) << " " - << (w / 2) << " " << (h / 2) << " 0 360 ellipse\n" - << "stroke\n"; - } - } - -//====================>>> vPostScriptDC::DrawIcon <<<========================== - void vPostScriptDC::DrawIcon(int x, int y, vIcon& icon) - { - - // For now, we will only deal with monochrome bitmaps - static unsigned char Xmask[] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80}; - static unsigned char Pmask[] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01}; - char hexval[4]; - - int xx = Scale(x+_tx); - int yy = Scale(y+_ty); - - unsigned char* from = icon.icon; - - if (!pstream) - return; - - // algorithm is simple: reverse bit order, then invert - - if (icon.depth == 8) - { - unsigned char red[256], green[256], blue[256], bval; - - unsigned int numColors = (unsigned int) (*from++) + 1; // how many colors - - unsigned int cx; - - for (unsigned int ix = 0 ; ix < numColors ; ++ix) // map the colors - { - red[ix] = *from++; green[ix] = *from++; blue[ix] = *from++; - } - - *pstream << "%icon8\ngsave 32 dict begin\n/pix8 " - << icon.width*3 << " string def\n" - << xx << " " << yy << " translate " - << icon.width << " " << icon.height << " scale\n" - << icon.width << " " << icon.height << " 8 [" - << icon.width << " 0 0 " << icon.height << " 0 0]\n" - << "{currentfile pix8 readhexstring pop} false 3 colorimage\n"; - - for (int r8 = 0 ; r8 < icon.height ; ++r8) - { - for (int c8 = 0 ; c8 < icon.width ; c8++) - { - cx = (unsigned int)*from++; // fetch the color - - bval = red[cx]; - ByteToStr(bval,hexval); - *pstream << hexval; - - bval = green[cx]; - ByteToStr(bval,hexval); - *pstream << hexval; - - bval = blue[cx]; - ByteToStr(bval,hexval); - *pstream << hexval; - } - *pstream << "\n"; // new line per row - } - *pstream << "end grestore %end icon\n"; - } - else if (icon.depth == 24) - { - unsigned char bval; - - *pstream << "%icon24\ngsave 32 dict begin\n/pix24 " - << icon.width*3 << " string def\n" - << xx << " " << yy << " translate " - << icon.width << " " << icon.height << " scale\n" - << icon.width << " " << icon.height << " 8 [" - << icon.width << " 0 0 " << icon.height << " 0 0]\n" - << "{currentfile pix24 readhexstring pop} false 3 colorimage\n"; - - for (int r8 = 0 ; r8 < icon.height ; ++r8) - { - for (int c8 = 0 ; c8 < icon.width ; c8++) - { - bval = (unsigned int)*from++; // red - ByteToStr(bval,hexval); - *pstream << hexval; - - bval = (unsigned int)*from++; // green - ByteToStr(bval,hexval); - *pstream << hexval; - - bval = (unsigned int)*from++; // blue - ByteToStr(bval,hexval); - *pstream << hexval; - } - *pstream << "\n"; // new line per row - } - *pstream << "end grestore %end icon\n"; - } - else if (icon.depth == 1) - { - unsigned char X, P; - int rowbytes = icon.width / 8; // number of bytes - if ((icon.width & 7) != 0) - ++rowbytes; // bytes padded, need to bump - - *pstream << "%icon\ngsave 32 dict begin\n/pix " - << rowbytes << " string def\n" - << xx << " " << yy << " translate " - << icon.width << " " << icon.height << " scale\n" - << icon.width << " " << icon.height << " 1 [" - << icon.width << " 0 0 " << icon.height << " 0 0]\n" - << "{currentfile pix readhexstring pop} image\n"; - - - for (int row = 0 ; row < icon.height ; ++row) // copy by row - { - for (int col = 0 ; col < rowbytes ; ++col) - { - X = *from++; // copy of X byte - P = 0; - for (int ix = 0 ; ix < 8 ; ++ix) // reverse bits - { - if (X & Xmask[ix]) // masks to invert bits - P |= Pmask[ix]; - } - P = ~P; // invert - ByteToStr(P,hexval); - *pstream << hexval; - } - *pstream << "\n"; // new line per row - } - *pstream << "end grestore %end icon\n"; - } - else // just draw a rectangle for color icons - { - DrawRectangle(x,y,icon.width,icon.height); - return; - } - } - -//====================>>> vPostScriptDC::DrawLine <<<========================== - void vPostScriptDC::DrawLine(int x, int y, int xend, int yend) - { - // Draw a line from x,y to xend,yend - - if (!pstream) - return; - - int xx = Scale(x+_tx); - int yy = Scale(y+_ty); - int xe = Scale(xend+_tx); - int ye = Scale(yend+_ty); - - SetGCtoPen(); - - if (xx < 0) xx = 0; - if (yy < 0) yy = 0; - if (xe < 0) xe = 0; - if (ye < 0) ye = 0; // X hates negative coords - - *pstream << "newpath " - << xx << " " << yy << " moveto " - << xe << " " << ye << " lineto stroke\n"; - } - -//====================>>> vPostScriptDC::DrawLines <<<========================== - void vPostScriptDC::DrawLines(vLine* lineList, int count) - { - // Draw a line from x,y to xend,yend - - if (!pstream) - return; - - vLine* lp = lineList; - SetGCtoPen(); - - for (int num = 0 ; num < count ; ++lp, ++num) - { - int xx = Scale(lp->x+_tx); - int yy = Scale(lp->y+_ty); - int xe = Scale(lp->xend+_tx); - int ye = Scale(lp->yend+_ty); - - - if (xx < 0) xx = 0; - if (yy < 0) yy = 0; - if (xe < 0) xe = 0; - if (ye < 0) ye = 0; // X hates negative coords - - *pstream << "newpath " - << xx << " " << yy << " moveto " - << xe << " " << ye << " lineto stroke\n"; - } - } - -//====================>>> vPostScriptDC::DrawLines <<<========================== - void vPostScriptDC::DrawLines(vPoint* points, int n) - { - // Draw a poly line contecting each point - - if (!pstream) - return; - - vPoint* xpoints; - int lastX, lastY; - - if (n <= 0) - return; - - SetGCtoPen(); - - if (_hasScale || _tx != 0 || _ty != 0) // If we have to scale, then we need to copy - { - xpoints = new vPoint[n]; // allocate space for copy - for (int i = 0; i < n; i++) - { - xpoints[i].x = ((points[i].x+_tx) * _Mult) / _Div; // scale - xpoints[i].y = ((points[i].y+_ty) * _Mult) / _Div; - } - } - else - { - xpoints = points; // just use original values - } - - - *pstream << "newpath\n" - << xpoints[0].x << " " << xpoints[0].y << " moveto\n"; - - lastX = xpoints[0].x; - lastY = xpoints[0].y; - for (int ix = 1; ix < n ; ++ix) - { - int x, y; - - // don't plot identical plots - // this can save lots of disk space for large lines - - x = xpoints[ix].x; - y = xpoints[ix].y; - - if (x != lastX || y != lastY) - *pstream << x << " " << y << " lineto\n"; - - lastX = x; - lastY = y; - } - - *pstream << "stroke\n"; - - if (_hasScale) - delete[]xpoints; - } - -//==================>>> vPostScriptDC::DrawPoint <<<====================== - void vPostScriptDC::DrawPoint(int x, int y) - { - - if (!pstream) - return; - - int xx = Scale(x+_tx); - int yy = Scale(y+_ty); - - if (xx < 0) xx = 0; - if (yy < 0) yy = 0; - - SetGCtoPen(); - *pstream << "newpath\n" - << xx << " " << yy << " moveto " - << xx+1 << " " << yy << " lineto\nstroke\n"; - - } - -//==================>>> vPostScriptDC::DrawPoints <<<====================== - void vPostScriptDC::DrawPoints(vPoint* pointList, int count) - { - - - if (!pstream) - return; - - vPoint* pl = pointList; - - SetGCtoPen(); - - for (int num = 0 ; num < count ; ++pl, ++num) - { - int xx = Scale(pl->x+_tx); - int yy = Scale(pl->y+_ty); - - if (xx < 0) xx = 0; - if (yy < 0) yy = 0; - - *pstream << "newpath\n" - << xx << " " << yy << " moveto " - << xx+1 << " " << yy << " lineto\nstroke\n"; - } - - } - -//==================>>> vPostScriptDC::DrawPolygon <<<====================== - void vPostScriptDC::DrawPolygon(int n, vPoint points[], int fillStyle) - { - // draw a complete polygon (starting point specified twice!) - - if (!pstream) - return; - - vPoint* xpoints; - - if (n <= 0) - return; - - if (_hasScale || _tx != 0 || _ty != 0) // If we have to scale, then we need to copy - { - xpoints = new vPoint[n]; // allocate space for copy - for (int i = 0; i < n; i++) - { - xpoints[i].x = ((points[i].x+_tx) * _Mult) / _Div; // scale - xpoints[i].y = ((points[i].y+_ty) * _Mult) / _Div; - } - } - else - { - xpoints = points; // just use original values - } - - - if (_brush.brushStyle != vTransparent) - { - SetGCtoBrush(); - *pstream << "newpath\n" - << xpoints[0].x << " " << xpoints[0].y << " moveto\n"; - - for (int ix = 1; ix < n ; ++ix) - { - *pstream << xpoints[ix].x << " " << xpoints[ix].y << " lineto\n"; - } - *pstream << "closepath fill\n"; - - } - - if (_pen.penStyle != vTransparent) - { - SetGCtoPen(); - // xpoints2 - *pstream << "newpath\n" - << xpoints[0].x << " " << xpoints[0].y << " moveto\n"; - - for (int ix = 1; ix < n ; ++ix) - { - *pstream << xpoints[ix].x << " " << xpoints[ix].y << " lineto\n"; - } - *pstream << "closepath stroke\n"; - } - - if (_hasScale) - delete[]xpoints; -} - -//==================>>> vPostScriptDC::DrawRectangle <<<====================== - void vPostScriptDC::DrawRectangle(int x, int y, int width, int height) - { - - if (!pstream) - return; - - if (height == 0 || width == 0) // ignore 0 h/w - return; - - int xx = Scale(x+_tx); - int yy = Scale(y+_ty); - int w = Scale(width); - int h = Scale(height); - - if (w < 0) // convert to something we like - { - w = -w; // make a positive width - xx = xx - w; // translate x - } - if (h < 0) - { - h = -h; // positive h - yy = yy - h; // translate x - } - - if (_brush.brushStyle != vTransparent) - { - SetGCtoBrush(); - *pstream << "newpath\n" - << xx << " " << yy << " moveto\n" - << (xx+w) << " " << yy << " lineto\n" - << (xx+w) << " " << (yy+h) << " lineto\n" - << xx << " " << (yy+h) << " lineto\n" - << "closepath fill\n"; - } - - if (_pen.penStyle != vTransparent) - { - SetGCtoPen(); - *pstream << "newpath\n" - << xx << " " << yy << " moveto\n" - << (xx+w) << " " << yy << " lineto\n" - << (xx+w) << " " << (yy+h) << " lineto\n" - << xx << " " << (yy+h) << " lineto\n" - << "closepath stroke\n"; - } - } - -//==================>>> vPostScriptDC::DrawRectangles <<<====================== - void vPostScriptDC::DrawRectangles(vRect* rectList, int count) - { - - if (!pstream) - return; - - if (_pen.penStyle != vTransparent) - SetGCtoPen(); - if (_brush.brushStyle != vTransparent) - SetGCtoBrush(); - - vRect* rp = rectList; - - for (int num = 0 ; num < count ; ++count, ++rp, ++num) - { - int xx = Scale(rp->x+_tx); - int yy = Scale(rp->y+_ty); - int w = Scale(rp->w); - int h = Scale(rp->h); - - if (h == 0 || w == 0) // ignore 0 h/w - continue; - - if (w < 0) // convert to something we like - { - w = -w; // make a positive width - xx = xx - w; // translate x - } - if (h < 0) - { - h = -h; // positive h - yy = yy - h; // translate x - } - - if (_brush.brushStyle != vTransparent) - { - *pstream << "newpath\n" - << xx << " " << yy << " moveto\n" - << (xx+w) << " " << yy << " lineto\n" - << (xx+w) << " " << (yy+h) << " lineto\n" - << xx << " " << (yy+h) << " lineto\n" - << "closepath fill\n"; - } - - if (_pen.penStyle != vTransparent) - { - *pstream << "newpath\n" - << xx << " " << yy << " moveto\n" - << (xx+w) << " " << yy << " lineto\n" - << (xx+w) << " " << (yy+h) << " lineto\n" - << xx << " " << (yy+h) << " lineto\n" - << "closepath stroke\n"; - } - } - } - -//================>>> vPostScriptDC::DrawRoundedRectangle <<<=================== - void vPostScriptDC::DrawRoundedRectangle(int x, int y, - int width, int height, int radius) - { - if (!pstream) - return; - - if (height == 0 || width == 0) // ignore 0 h/w - return; - - int xx = Scale(x+_tx); - int yy = Scale(y+_ty); - int w = Scale(width); - int h = Scale(height); - int r; - - if (w < 0) // convert to something we like - { - w = -w; // make a positive width - xx = xx - w; // translate x - } - if (h < 0) - { - h = -h; // positive h - yy = yy - h; // translate x - } - - if (radius < 0) - { - // Negative radius means divide average of hight and width - // by this - r = ((w+h)/(-2 * radius)); - } - else - r = Scale(radius); - - int cd = r + r; - - if (_brush.brushStyle != vTransparent) - { - SetGCtoBrush(); - // Because we reflect ourselves, this ends up clockwise... - - *pstream << "newpath\n"; - *pstream << xx + r << " " << yy + r << " " << r << " 180 270 arc\n"; - *pstream << xx + w - r << " " << yy << " lineto\n"; - - *pstream << xx + w - r << " " << yy + r << " " << r << " 270 0 arc\n"; - *pstream << xx + w << " " << yy + h - r << " lineto\n"; - - *pstream << xx + w - r << " " << yy + h - r << " " << r << " 0 90 arc\n"; - *pstream << xx + r << " " << yy + h << " lineto\n"; - - *pstream << xx + r << " " << yy + h - r << " " << r << " 90 180 arc\n"; - *pstream << "closepath fill\n"; - } - - if (_pen.penStyle != vTransparent) - { - SetGCtoPen(); - *pstream << "newpath\n"; - *pstream << xx + r << " " << yy + r << " " << r << " 180 270 arc\n"; - *pstream << xx + w - r << " " << yy << " lineto\n"; - - *pstream << xx + w - r << " " << yy + r << " " << r << " 270 0 arc\n"; - *pstream << xx + w << " " << yy + h - r << " lineto\n"; - - *pstream << xx + w - r << " " << yy + h - r << " " << r << " 0 90 arc\n"; - *pstream << xx + r << " " << yy + h << " lineto\n"; - - *pstream << xx + r << " " << yy + h - r << " " << r << " 90 180 arc\n"; - *pstream << "closepath stroke\n"; - } - } - -//==================>>> vPostScriptDC::DrawRubberEllipse <<<=================== - void vPostScriptDC::DrawRubberEllipse(int x, int y, int width, int height) - { - if (!pstream) - return; - - if (height == 0 || width == 0) // ignore 0 h/w - return; - DrawEllipse(x, y, width, height); - - } - -//==================>>> vPostScriptDC::DrawRubberLine <<<====================== - void vPostScriptDC::DrawRubberLine(int x, int y, int xend, int yend) - { - // Draw a rubber-band line from x,y to xend,yend. Redrawing - // over the same with will erase it. - - if (!pstream) - return; - - DrawLine(x, y, xend, yend); - } - -//==================>>> vPostScriptDC::DrawRubberPoint <<<====================== - void vPostScriptDC::DrawRubberPoint(int x, int y) - { - if (!pstream) - return; - - int xx = Scale(x+_tx); - int yy = Scale(y+_ty); - - if (xx < 0) xx = 0; - if (yy < 0) yy = 0; - - DrawPoint(x, y); - } - -//==================>>> vPostScriptDC::DrawRubberRectangle <<<================== - void vPostScriptDC::DrawRubberRectangle(int x, int y, int width, int height) - { - if (!pstream) - return; - - if (height == 0 || width == 0) // ignore 0 h/w - return; - - DrawRectangle(x, y, width, height); - } - -//=====================>>> vPostScriptDC::DrawAttrText <<<========================== - void vPostScriptDC::DrawAttrText(int x, int y, VCONST char* text, const ChrAttr attr) - { - // Draw text with attributes at given x, y. - - // The fonts may not be equal because we are using a shared GC, - // and another window might change the font in the GC. We - // need to check the current font and change to our font if - // it is not the same - - if (!pstream) - return; - - static int mapColor[] = - { - vC_Black, vC_Blue, vC_Green, vC_Cyan, - vC_Red, vC_Magenta, vC_Yellow, vC_White, - vC_DarkGray, vC_DimBlue, vC_DimGreen, vC_DimCyan, - vC_DimRed, vC_DimMagenta, vC_DimYellow, vC_MedGray - }; - - int xx = Scale(x+_tx); - int yy = Scale(y+_ty); - - // @@@ Note: Attributes are IGNORED!!!! This should be - // fixed some day. - - DrawText(x,y,text); - } - -//=====================>>> vPostScriptDC::DrawText <<<========================== - void vPostScriptDC::DrawText(int x, int y, VCONST char* text) - { - // simple draw text at given x, y - - // The fonts may not be equal because we are using a shared GC, - // and another window might change the font in the GC. We - // need to check the current font and change to our font if - // it is not the same - - if (!pstream || !text || !*text) - return; - - int xx = Scale(x+_tx); - int yy = Scale(y+_ty); - - SetGCtoPen(); - - // @@ Note: This text output is the equivalent to drawin - // in transparent mode - the background is not set - // to the current background! Thus usually doesn't - // matter, but should be fixed someday! - - if (_font.GetAngle() == 90) - *pstream << xx << " " << yy << " moveto -90 rotate ("; - else - *pstream << xx << " " << yy << " moveto ("; - - for (VCONST char *cp = text ; *cp ; ++cp) - { - if (*cp == ')' || *cp == '(' || *cp == '\\') - { - *pstream << "\\"; - } - *pstream << *cp; - } - if (_font.GetAngle() == 90) - *pstream << ") show 90 rotate\n"; - else - *pstream << ") show\n"; - if (_font.GetUnderlined()) - { - int width = TextWidth(text); - if (_font.GetAngle() == 90) - { - *pstream << "newpath " - << xx + 1 << " " << yy << " moveto " - << xx + 1 << " " << yy + width << " lineto stroke\n"; - } - else - { - *pstream << "newpath " - << xx << " " << yy + 1 << " moveto " - << xx + width << " " << yy + 1 << " lineto stroke\n"; - } - } - } - -//================>>> vPostScriptDC::SetBackground <<<========================== - void vPostScriptDC::SetBackground(vColor& color) - { - if (!pstream) - return; - // @@ - } - -//=====================>>> vPostScriptDC::SetBrush <<<============================ - void vPostScriptDC::SetBrush(vBrush& brush) - { - _brush = brush; - } - -//=====================>>> vPostScriptDC::SetPrinter <<<============================ - void vPostScriptDC::SetPrinter(vPrinter& printer) - { - _printer = printer; - if (_printer.GetPortrait()) - { - _physHeight = _printer.GetHeight(); - _physWidth = _printer.GetWidth(); - } - else - { - _physWidth = _printer.GetHeight(); - _physHeight = _printer.GetWidth(); - } - } - -//=====================>>> vPostScriptDC::SetPSColor <<<======================== - void vPostScriptDC::SetPSColor(vColor& bc) - { - - if (bc == _curColor) // don't need to change colors? - return; - - _curColor = bc; - - int red = bc.r(); // retrieve color components - int green = bc.g(); - int blue = bc.b(); - - float psRed = (float)(red / 255.0); // convert to 0 to 1.0 - float psGreen = (float)(green / 255.0); // convert to 0 to 1.0 - float psBlue = (float)(blue / 255.0); // convert to 0 to 1.0 - - if (_printer.GetUseColors()) // is it a color printer? - { - *pstream << psRed << " " << psGreen << " " << psBlue << " setrgbcolor\n"; - } - else // use DeviceRGB to DeviceGray conversion - { // as described in PostScript Red book - float gray = (.3*psRed) + (.59*psGreen) + (.11*psBlue); - *pstream << gray << " setgray\n"; - } - } - -//=====================>>> vPostScriptDC::SetGCtoBrush <<<======================== - void vPostScriptDC::SetGCtoBrush() - { - - // Must check color first since PS "brush and pen" share color - - - vColor bc = _brush.GetColor(); - SetPSColor(bc); // set up color - - if (_curBrush == _brush) // no-op if no change - return; - - switch (_brush.brushStyle) - { - case vSolid: - break; - - case vTransparent: - break; - - case vHorizontalHatch: - { - break; - } - - case vVerticleHatch: - { - break; - } - - case vLeftDiagonalHatch: - { - break; - } - - case vRightDiagonalHatch: - { - break; - } - - case vCrossHatch: - { - break; - } - - case vDiagonalCrossHatch: - { - break; - } - } - _curBrush = _brush; - } - -//=====================>>> vPostScriptDC::SetGCtoPen <<<======================== - void vPostScriptDC::SetGCtoPen() - { - - vColor pc = _pen.GetColor(); - SetPSColor(pc); - - if (_curPen == _pen && _Mult == 1 && _Div == 1) // no-op if no change - return; // and not scaled - - if (_curPen.GetWidth() != _pen.GetWidth() // if change width - || _Mult !=1 || _Div != 1) // or scaled - { - // Using standard PS points, a width of 1 looks too - // big. A width of .5 looks better. - - float penWid = .5; // default case - if (_pen.GetWidth() != 1) - penWid = (float) _pen.GetWidth(); - - *pstream << penWid << " setlinewidth\n"; - } - - if (_curPen.GetStyle() != _pen.GetStyle()) // change style - { - switch (_pen.GetStyle()) - { - case vSolid: - case vTransparent: - *pstream << "[] 0 setdash\n"; - break; - - case vDash: - *pstream << "[6] 0 setdash\n"; - break; - - case vDot: - *pstream << "[2 6] 0 setdash\n"; - break; - - case vDashDot: - *pstream << "[6 6 2 6] 0 setdash\n"; - break; - - default: - *pstream << "[] 0 setdash\n"; - break; - } - } - - _curPen = _pen; - - } - -//=====================>>> vPostScriptDC::SetPen <<<============================ - void vPostScriptDC::SetPen(vPen& pen) - { - _pen = pen; - } - -//======================>>> vPostScriptDC::SetFont <<<=========================== - void vPostScriptDC::SetFont(vFont& vf) - { - // Change the font associated with this window. - - _font = vf; - - // now emit PostScript Level 2 font selection command: - // "/Fontname" "pointsize" selectfont - - if (!pstream) - return; - - vFontID style = _font.GetStyle(); - vFontID weight = _font.GetWeight(); - vFontID family = _font.GetFamily(); - - int fontIndex = fCourier; // default - - switch (family) - { - case vfDefaultSystem: - case vfDefaultFixed: - fontIndex = fCourier; - break; - - case vfDefaultVariable: - fontIndex = fHelv; - break; - - case vfSerif: // serifed font - TimesRoman - case vfSerif2: // serifed font - TimesRoman - if (style == vfItalic) - { - if (weight == vfBold) - fontIndex = fTimesBoldItal; - else - fontIndex = fTimesItal; - - } - else if (weight == vfBold) - fontIndex = fTimesBold; - else - fontIndex = fTimesRoman; - break; - - case vfSansSerif: // SansSerif - Swiss or Helvetica - case vfSansSerif2: // SansSerif - Swiss or Helvetica - if (style == vfItalic) - { - if (weight == vfBold) - fontIndex = fHelvBoldObl; - else - fontIndex = fHelvObl; - } - else if (weight == vfBold) - fontIndex = fHelvBold; - else - fontIndex = fHelv; - break; - - case vfFixed: // fixed font - Courier - case vfFixed2: // fixed font - Courier - if (style == vfItalic) - { - if (weight == vfBold) - fontIndex = fCourierBoldObl; - else - fontIndex = fCourierObl; - } - else if (weight == vfBold) - fontIndex = fCourierBold; - else - fontIndex = fCourier; - break; - - case vfDecorative: // decorative - dingbat - case vfDecorative2: // decorative - dingbat - fontIndex = fSymbol; - break; - - default: - fontIndex = fCourier; - break; - } - - int ptsz = _font.GetPointSize(); - - _fontIndex = fontIndex; // remember current font index - *pstream << "/" << fontNames[fontIndex] - << " [" << ptsz << " 0 0 -" << ptsz << " 0 0] selectfont\n"; - } - -//====================>>> vPostScriptDC::TextHeight <<<============================= - int vPostScriptDC::TextHeight(int& asc, int& des) - { - // Return total height of this font. V will use total height, which - // is most often made up of ascent + descent. This is too much - // detail for the kind of apps V will support. - - int points = _font.GetPointSize(); - asc = points - 1; des = 1; - return points; - } - -//========================>>> vPostScriptDC::TextWidth <<<========================== - int vPostScriptDC::TextWidth(VCONST char* str) - { - int points = _font.GetPointSize(); - long width; - - if (_fontIndex >= fCourier) // fixed point font - { - width = (long) ((points * strlen(str)) * .6); - return (int) (width > 0) ? width : 1; - } - if (_fontIndex < 0) - return 0; - - width = 0; - for (unsigned char* cp = (unsigned char*) str ; *cp ; ++cp) - { - width += fontW[_fontIndex][(short)*cp]; - } - - return (points * width) / 1000; - } diff --git a/v/srcx/vpsprntr.cxx b/v/srcx/vpsprntr.cxx deleted file mode 100644 index 45c6422..0000000 --- a/v/srcx/vpsprntr.cxx +++ /dev/null @@ -1,436 +0,0 @@ -//=============================================================== -// vpsprntr.cxx - a PostScript Printer class - X11 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include -#include -#include -#include - -#include -#include -//#include -#include - -#define prompt_width 32 -#define prompt_height 32 -static unsigned char prompt_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0x1f, 0x04, 0x00, 0x00, 0x20, - 0xe4, 0xff, 0xff, 0x27, 0x14, 0x00, 0x00, 0x28, 0x14, 0xc0, 0x01, 0x28, - 0x14, 0xe0, 0x03, 0x28, 0x14, 0x30, 0x06, 0x28, 0x14, 0x30, 0x06, 0x28, - 0x14, 0x00, 0x03, 0x28, 0x14, 0x80, 0x01, 0x28, 0x14, 0xc0, 0x00, 0x28, - 0x14, 0xc0, 0x00, 0x28, 0x14, 0xc0, 0x00, 0x28, 0x14, 0xc0, 0x00, 0x28, - 0x14, 0x00, 0x00, 0x28, 0x14, 0xc0, 0x00, 0x28, 0x14, 0x00, 0x00, 0x28, - 0xe4, 0xff, 0xff, 0x27, 0x04, 0x00, 0x00, 0x20, 0xf8, 0xff, 0xff, 0x1f, - 0xfe, 0xff, 0xff, 0x7f, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, - 0x02, 0x00, 0xe0, 0x47, 0x02, 0x00, 0x00, 0x40, 0xfa, 0xff, 0xff, 0x5f, - 0xae, 0xaa, 0xaa, 0x6a, 0x56, 0x55, 0x55, 0x55, 0xaa, 0xaa, 0xaa, 0x6a, - 0xfe, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00}; - - static vIcon prompt(&prompt_bits[0], prompt_height, prompt_width); - - // Standard PostScript Papers - - static char* PaperList[] = - { - "Letter (8.5x11)", "Legal", "Tabloid", "Ledger", - "Statement", "Executive", "A3", "A4", - "A5", "B4", "B5", "Folio", - "Quarto", "10x14", 0 - }; - - static int PaperWidths[] = - { - 612, 612, 792, 1224, - 396, 540, 842, 595, - 420, 729, 516, 612, - 610, 720, 0 - }; - - static int PaperHeights[] = - { - 792, 1008, 1224, 792, - 612, 720, 1190, 842, - 595, 1032, 729, 936, - 780, 1008, 0 - }; - - static CommandObject PrintDialog[] = - { - {C_Icon, 10, 0, "Print -", (void*)&prompt, CA_None, isSens,NoFrame,0,0}, - {C_Frame, 11, 0, "",NoList,CA_NoBorder, isSens, NoFrame, 10,0}, - {C_Label, 12, 0, "PostScript Print To", - NoList, CA_None, isSens, 11, 0,0}, - {C_RadioButton,13, 1, "File",NoList,CA_None,isSens,11,12,0}, -// {C_RadioButton,14, 0, "Printer",NoList,CA_None,isSens,11,13,0}, - - {C_Label, 20, 0, "Print to: ",NoList, CA_None,isSens,NoFrame,0,10}, - {C_TextIn,21, 0, "",NoList,CA_None, isSens,NoFrame,20,10}, - {C_Button,22, 0, "Browse",NoList,CA_None,isSens,NoFrame,21,10}, - - {C_RadioButton,30, 1, "Portrait",NoList,CA_None,isSens,NoFrame,0,21}, - {C_RadioButton,31, 0, "Landscape",NoList,CA_None,isSens,NoFrame,30,21}, - - {C_Label,40,0,"Paper:",NoList,CA_None,isSens,NoFrame,0,30}, - {C_ComboBox, 41,vPaperDefault, "",(void*)PaperList,CA_None,isSens,NoFrame,40,30}, - {C_Blank, 49, 0, " ", NoList, CA_None,isSens,NoFrame, 41, 21}, - {C_CheckBox, 33, 0, "Color Printer",NoList,CA_None,isSens,NoFrame,49,21}, - {C_Button, M_Cancel, M_Cancel, " Cancel ", NoList, - CA_None,isSens,NoFrame, 49, 30}, - {C_Button, M_OK, M_OK, " OK ", NoList, - CA_DefaultButton, isSens, NoFrame, M_Cancel, 30}, - {C_EndOfList,0,0,0,0,CA_None,0,0,0,0} - }; - - int vPSPrinter::_instances = 0; // reference counter for copy / assignment - -//================>>> vPSPrinter::vPSPrinter <<<======================== - vPSPrinter::vPSPrinter() : vModalDialog(theApp,"PostScript Printer Setup") - { - _cmdsAdded = 0; - _name = 0; - _paperType = vPaperDefault; - _copies = 1; - _toFile = 1; - _width = PaperWidths[_paperType]; - _height = PaperHeights[_paperType]; - _portrait = 1; - _useColor = 0; - vPSPrinter::_pstream = 0; - - ++_instances; // bump reference counter - } - -//================>>> vPSPrinter::= <<<======================== - vPSPrinter& vPSPrinter::operator =(const vPSPrinter& pr) - { - if (this == &pr) // to self? - return *this; - - if (_name) - delete [] _name; // free space before overwrite - if (_pstream) - delete _pstream; - - _cmdsAdded = pr._cmdsAdded; - _name = pr._name; - _pstream = pr._pstream; - _width = pr._width; - _height = pr._height; - _portrait = pr._portrait; - _useColor = pr._useColor; - _paperType = pr._paperType; - _copies = pr._copies; - _toFile = pr._toFile; - - return *this; - } - -//================>>> vPSPrinter::~vPSPrinter <<<======================== - vPSPrinter::~vPSPrinter() - { - // We are using a reference count to track instances of printers. - // We want to allow the user to pass copies of the single printer - // around, but there should only be one name and one stream; - - --_instances; // not reference any more - - if (_instances > 0) - return; // don't do anything else - - if (_name) - delete [] _name; - if (_pstream) - delete _pstream; - } - -//================>>> vPSPrinter::GetPaperName <<<======================== - char* vPSPrinter::GetPaperName() - { - if (_paperType == vPaperLetter) // we have (8.5x11) added... - return "Letter"; - else - return PaperList[_paperType]; - } - -//================>>> vPSPrinter::OpenPrinter <<<======================== - ofstream* vPSPrinter::OpenPrinter() - { - if (!_name) - { -// char *name = "|lpr"; - char *name = "test.ps"; - _name = new char[strlen(name)+1]; - strcpy(_name, name); - } - - if (_pstream) - _pstream->close(); -/** - if (_name[0]=='|') // see if a pipe or lpr - treat same - { - char *cmdname = (char *)&_name[1]; - - int pipe_fd[2]; - - pipe(pipe_fd); - - if (fork() == 0) // child - { - - close(0); dup(pipe_fd[0]); close(pipe_fd[0]); - - int num_args = 1; - char *p1, *p2; - - p1=(char *)&cmdname[0]; p2=NULL; - - while (*p1!='\0') - { - if (p2) - { - if ((*p1!=' ') && (*p2==' ')) - { - // if passing from ' ' to another character, or - // from another character to ' ', there is an - // argument transition, so count it - num_args++; - } - } - - p2 = p1; - p1++; - } - - int which_arg = 1; // 0 is the command - char **new_argv = new char *[num_args+1]; - new_argv[0] = (char *)&cmdname[0]; - - p1=(char *)&cmdname[0]; p2=NULL; - - if (num_args > 1) // 1 == only the command - { - while (*p1!='\0') - { - if (p2) - { - if ((*p1!=' ') && (*p2==' ')) - { - // if passing from ' ' to another character, or - // from another character to ' ', there is an - // argument transition, so count it - new_argv[which_arg] = p1; - *p2 = '\0'; // insert NULL to separate args - which_arg++; - } - } - - p2 = p1; - p1++; - } - } - - // terminate with NULL pointer - new_argv[which_arg]=NULL; - - char out_char = ' '; - write(pipe_fd[1], &out_char, 1); - close(pipe_fd[1]); - - if (num_args<=1) - { - execlp(cmdname, cmdname, NULL); - } - else - { - execvp(cmdname, &new_argv[0]); - } - -// if we get this far, the execvp() failed, probably due to a mis-typed -// command. We could use a smart error here! -// fprintf(stderr, "exec() failed!\n"); - - // exit(-1); - - } - else // parent - { - - char in_char; - - read(pipe_fd[0], &in_char, 1); - - close(pipe_fd[0]); // unidirectional pipe - - sleep(1); - - } - - _pstream = new ofstream(pipe_fd[1]); - - } - else - { - _pstream = new ofstream(_name); // open output stream - } -**/ - _pstream = new ofstream(_name); // open output stream - return _pstream; - } - -//================>>> vPSPrinter::ClosePrinter <<<======================== - void vPSPrinter::ClosePrinter() - { - if (_pstream) - _pstream->close(); - delete _pstream; - _pstream = 0; - } - -//================>>> vPSPrinter::Setup <<<======================== - int vPSPrinter::Setup(char* fn) - { - // fn is an override default name - - int id, val; - - if (!_cmdsAdded) // only add commands once - { - AddDialogCmds(PrintDialog); // Set up standard dialog - _cmdsAdded = 1; - } - - // set string of textin control to override name if there - if (fn && *fn) - { - SetString(21, fn); - _name = new char[strlen(fn)+1]; // allocate new - strcpy(_name,fn); - } - else - { -// SetString(21, "|lpr"); // pipe to lpr by default - SetString(21, "test.ps"); // pipe to lpr by default - SetValue(13,1,Value); // turn File on -// SetValue(14,0,Value); // turn Printer off - } - - id = ShowModalDialog("Printer Setup", val); // show and wait - switch (id) // convert to our system - { - case M_OK: - { - char name[256]; // a buffer to retrieve name - GetTextIn(21,name,255); // fetch the string user entered - if (!*name) // Make sure gave a name - return 0; - else // copy user name to private copy - { - if (_name) // free old name - delete [] _name; - _name = new char[strlen(name)+1]; // allocate new - strcpy(_name,name); // copy it - return 1; - } - } - - case M_Cancel: - if (_name) { - delete [] _name; - _name = 0; - return 0; - } - }; - return 0; - } - -//================>>> vPSPrinter::DialogCommand <<<================== - void vPSPrinter::DialogCommand(ItemVal id, ItemVal val, CmdType ctype) - { - - static char prevname[255] = ""; - switch (id) - { - - case 22: // "File Dialog" - { - char fname[256]; - int fi = 0; - - vFileSelect fsel(theApp); - - fname[0] = 0; - if (fsel.FileSelectSave("Print to file", fname, 255, 0,fi)) - { - if (_name) // free old name - delete [] _name; - _name = new char[strlen(fname)+1]; // allocate new - strcpy(_name,fname); // copy it - strcpy(prevname,fname); - SetString(21, _name); - SetValue(13,1,Value); - } - break; - } - - case 13: // File - if (val) - { - if (_name) // free old name - delete [] _name; - _name = new char[strlen(prevname)+1]; // allocate new - strcpy(_name,prevname); // copy it - SetString(21, _name); - } - break; - -// case 14: // Printer -// if (val) -// { -// if (_name) // had a previous name -// { -// if (strlen(_name) < 254) -// strcpy(prevname,_name); -// else -// prevname[0] = 0; -// delete [] _name; -// } -// _name = new char[6]; // allocate new -// strcpy(_name,"|lpr"); // copy it -// SetString(21, _name); -// } -// break; - - case 30: // portrait - _portrait = val; - break; - - case 31: // landscape - _portrait = !val; - break; - - case 33: //"Color Printer" - _useColor = val; - break; - - case 41: // Paper type - _paperType = val; - _width = PaperWidths[_paperType]; - _height = PaperHeights[_paperType]; - break; - - default: - vModalDialog::DialogCommand(id,val,ctype); - break; - } - - if (id == M_Yes || id == M_Cancel) - CloseDialog(); - } diff --git a/v/srcx/vradioc.cxx b/v/srcx/vradioc.cxx deleted file mode 100644 index 32dcb08..0000000 --- a/v/srcx/vradioc.cxx +++ /dev/null @@ -1,556 +0,0 @@ -//=============================================================== -// vradiocc.cxx - RadioButtons -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // Motif/Athena mapping -#include // our definitions -#include // a command parent -#include -#include -#ifdef Athena -#include -#endif - -extern "C" -{ -#include - -#ifndef Athena - -#include -#include -#define setLabel(x,y) XmString x = XmStringCreateSimple(y); -#define freeLabel(x) XmStringFree(x); - -#else - -#include -#include -#include -#endif -} - - // Define Static Data - -#ifdef Athena // Athena RB pixels - -#define rbon_width 11 -#define rbon_height 11 -static char rbon_bits[] = { - 0x70, 0x00, 0x8c, 0x01, 0x72, 0x02, 0xfa, 0x02, 0xfd, 0x05, 0xfd, 0x05, - 0xfd, 0x05, 0xfa, 0x02, 0x72, 0x02, 0x8c, 0x01, 0x70, 0x00}; - -// 0x70, 0x00, 0xfc, 0x01, 0xfe, 0x03, 0xfe, 0x03, 0xff, 0x07, 0xff, 0x07, -// 0xff, 0x07, 0xfe, 0x03, 0xfe, 0x03, 0xfc, 0x01, 0x70, 0x00}; -static Pixmap rbon_bitmap = 0; - -#define rboff_width 11 -#define rboff_height 11 -static char rboff_bits[] = { - 0x70, 0x00, 0x8c, 0x01, 0x02, 0x02, 0x02, 0x02, 0x01, 0x04, 0x01, 0x04, - 0x01, 0x04, 0x02, 0x02, 0x02, 0x02, 0x8c, 0x01, 0x70, 0x00}; -static Pixmap rboff_bitmap = 0; - -static int buttonh; // to track height of button - -#define crboff_width 12 -#define crboff_height 12 -static unsigned char crboff_bits[] = - { - 4, // 5 (4+1) colors - 0,0,0, // 0 -> black - 255,255,255, // 1 -> white - 255,255,255, // 2 -> dark - 255,255,255, // 3 -> light - 190,190,190, // 4 -> dialog - 4,4,4,4,2,2,2,2,4,4,4,4, - 4,4,4,2,2,2,2,2,2,4,4,4, - 4,4,2,2,1,1,1,1,3,3,4,4, - 4,2,2,1,1,1,1,1,1,3,3,4, - 2,2,1,1,1,1,1,1,1,1,3,3, - 2,2,1,1,1,1,1,1,1,1,3,3, - 2,2,1,1,1,1,1,1,1,1,3,3, - 2,2,1,1,1,1,1,1,1,1,3,3, - 4,2,2,1,1,1,1,1,1,3,3,4, - 4,4,2,2,1,1,1,1,3,3,4,4, - 4,4,4,3,3,3,3,3,3,4,4,4, - 4,4,4,4,3,3,3,3,4,4,4,4 - }; - - static vIcon rboffIcon(&crboff_bits[0], crboff_height, crboff_width, 8); - -#define crbon_width 12 -#define crbon_height 12 -static unsigned char crbon_bits[] = - { - 4, // 5 (4+1) colors - 0,0,0, // 0 -> black - 255,255,255, // 1 -> white - 255,255,255, // 2 -> dark - 255,255,255, // 3 -> light - 190,190,190, // 4 -> dialog - 4,4,4,4,2,2,2,2,4,4,4,4, - 4,4,4,2,2,2,2,2,2,4,4,4, - 4,4,2,2,1,1,1,1,3,3,4,4, - 4,2,2,1,1,1,1,1,1,3,3,4, - 2,2,1,1,1,0,0,1,1,1,3,3, - 2,2,1,1,0,0,0,0,1,1,3,3, - 2,2,1,1,0,0,0,0,1,1,3,3, - 2,2,1,1,1,0,0,1,1,1,3,3, - 4,2,2,1,1,1,1,1,1,3,3,4, - 4,4,2,2,1,1,1,1,3,3,4,4, - 4,4,4,3,3,3,3,3,3,4,4,4, - 4,4,4,4,3,3,3,3,4,4,4,4 - }; - - static vIcon rbonIcon(&crbon_bits[0], crbon_height, crbon_width, 8); - - static Pixmap _rbOnPm; // rb on pixmap - static Pixmap _rbOffPm; // rb off pixmap - -#endif - - vRadioButtonCmd* vRadioButtonCmd::_RBList = 0; // empty list to start - -//================>>> vRadioButtonCmd::vRadioButtonCmd <<<===================== - vRadioButtonCmd::vRadioButtonCmd(vCmdParent* dp, CommandObject* dc) : - vCmd(dp, dc) - { - // Create bitmaps if need to - - - SysDebug(Constructor,"vRadioButtonCmd::vRadioButtonCmd() constructor\n") - -#ifdef Athena - static int colors_set = 0; - - if (!colors_set) - { - colors_set = 1; - // Fixup the colors in the icons - XColor xc; - xc.pixel = _vDarkControlShadow; // the light shadow - XQueryColor(theApp->display(),theApp->Xcolormap(),&xc); - crbon_bits[7] = crboff_bits[7] = (unsigned char) (xc.red >> 8); - crbon_bits[8] = crboff_bits[8] = (unsigned char) (xc.green >> 8); - crbon_bits[9] = crboff_bits[9] = (unsigned char) (xc.blue >> 8); - - xc.pixel = _vLightControlShadow; // the light shadow - XQueryColor(theApp->display(),theApp->Xcolormap(),&xc); - crbon_bits[10] = crboff_bits[10] = (unsigned char) (xc.red >> 8); - crbon_bits[11] = crboff_bits[11] = (unsigned char) (xc.green >> 8); - crbon_bits[12] = crboff_bits[12] = (unsigned char) (xc.blue >> 8); - - xc.pixel = _vDialogBG; // the dialog background - XQueryColor(theApp->display(),theApp->Xcolormap(),&xc); - crbon_bits[13] = crboff_bits[13] = (unsigned char) (xc.red >> 8); - crbon_bits[14] = crboff_bits[14] = (unsigned char) (xc.green >> 8); - crbon_bits[15] = crboff_bits[15] = (unsigned char) (xc.blue >> 8); - } - - if (rbon_bitmap == 0) - { - rbon_bitmap = XCreateBitmapFromData( - theApp->display(), // our display - DefaultRootWindow(theApp->display()), // a Drawable - rbon_bits, // the bitmap data - rbon_width, // from the file - rbon_height); - } - - if (rboff_bitmap == 0) - { - rboff_bitmap = XCreateBitmapFromData( - theApp->display(), // our display - DefaultRootWindow(theApp->display()), // a Drawable - rboff_bits, // the bitmap data - rboff_width, // from the file - rboff_height); - } - - _rbOnPm = (theApp->Xdepth() > 1) ? rbonIcon.GetXPM() : rbon_bitmap; - _rbOffPm = (theApp->Xdepth() > 1) ? rboffIcon.GetXPM() : rboff_bitmap; - -#endif - - initialize(); // and initialize - } - -//================>>> vRadioButtonCmd::vRadioButtonCmd <<<===================== - vRadioButtonCmd::vRadioButtonCmd(const vRadioButtonCmd& r) : - vCmd(r) - { - vSysError("vRadioButtonCmd - V semantics do not support copy constructors!"); - } - -//===========>>> vRadioButtonCmd::~vRadioButtonCmd <<<====================== - vRadioButtonCmd::~vRadioButtonCmd() - { - // We have to remove ourself from the list of all RBs - - - SysDebug(Destructor,"vRadioButtonCmd::~vRadioButtonCmd() destructor\n") - - if (_RBList == this) // first one special - { - _RBList = _nextRB; - } - else - { - for (vRadioButtonCmd* rbl = _RBList ; rbl != 0 ; rbl = rbl->_nextRB) - { - if (rbl->_nextRB == this) // we found ourself! - { - rbl->_nextRB = _nextRB; // unlink us - break; - } - } - } - } - -//=====================>>> vRadioButtonCmd::initialize <<<======================= - void vRadioButtonCmd::initialize(void) - { - // build a button command for use in a parent window - - CopyToLocal(); // make local copies - - Widget temp; - - Widget WfHoriz = _parentWin->getWidgetFromId(dlgCmd->cRightOf); - Widget WfVert = _parentWin->getWidgetFromId(dlgCmd->cBelow); - - _nextRB = _RBList; // add us in to front of list - _RBList = this; - - int map = !(dlgCmd->attrs & CA_Hidden); - - if (*_title == 0) // can't have 0 length text... - _title = " "; - -#ifndef Athena - - setLabel(tmp,_title) - - wCmd = XtVaCreateManagedWidget( - "vRadioButtonBox", // name - xmToggleButtonWidgetClass, // class - wParent, // parent - XmNindicatorType,XmONE_OF_MANY, - XmNset,_retVal, // start state - XmNlabelString,tmp, - NULL); - - if (WfVert != 0) - XtVaSetValues(wCmd, Nbelow(WfVert) NULL); - if (WfHoriz != 0) - XtVaSetValues(wCmd, NrightOf(WfHoriz) NULL); - freeLabel(tmp) - - XtAddCallback(wCmd, XmNvalueChangedCallback, CRadioButtonCmdCB, (XtPointer)this); - // Need to set to insensitive if it is set insensitive - if (!dlgCmd->Sensitive) - { - XtVaSetValues(wCmd, // the widget to set - XmNsensitive, 0, // change to insensitive - NULL); - } - wBox = _wLabel = 0; - - -#else // Athena ------------------------- - - wBox = XtVaCreateManagedWidget( - "vRadioButtonBox", // name - boxWidgetClass, // class - wParent, // parent - XtNorientation, XtEhorizontal, - XtNborderWidth,0, // no border - XtNhSpace,2, - XtNvSpace,0, - XtNresizable, TRUE, - XtNmappedWhenManaged, map, - NULL); - - if (WfVert != 0) - XtVaSetValues(wBox, Nbelow(WfVert) NULL); - if (WfHoriz != 0) - XtVaSetValues(wBox, NrightOf(WfHoriz) NULL); - - // calculate height to make the box come out next to the label - // if possible. We will also try to make these the same height - // as a button or label - - int asc, des, fh; - - fh = theApp->_XDefaultFont->ascent + theApp->_XDefaultFont->descent; - - buttonh = (rbon_height > fh+6) ? rbon_height : fh+6; - - if (_retVal) // depends on state - { - wCmd = XtVaCreateManagedWidget( - "vRadioButtonOn", // name - commandWidgetClass, // class - wBox, // parent - XtNbitmap,_rbOnPm, - XtNheight,buttonh, // calculate the height - XtNinternalHeight, 0, - XtNinternalWidth, 0, - XtNborderWidth,0, - XtNhighlightThickness,0, // no highlight - XtNresizable, TRUE, - NULL); - } - else - { - wCmd = XtVaCreateManagedWidget( - "vRadioButtonOff", // name - commandWidgetClass, // class - wBox, // parent - XtNbitmap,_rbOffPm, - XtNheight,buttonh, // calculate the height - XtNinternalHeight, 0, - XtNinternalWidth, 0, - XtNborderWidth,0, - XtNhighlightThickness,0, // no highlight - XtNresizable, TRUE, - NULL); - } - - _wLabel = XtVaCreateManagedWidget( - "vRadioButtonLabel", // name - commandWidgetClass, // class - wBox, // parent - XtNlabel, _title, - XtNinternalHeight, 3, // same height as button/label - XtNinternalWidth, 0, - XtNborderWidth,0, // label only, no border - XtNhighlightThickness,0, // no highlight - XtNresizable, TRUE, - NULL); - - XtAddCallback(wCmd, XtNcallback, CRadioButtonCmdCB, (XtPointer)this); - XtAddCallback(_wLabel, XtNcallback, CRadioButtonCmdCB, (XtPointer)this); - - XtVaSetValues(wBox, // the widget to set - XtNbackground, _vDialogBG, NULL); - XtVaSetValues(wCmd, // the widget to set - XtNbackground, _vDialogBG,NULL); - XtVaSetValues(_wLabel, // the widget to set - XtNbackground, _vDialogBG, NULL); - - // Need to set to insensitive if it is set insensitive - if (!dlgCmd->Sensitive) - { - XtVaSetValues(wCmd, // the widget to set - XtNsensitive, 0, // change to insensitive - NULL); - XtVaSetValues(_wLabel, // the widget to set - XtNsensitive, 0, // change insensitive - NULL); - } -#endif - } - -//================>>> vRadioButtonCmd::ResetItemValue <<<====================== - void vRadioButtonCmd::ResetItemValue(void) - { - - // We have to toggle things - - if (_retVal == _origVal) // No op if no change - return; - - _retVal = _origVal; // restore - -#ifndef Athena - XmToggleButtonSetState(wCmd,_retVal,0); -#else - if (_retVal) // depends on state - { - XtVaSetValues(wCmd, // set for this widget - XtNbitmap,_rbOnPm, - XtNheight,buttonh, // calculate the height - NULL); - } - else - { - XtVaSetValues(wCmd, // set for this widget - XtNbitmap,_rbOffPm, // on bitmap - XtNheight,buttonh, // calculate the height - NULL); - } -#endif - - // let parent window handle now - _parentWin->ProcessCmd(_cmdId, _retVal, dlgCmd->cmdType); - } - -//==================>>> vRadioButtonCmd::GetCmdValue <<<========================= - int vRadioButtonCmd::GetCmdValue(ItemVal id) VCONST - { - if (id != _cmdId) - return -1; - return _retVal; - } - -//================>>> vRadioButtonCmd::SetCmdVal <<<======================== - void vRadioButtonCmd::SetCmdVal(ItemVal val, ItemSetType st) - { - - SysDebug1(Misc,"vRadioButtonCmd::SetCmdVal(val:%d)\n",val) - - if (st == Sensitive) - { - dlgCmd->Sensitive = val; // set -#ifndef Athena - XtVaSetValues(wCmd, // the widget to set - XmNsensitive, val, // change sensitive - NULL); -#else - XtVaSetValues(wCmd, // the widget to set - XtNsensitive, val, // change sensitive - NULL); - XtVaSetValues(_wLabel, // the widget to set - XtNsensitive, val, // change sensitive - NULL); -#endif - } - else if (st == Hidden) // hide or unhide - { - if (val) - { -#ifndef Athena - XtUnmapWidget(wCmd); // unmap this widget -#else - XtUnmapWidget(wBox); // unmap this widget -#endif - } - else - { -#ifndef Athena - XtMapWidget(wCmd); // unmap this widget -#else - XtMapWidget(wBox); // unmap this widget -#endif - } - } - else if (st == Value) - { - if (!val) // turning it off - { - _retVal = 0; -#ifndef Athena - XmToggleButtonSetState(wCmd,_retVal,0); -#else - XtVaSetValues(wCmd, // set for this widget - XtNbitmap,_rbOffPm, // off bitmap - XtNheight,buttonh, // calculate the height - NULL); -#endif - } - else - { - RadioButtonCmdCB(0); // just like we clicked it, but no notify - } - } - else - { - SysDebug2(BadVals,"vRadioButtonCmd::SetCmdVal(val:%d, type:%d) - BAD TYPE\n",val,st) - } - - } - -//================>>> vRadioButtonCmd::SetCmdStr <<<========================= - void vRadioButtonCmd::SetCmdStr(VCONST char *str) - { - - SysDebug1(Misc,"vRadioButtonCmd::SetCmdStr(str:%s)\n",str) - - _title = str; -#ifndef Athena - setLabel(tmp,str) - XtVaSetValues(wCmd, // the widget to set - XmNlabelString,tmp, - NULL); - freeLabel(tmp) -#else - XtVaSetValues(_wLabel, // the widget to set - XtNlabel, str, // label - NULL); -#endif - } - -//====================>>> vRadioButtonCmd::RadioButtonCmdCB <<<======================= - void vRadioButtonCmd::RadioButtonCmdCB(int NotifyParent) - { - - // We have to toggle things, so scan the list of all radio buttons, - // searching for other buttons in the same frame - - if (_retVal) // We are already on, so ignore - { -#ifndef Athena - XmToggleButtonSetState(wCmd,1,0); // Don't allow off -#endif - return; - } - - ItemVal ourFrame = dlgCmd->cFrame; // remember our frame - - for (vRadioButtonCmd* rbl = _RBList ; rbl != 0 ; rbl = rbl->_nextRB) - { - CommandObject* dc = rbl->dlgCmd; // shorthand - - if (dc->cFrame == ourFrame) // Radio Button in same frame - { - if (rbl->_retVal) // This one was ON, turn off - { - rbl->_retVal = 0; // toggle -#ifndef Athena - XmToggleButtonSetState(rbl->wCmd,0,0); -#else - XtVaSetValues(rbl->wCmd, // set for this widget - XtNbitmap,_rbOffPm, // off bitmap - XtNheight,buttonh, // calculate the height - NULL); -#endif - // inform parent of change - if (NotifyParent) - _parentWin->ProcessCmd(dc->cmdId, rbl->_retVal, dc->cmdType); - break; - } - } - } - - // Now, we need to turn this RadioButton ON - _retVal = 1; // toggle -#ifndef Athena - XmToggleButtonSetState(wCmd,1,0); -#else - XtVaSetValues(wCmd, // set for this widget - XtNbitmap,_rbOnPm, - XtNheight,buttonh, // calculate the height - NULL); -#endif - // and let the parent window know about the change - if (NotifyParent) - _parentWin->ProcessCmd(_cmdId, _retVal, dlgCmd->cmdType); - } - -extern "C" -{ -//============================>>> CRadioButtonCB <<<============================= - void CRadioButtonCmdCB(Widget w, XtPointer This, XtPointer call_data) - { - ((vRadioButtonCmd*)This)->RadioButtonCmdCB(1); - } -} diff --git a/v/srcx/vrepldlg.cpp b/v/srcx/vrepldlg.cpp deleted file mode 100644 index 43f1039..0000000 --- a/v/srcx/vrepldlg.cpp +++ /dev/null @@ -1,126 +0,0 @@ -//=============================================================== -// vrepldlg.cxx - vReplaceDialog class functions - common win/x -// -// Copyright (C) 1995-1999 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // our header -#include // for icon -#include - -// Define static data of the class - - static CommandObject ReplDialog[] = - { - - {C_Frame, 79, 0, "",NoList,CA_NoBorder,isSens,NoFrame,0,0}, - {C_Frame, 80, 0, "",NoList,CA_None,isSens,79,0,0}, - - {C_Label, 69, 0, " ",NoList, - CA_None,isSens,80, 0,0}, - {C_Label, 91, 0, "Text to find",NoList, - CA_None,isSens,80, 69,0}, - {C_TextIn, 92, 0, "", NoList, - CA_Large,isSens,80,91,0}, - {C_Label, 98, 0, " New Text",NoList, - CA_None,isSens,80, 69,92}, - {C_TextIn, 99, 0, "", NoList, - CA_Large,isSens,80,91,92}, - - - {C_Frame, 81, 0, "",NoList,CA_None,isSens,79,0,80}, - {C_Label, 60, 0, "Search Range",NoList, - CA_None,isSens,81, 0,0}, - {C_RadioButton, 93, 1,"From Cursor",NoList,CA_None, - notSens,81,0,60}, - {C_RadioButton, 94, 0,"Entire File",NoList,CA_None, - notSens,81,0,93}, - - {C_Frame, 82, 0, "",NoList,CA_None,isSens,79,81,80}, - {C_Label, 61, 0, "Search Direction",NoList, - CA_None,isSens,82, 0,0}, - {C_RadioButton, 95, 1,"Forward",NoList,CA_None, - notSens,82,0,61}, - {C_RadioButton, 96, 0,"Backward",NoList,CA_None, - notSens,82,0,95}, - - {C_Frame, 83, 0, "",NoList,CA_None,isSens,79,82,80}, - {C_Label, 62, 0, "Options",NoList, - CA_None,isSens,83, 0,0}, - {C_CheckBox, 97, 0,"Case Sensitive",NoList,CA_None, - isSens,83,0,62}, - {C_CheckBox, 100, 0,"Confirm replace",NoList,CA_None, - isSens,83,0,97}, - - {C_Button, M_OK, 0, "Replace Next", NoList,CA_DefaultButton, - isSens,NoFrame,79,0}, - {C_Button, M_Replace, 0, "Replace All ", NoList,CA_DefaultButton, - isSens,NoFrame,79,M_OK}, - {C_Button, M_Cancel, 0, " Cancel ", NoList,CA_None, - isSens,NoFrame,79,M_Replace}, - {C_EndOfList,0,0,0,0,CA_None,0,0,0} - }; - -//======================>>> vReplaceDialog::AskReplacePat <<<======================= - int vReplaceDialog::AskReplacePat(char* findpat, const int maxlen, - char* replpat, const int maxrlen, - int& caseSens, int& Down, int& Wrap, - int& Prompt, int& All) - { - // Show a message, wait for a reply - // no important return - - int ans; - - if (!findpat || !replpat) - return 0; - - if (!added) - { - ReplDialog[vGetcmdIdIndex(92, ReplDialog)].title = findpat; - ReplDialog[vGetcmdIdIndex(99, ReplDialog)].title = replpat; - AddDialogCmds(ReplDialog); // Set up standard dialog - added = 1; - } - - if (*findpat) - SetString(92,findpat); - if (*replpat) - SetString(99,replpat); - SetValue(97,caseSens,Value); - SetValue(94,Wrap,Value); - SetValue(95,Down,Value); - - int rv = ShowModalDialog("", ans); // show and WAIT - - if (rv != M_Cancel) - { - (void) GetTextIn(92, findpat, maxlen); - (void) GetTextIn(99, replpat, maxrlen); - caseSens = GetValue(97); // Case sensitive - Wrap = GetValue(94); // Entire file? - Down = GetValue(95); // Down? - Prompt = GetValue(100); - if (rv == M_Replace) - All = 1; - else - All = 0; - return 1; - } - - return 0; - } - -//====================>>> vReplaceDialog::DialogCommand <<<======================= - void vReplaceDialog::DialogCommand(ItemVal id, ItemVal val, CmdType ctype) - { - vModalDialog::DialogCommand(id,val,ctype); - if (id == M_Replace) - CloseDialog(); - } -// --------------------------------------------------------------------- diff --git a/v/srcx/vreply.cxx b/v/srcx/vreply.cxx deleted file mode 100644 index c8a472c..0000000 --- a/v/srcx/vreply.cxx +++ /dev/null @@ -1,107 +0,0 @@ -//=============================================================== -// vreply.cxx - vReplyDialog class functions - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // our header -#include // for icon - -// Define static data of the class - -#define prompt_width 32 -#define prompt_height 32 -static unsigned char prompt_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0x1f, 0x04, 0x00, 0x00, 0x20, - 0xe4, 0xff, 0xff, 0x27, 0x14, 0x00, 0x00, 0x28, 0x14, 0xc0, 0x01, 0x28, - 0x14, 0xe0, 0x03, 0x28, 0x14, 0x30, 0x06, 0x28, 0x14, 0x30, 0x06, 0x28, - 0x14, 0x00, 0x03, 0x28, 0x14, 0x80, 0x01, 0x28, 0x14, 0xc0, 0x00, 0x28, - 0x14, 0xc0, 0x00, 0x28, 0x14, 0xc0, 0x00, 0x28, 0x14, 0xc0, 0x00, 0x28, - 0x14, 0x00, 0x00, 0x28, 0x14, 0xc0, 0x00, 0x28, 0x14, 0x00, 0x00, 0x28, - 0xe4, 0xff, 0xff, 0x27, 0x04, 0x00, 0x00, 0x20, 0xf8, 0xff, 0xff, 0x1f, - 0xfe, 0xff, 0xff, 0x7f, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, - 0x02, 0x00, 0xe0, 0x47, 0x02, 0x00, 0x00, 0x40, 0xfa, 0xff, 0xff, 0x5f, - 0xae, 0xaa, 0xaa, 0x6a, 0x56, 0x55, 0x55, 0x55, 0xaa, 0xaa, 0xaa, 0x6a, - 0xfe, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00}; - - static vIcon prompt(&prompt_bits[0], prompt_height, prompt_width); - - static CommandObject ReplyDialog[] = - { - // Modified: TEH Jan98 - // Put icon + text in a frame so button is below frame. - // With many-line text displays, the button will always be below text. - // Also remove "Blanks" around buttons; not consistant with V look! - // Put OK button to left, and Cancel to right for proper style. - {C_Frame, 30, 0, "", - NoList, CA_NoSpace | CA_NoBorder, isSens, NoFrame, 0, 0}, - {C_Icon, 10, 0, "Reply?", (void*)&prompt, CA_None, isSens, 30, 0, 0}, - {C_Text, 91, 91, "", NoList, - CA_MainMsg | CA_NoBorder ,isSens, 30, 10,0}, - {C_TextIn, 92, 92, "", NoList, - CA_Large, isSens, NoFrame, 0, 30}, - {C_Button, M_OK, M_OK, " OK ", - NoList, CA_DefaultButton, isSens, NoFrame, 0, 92}, - {C_Button, M_Cancel, M_Cancel, " Cancel ", - NoList, CA_None, isSens, NoFrame, M_OK, 92}, - {C_EndOfList,0,0,0,0,CA_None,0,0,0} - }; - -//======================>>> vReplyDialog::Reply <<<======================= - int vReplyDialog::Reply(VCONST char* msg, char* reply, int maxlen, - VCONST char* dflt) - { - // Show a message, wait for a reply - // no important return - - int ans; - - - if (dflt && *dflt) - ReplyDialog[3].title = (char *)dflt; - if (!added) - { - AddDialogCmds(ReplyDialog); // Set up standard dialog - added = 1; - } - -// if (dflt && *dflt) -// { -// if (df != 0) -// delete [] df; -// df = new char[strlen(dflt)+1]; -// strcpy(df,dflt); -// } - - (void) ShowModalDialog(msg, ans); // show and wait - - reply[0] = 0; - - if (ans != M_Cancel) - (void) GetTextIn(92, reply, maxlen); // 1.21a - 1/4/99 - - return ans; - } - -//====================>>> vReplyDialog::DialogDisplayed <<<======================= - void vReplyDialog::DialogDisplayed() - { - if (df && *df) - { - SetString(2,df); // This doesn't work, for some reason... - } - } - -//====================>>> vReplyDialog::DialogCommand <<<======================= - void vReplyDialog::DialogCommand(ItemVal id, ItemVal val, CmdType ctype) - { - vModalDialog::DialogCommand(id,val,ctype); -// if (id == M_OK || id == M_Cancel) -// CloseDialog(); - } -// --------------------------------------------------------------------- diff --git a/v/srcx/vresblue b/v/srcx/vresblue deleted file mode 100644 index 04b6a01..0000000 --- a/v/srcx/vresblue +++ /dev/null @@ -1,7 +0,0 @@ -*vDialogBG: LightSteelBlue2 -*vStatusBarBG: LightSteelBlue2 -*vMenuBarBG: LightSteelBlue3 -*vControlBG: LightSteelBlue3 -*vControlFace: LightSteelBlue2 -*vLightControlShadow: LightSteelBlue1 -*vDarkControlShadow: LightSteelBlue4 diff --git a/v/srcx/vresdefa b/v/srcx/vresdefa deleted file mode 100644 index c8346b4..0000000 --- a/v/srcx/vresdefa +++ /dev/null @@ -1,7 +0,0 @@ -*vDialogBG: gray75 -*vStatusBarBG: gray80 -*vMenuBarBG: gray70 -*vControlBG: gray80 -*vControlFace: gray70 -*vLightControlShadow: gray87 -*vDarkControlShadow: gray50 diff --git a/v/srcx/vresgold b/v/srcx/vresgold deleted file mode 100644 index 4617096..0000000 --- a/v/srcx/vresgold +++ /dev/null @@ -1,7 +0,0 @@ -*vDialogBG: LightGoldenrod2 -*vStatusBarBG: LightGoldenrod1 -*vMenuBarBG: LightGoldenrod3 -*vControlBG: LightGoldenrod2 -*vControlFace: LightGoldenrod3 -*vLightControlShadow: LightGoldenrod1 -*vDarkControlShadow: LightGoldenrod4 diff --git a/v/srcx/vresgree b/v/srcx/vresgree deleted file mode 100644 index 7cf27ca..0000000 --- a/v/srcx/vresgree +++ /dev/null @@ -1,7 +0,0 @@ -*vDialogBG: PaleGreen2 -*vStatusBarBG: PaleGreen1 -*vMenuBarBG: PaleGreen3 -*vControlBG: PaleGreen2 -*vControlFace: PaleGreen3 -*vLightControlShadow: PaleGreen1 -*vDarkControlShadow: PaleGreen4 diff --git a/v/srcx/vresrose b/v/srcx/vresrose deleted file mode 100644 index eda7fc4..0000000 --- a/v/srcx/vresrose +++ /dev/null @@ -1,7 +0,0 @@ -*vDialogBG: MistyRose2 -*vStatusBarBG: MistyRose1 -*vMenuBarBG: MistyRose3 -*vControlBG: MistyRose2 -*vControlFace: MistyRose3 -*vLightControlShadow: MistyRose1 -*vDarkControlShadow: MistyRose4 diff --git a/v/srcx/vresyell b/v/srcx/vresyell deleted file mode 100644 index 5a01bb5..0000000 --- a/v/srcx/vresyell +++ /dev/null @@ -1,7 +0,0 @@ -*vDialogBG: LightYellow2 -*vStatusBarBG: LightYellow1 -*vMenuBarBG: LightYellow3 -*vControlBG: LightYellow2 -*vControlFace: LightYellow3 -*vLightControlShadow: LightYellow1 -*vDarkControlShadow: LightYellow4 diff --git a/v/srcx/vsliderc.cxx b/v/srcx/vsliderc.cxx deleted file mode 100644 index ceba5e5..0000000 --- a/v/srcx/vsliderc.cxx +++ /dev/null @@ -1,408 +0,0 @@ -//=============================================================== -// vsliderc.cxx - SliderCmd -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // Motif/Athena mapping -#include // our definitions -#include // a command parent -#include -#include - -extern "C" -{ -#include -#include - -#ifndef Athena -#include -#include -#else -#include -#ifndef DONTUSEx3D -#include -#else -#include -#endif -#endif -} - -// This bitmap makes the slider a solid bar instead of a half-tone gray -#define slider_width 2 -#define slider_height 2 -static char slider_bits[] = { - 0x03, 0x03}; - -static Pixmap slider_bitmap = 0; - -//=================>>> vSliderCmd::vSliderCmd <<<======================= - vSliderCmd::vSliderCmd(vCmdParent* dp, CommandObject* dc) : - vCmd(dp, dc) - { - initialize(); // and initialize - } - -//=======================>>> vSliderCmd::~vSliderCmd <<<======================= - vSliderCmd::~vSliderCmd() - { - - SysDebug(Constructor,"vSliderCmd::~vSliderCmd() Destructor\n") - - } - -//=====================>>> vSliderCmd::initialize <<<======================= - void vSliderCmd::initialize() - { - - CopyToLocal(); // make local copies - -#ifdef Athena - static char scrollTranslations[] = // make a slider, not a scroll bar - ":StartScroll(Continuous) MoveThumb() NotifyThumb()\n\ - :MoveThumb() NotifyThumb()\n\ - :NotifyScroll(Proportional) EndScroll()"; - - XtCallbackRec scrollProcSlider[] = - { - { CSliderScrollProcCB, this }, - { (XtCallbackProc) 0, (XtPointer) 0} - }; - - XtCallbackRec jumpProcSlider[] = - { - { CSliderJumpProcCB, this }, - { (XtCallbackProc) 0, (XtPointer) 0} - }; -#endif - - SysDebug(Constructor,"vSliderCmd::vSliderCmd() constructor\n") - - // Create bitmaps if need to - - if (slider_bitmap == 0) - { - slider_bitmap = XCreateBitmapFromData( - theApp->display(), // our display - DefaultRootWindow(theApp->display()), // a Drawable - slider_bits, // the bitmap data - slider_width, // from the file - slider_height); - } - - Widget WfHoriz = _parentWin->getWidgetFromId(dlgCmd->cRightOf); - Widget WfVert = _parentWin->getWidgetFromId(dlgCmd->cBelow); - -#ifndef Athena - unsigned char orient = (dlgCmd->attrs & CA_Vertical) ? - XmVERTICAL : XmHORIZONTAL; -#else - XtOrientation orient = (dlgCmd->attrs & CA_Vertical) - ? XtorientVertical : XtorientHorizontal; -#endif - - Dimension SliderHeight = (dlgCmd->attrs & CA_Large) ? 200 : 110; - if (dlgCmd->attrs & CA_Small) - SliderHeight = 60; - if (dlgCmd->size > 0 && dlgCmd->size < 2048) - SliderHeight = dlgCmd->size; - - int* minMax = (int *)_itemList; // giving range? - _minVal = 0; _maxVal = 100; // default min/max - if (minMax != 0) // They gave a range list - { - _minVal = minMax[0]; - _maxVal = minMax[1]; - } - - if (_minVal > _maxVal) - { - SysDebug2(BadVals,"vSliderCmd:vSliderCmd - bad range %d to %d\n",_minVal,_maxVal) - _minVal = 0; _maxVal = 100; // make some sense! - } - - _ScrlShown = 5; - - if (_retVal < _minVal) // set a legal value for the top - _curVal = _minVal; - else if (_retVal > _maxVal) - _curVal = _maxVal; - else - _curVal = _retVal; - - int map = !(dlgCmd->attrs & CA_Hidden); - -#ifndef Athena - int sh = 22; - int sw = SliderHeight; - if (dlgCmd->attrs & CA_Vertical) // could have changed - { - sw = 22; - sh = SliderHeight; - } - - wCmd = XtVaCreateManagedWidget( - "vSlider", // name - xmScaleWidgetClass, // class - wParent, // parent - XmNorientation, orient, - XmNmaximum,_maxVal, - XmNminimum,_minVal, - XmNscaleHeight, sh, // how wide - XmNscaleWidth, sw, // how wide - XmNvalue,_curVal, - XmNshowValue,0, - XmNmappedWhenManaged, map, - NULL); - - if (WfVert != 0) - XtVaSetValues(wCmd, Nbelow(WfVert) NULL); - if (WfHoriz != 0) - XtVaSetValues(wCmd, NrightOf(WfHoriz) NULL); - - XtAddCallback(wCmd, XmNvalueChangedCallback, CSliderJumpProcCB, (XtPointer)this); - XtAddCallback(wCmd, XmNdragCallback, CSliderJumpProcCB, (XtPointer)this); - -#else // Athena - - wCmd = XtVaCreateManagedWidget( - "vSlider", // name -#ifndef DONTUSEx3D - slider3dWidgetClass, // class - wParent, // parent - XtNtranslations, XtParseTranslationTable(scrollTranslations), // new translations -#else - scrollbarWidgetClass, // class - wParent, // parent -#endif - XtNorientation, orient, - XtNscrollProc, scrollProcSlider, // callback for scrolling - XtNjumpProc, jumpProcSlider, // callback for scrolling - XtNminimumThumb,10, - XtNlength,SliderHeight, // high as Slider - XtNresizable, TRUE, - XtNmappedWhenManaged, map, -#ifndef DONTUSEx3D - XtNbackground, _vControlFace, - XtNthickness, 20, // how wide - XtNslider3dBackground, _vControlBG, -#else - XtNbackground, _vControlBG, - XtNthumb,slider_bitmap, - XtNthickness, 15, // how wide -#endif - NULL); - if (WfVert != 0) - XtVaSetValues(wCmd, Nbelow(WfVert) NULL); - if (WfHoriz != 0) - XtVaSetValues(wCmd, NrightOf(WfHoriz) NULL); - -#endif - - - // Need to set to insensitive if it is set insensitive - if (!_Sensitive) - { - XtVaSetValues(wCmd, // the widget to set -#ifndef Athena - XmNsensitive, 0, // change to insensitive -#else - XtNsensitive, 0, // change to insensitive -#endif - NULL); - } - - SetCmdVal(_curVal,Value); - - wBox = 0; // Not using box - } - -//==================>>> vSliderCmd::GetCmdValue <<<========================= - int vSliderCmd::GetCmdValue(ItemVal id) VCONST - { - if (id != _cmdId) - return -1; - return _curVal; - } - -//=====================>>> vSliderCmd::mapVal <<<========================= - int vSliderCmd::mapVal(int val) - { -#ifndef Athena - return val; -#else - float range = (float)(_maxVal - _minVal); -#ifndef DONTUSEx3D - float fval = (float)(val - _minVal) * (95. / range); -#else - float fval = (float)(val - _minVal) * (100. / range); -#endif - return (int) fval; -#endif - } - -//=====================>>> vSliderCmd::SetCmdVal <<<========================= - void vSliderCmd::SetCmdVal(ItemVal val, ItemSetType st) - { - - SysDebug2(Misc,"vSliderCmd::SetCmdVal(val:%d, type:%d)\n",val,st) - - if (st == Value) - { - if (val < _minVal || val > _maxVal ) - return; - _curVal = val; - // Now set appropriate _curVal, scroll, and highlight - _ScrlTop = mapVal(_curVal); - SetScroll(_ScrlShown, _ScrlTop); - } - else if (st == Sensitive) - { - _Sensitive = val; - XtVaSetValues(wCmd, // the widget to set -#ifndef Athena - XmNsensitive, val, // change to val -#else - XtNsensitive, val, // change to val -#endif - NULL); - } - else if (st == Hidden) // hide or unhide - { - if (val) - { - XtUnmapWidget(wCmd); // unmap this widget - } - else - { - XtMapWidget(wCmd); // unmap this widget - } - } - } - -//====================>>> vSliderCmd::JumpProcCB <<<======================= - void vSliderCmd::JumpProcCB(float percent, int mVal) - { - int intPercent = (int) (percent * 100.); - int retVal; - float newVal; - -#ifndef Athena - retVal = mVal; -#else - - int shown = _ScrlShown; - int min_top; - - min_top = 100 - shown; - - if (intPercent > min_top) // have to fix it - { - SetScroll(shown, min_top); - } - - // Adjust for shown part - - newVal = percent; - - if (newVal < 0.) // don't allow illegal values - newVal = 0.; - else if (newVal > 1.00) - newVal = 1.00; - - // scale to provided range - - float range = (float)(_maxVal - _minVal); - - // The Xaw 3d version will range from 0 to min_top, so we - // have to map that. - -#ifndef DONTUSEx3D - newVal = ((int)((newVal* 100.) * (range / (float)min_top))) + _minVal; -#else - newVal = ((int)(newVal * range)) + _minVal; -#endif - - retVal = (int)newVal; - -#endif - - if (retVal != _curVal) // only notify if changed - { - _curVal = retVal; - _parentWin->ProcessCmd(_cmdId, _curVal, dlgCmd->cmdType); - } - } - -//====================>>> vSliderCmd::SetScroll <<<======================= - void vSliderCmd::SetScroll(int Shown, int Top) - { -#ifndef Athena - XtVaSetValues(wCmd, XmNvalue, Top, NULL); // change it! -#else - Arg args[3]; // Used to pass float value - - int shown = Shown; - int top = Top; // work with local copies - - if (top > (100 - shown)) - top = 100 - shown; - - union - { - XtArgVal arg_value; - float float_value; - } shown_value, top_value; - - shown_value.float_value = float (shown / 100.0); - top_value.float_value = float (top / 100.0); - - if (sizeof (float) > sizeof (XtArgVal)) - { - XtSetArg(args[0], XtNtopOfThumb, &top_value); - XtSetArg(args[1], XtNshown, &shown_value); - } - else - { - XtSetArg(args[0], XtNtopOfThumb, top_value.arg_value); - XtSetArg(args[1], XtNshown, shown_value.arg_value); - } - - XtSetValues(wCmd, args, 2); // change it! -#endif - } - -//====================>>> vSliderCmd::ScrollProcCB <<<======================= - void vSliderCmd::ScrollProcCB(int position) - { - // No op - } - -extern "C" -{ - -//============================>>> CJumpProcCB <<<============================= - void CSliderJumpProcCB(Widget w, XtPointer This, XtPointer pc_ptr) - { -#ifndef Athena - XmScaleCallbackStruct* scale = (XmScaleCallbackStruct*)pc_ptr; - - ((vSliderCmd*)This)->JumpProcCB(0.0,scale->value); -#else - float percent = *(float*)pc_ptr; // get the percent back - ((vSliderCmd*)This)->JumpProcCB(percent,0); -#endif - } - -//============================>>> CScollProcCB <<<============================= - void CSliderScrollProcCB(Widget w, XtPointer This, XtPointer position) - { - int pos = (int)position; - ((vSliderCmd*)This)->ScrollProcCB(pos); - } -} diff --git a/v/srcx/vslist.cpp b/v/srcx/vslist.cpp deleted file mode 100644 index eea495c..0000000 --- a/v/srcx/vslist.cpp +++ /dev/null @@ -1,136 +0,0 @@ -//=============================================================== -// vSList Class for working with C_List char string lists -// -// Copyright (C) 1995,1996, 1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include - -#include - -#include - -//===========================>>> vSList::vSList <<<======================= - vSList::vSList(int maxsize) - { - list = new char*[maxsize]; - max = maxsize; - init(); - } - -//===========================>>> vSList::~vSList <<<======================= - vSList::~vSList() - { - erase(); // delete contents - delete [] list; // delete the array itself - } - -//=============================>>> vSList::= <<<========================== -// vSList& vSList::operator =(const vSList& slist) -// { -// if (this == &slist) -// return *this; -// -// } - -//=============================>>> vSList::init <<<========================== - void vSList::init() - { - for (int ix = 0 ; ix < max ; ++ix) - list[ix] = 0; - } - -//=============================>>> vsList::erase <<<========================== - void vSList::erase() - { - for (int ix = 0 ; ix < max ; ++ix) - { - if (list[ix] != 0) - delete [] list[ix]; - list[ix] = 0; - } - } - -//========================>>> vSList::size <<<========================== - int vSList::size() const - { - int ix; - for (ix = 0 ; ix < max && list[ix] != 0 ; ++ix) - ; - return ix; - } - -//========================>>> vSList::insert <<<========================== - int vSList::insert(int insAt, const char* strn) const - { - int items = size(); - int iWhere = insAt; - - if (items >= max) - return -1; - - if (iWhere < 0 || iWhere >= max) // append to end - iWhere = items; - - // First, shift the list down by one - - for (int ix = items + 1 ; ix > iWhere ; --ix) - list[ix] = list[ix-1]; - - list[iWhere] = new char[strlen(strn)+1]; - strcpy(list[iWhere],strn); - return items + 1; - } - -//========================>>> vSList::replace <<<========================== - int vSList::replace(int repAt, const char* strn) const - { - int items = size(); - int iWhere = repAt; - - if (items >= max || iWhere < 0 || iWhere >= items) - return -1; - - if (list[iWhere] == 0) - return -1; - - delete [] list[iWhere]; - list[iWhere] = new char[strlen(strn)+1]; - strcpy(list[iWhere],strn); - return items; - } - -//========================>>> vSList::deleteItem <<<========================== - int vSList::deleteItem(int delAt) const - { - int items = size(); - int iWhere = delAt; - - if (iWhere < 0 || iWhere > max) // delete last item - iWhere = items - 1; - - if (iWhere >= items) - return -1; - - // First, delete the given item - - if (list[iWhere] == 0) // oops! - return -1; - - delete [] list[iWhere]; // free the space! - - // Now, shift the list up by one - - for (int ix = iWhere ; ix < items ; ++ix) - list[ix] = list[ix+1]; - - --items; - list[items] = 0; - - return items; - } diff --git a/v/srcx/vspinc.cxx b/v/srcx/vspinc.cxx deleted file mode 100644 index bf73b82..0000000 --- a/v/srcx/vspinc.cxx +++ /dev/null @@ -1,571 +0,0 @@ -//=============================================================== -// vspincc.cxx - vSpinnerCmd -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // Motif/Athena mapping -#include // our definitions -#include // a command parent -#include -#include -#include - -extern "C" -{ -#include -#include - -#ifndef Athena -#include -#include -#include -#include -#include - -#else - -#ifdef USE3D -#include -#endif - -#include -#include -#include -#endif -} - - -#ifndef Athena - -#define lblWidgetClass xmLabelWidgetClass -#define NborderWidth XmNborderWidth -#define Ncallback XmNactivateCallback -#define Nheight XmNheight -#define Nlabel XmNlabelString -#define NmappedWhenManaged XmNmappedWhenManaged -#define Nwidth XmNwidth -//@@ These use athena parent for now -#define Nresizable(x) // XtNresizable,x, -#define Nsensitive XmNsensitive - -#define setLabel(x,y) XmString x = XmStringCreateSimple(y); -#define freeLabel(x) XmStringFree(x); - -#else //------------------------------------------------------ - -#ifdef USE3D -#define cmdWidgetClass command3dWidgetClass -#else -#define cmdWidgetClass commandWidgetClass -#endif -#define lblWidgetClass labelWidgetClass -#define NborderWidth XtNborderWidth -#define Ncallback XtNcallback -#define Nheight XtNheight -#define Nlabel XtNlabel -#define NmappedWhenManaged XtNmappedWhenManaged -#define Nwidth XtNwidth -#define Nresizable(x) XtNresizable,x, -#define Nsensitive XtNsensitive -#define setLabel(x,y) char* x = y; -#define freeLabel(x) - -#endif // ----------------------------------------------------- - -#ifdef Athena -#ifdef USE3D -#define up_width 5 -#define up_height 3 -static char up_bits[] = { - 0x04, 0x0e, 0x1f}; -#define down_width 5 -#define down_height 3 -static char down_bits[] = { - 0x1f, 0x0e, 0x04}; -#else -#define up_width 7 -#define up_height 8 -static char up_bits[] = { - 0x00, 0x08, 0x08, 0x1c, 0x1c, 0x3e, 0x3e, 0x00}; - -#define down_width 7 -#define down_height 8 -static char down_bits[] = { - 0x00, 0x3e, 0x3e, 0x1c, 0x1c, 0x08, 0x08, 0x00}; -#endif - - static Pixmap up_bitmap = 0; - static Pixmap down_bitmap = 0; - -#endif - -//=================>>> vSpinnerCmd::vSpinnerCmd <<<======================= - vSpinnerCmd::vSpinnerCmd(vCmdParent* dp, CommandObject* co) : - vCmd(dp, co) - { - // Create bitmaps if need to - -#ifdef Athena - if (up_bitmap == 0) - { - up_bitmap = XCreateBitmapFromData( - theApp->display(), // our display - DefaultRootWindow(theApp->display()), // a Drawable - up_bits, // the bitmap data - up_width, // from the file - up_height); - } - - if (down_bitmap == 0) - { - down_bitmap = XCreateBitmapFromData( - theApp->display(), // our display - DefaultRootWindow(theApp->display()), // a Drawable - down_bits, // the bitmap data - down_width, // from the file - down_height); - } - -#endif - initialize(); // and initialize - } - -//=======================>>> vSpinnerCmd::~vSpinnerCmd <<<======================= - vSpinnerCmd::~vSpinnerCmd() - { - - SysDebug(Constructor,"vSpinnerCmd::~vSpinnerCmd() Destructor\n") - - } - -//=====================>>> vSpinnerCmd::initialize <<<======================= - void vSpinnerCmd::initialize(void) - { - - Dimension listHeight; - char *label, intval[20]; - - SysDebug(Constructor,"vSpinnerCmd::vSpinnerCmd() constructor\n") - - CopyToLocal(); // make local copies - - // First, setup the list - - SetupList(); - - // build a button command for use in a parent window - - Widget WfHoriz = _parentWin->getWidgetFromId(dlgCmd->cRightOf); - Widget WfVert = _parentWin->getWidgetFromId(dlgCmd->cBelow); - - // We will put a box around the up/down and the label - - int map = !(dlgCmd->attrs & CA_Hidden); - -#ifndef Athena - wBox = XtVaCreateManagedWidget( - "vSpinner", // name - xmFormWidgetClass, // class - wParent, // parent - XmNshadowThickness,2, - XmNshadowType,XmSHADOW_IN, - XmNhorizontalSpacing,0, - XmNverticalSpacing,0, - XmNmarginWidth,0, - XmNmarginHeight,0, - XmNmappedWhenManaged, map, -// XmNrubberPositioning,1, - NULL); -#else - wBox = XtVaCreateManagedWidget( - "vSpinner", // name - formWidgetClass, // class - wParent, // parent - NborderWidth,1, // border around list and scrollbar - XtNdefaultDistance, 0, - XtNresizable, True, - XtNmappedWhenManaged, map, - NULL); - -#endif - if (WfVert != 0) - XtVaSetValues(wBox, Nbelow(WfVert) NULL); - if (WfHoriz != 0) - XtVaSetValues(wBox, NrightOf(WfHoriz) NULL); - - - // _maxWidth setup in SetupList - _maxWidth = (dlgCmd->attrs & CA_Large) ? (_maxWidth * 3)/2 - : _maxWidth; - - if (dlgCmd->size > 0 && dlgCmd->size < 2048) - _maxWidth = dlgCmd->size; - - if (_TextList) - label = _fullList[_curSelection]; - else - { - IntToStr(_curSelection,intval); - label = intval; - } - - setLabel(tmp,label) - - wCmd = XtVaCreateManagedWidget( // The select button - "vComboBoxButton", // name - lblWidgetClass, // class - wBox, // parent - Nwidth, _maxWidth+8, // widest string -#ifndef Athena - Nlabel, (XmString)tmp, // label - XmNtopAttachment,XmATTACH_FORM, - XmNtopOffset,2, - XmNbottomAttachment,XmATTACH_FORM, - XmNbottomOffset,2, - XmNleftAttachment,XmATTACH_FORM, - XmNleftOffset,2, - XmNrecomputeSize,0, -#else - Nlabel, tmp, // label - XtNjustify, XtJustifyLeft, - Nresizable(FALSE) -#endif - NULL); - - freeLabel(tmp) - -#ifndef Athena - _wUp = XtVaCreateManagedWidget( - "vValueUp", // name - xmArrowButtonWidgetClass, // command - wBox, - NrightOf(wCmd) - XmNhighlightThickness,0, - XmNheight,12, - XmNwidth,15, - XmNarrowDirection,XmARROW_UP, - NULL); - - _wDown = XtVaCreateManagedWidget( - "vValueDown", // name - xmArrowButtonWidgetClass, // command - wBox, - XmNhighlightThickness,0, - XmNheight,12, - XmNwidth,15, - NrightOf(wCmd) - Nbelow(_wUp) - XmNarrowDirection,XmARROW_DOWN, - NULL); -#else - _wUp = XtVaCreateManagedWidget( - "vValueUp", // name - cmdWidgetClass, // command - wBox, - XtNbitmap,up_bitmap, - XtNfromVert,NULL, - XtNvertDistance,0, // at the top - XtNfromHoriz, wCmd, // right of the label -#ifdef USE3D - XtNbackground,_vControlFace, - XtNinternalWidth,2, -#else - XtNinternalHeight,1, - XtNinternalWidth,1, -#endif - NULL); - - _wDown = XtVaCreateManagedWidget( - "vValueDown", // name - cmdWidgetClass, // command - wBox, - XtNbitmap,down_bitmap, - XtNfromVert,_wUp, // below the up arrow - XtNfromHoriz, wCmd, // right of the label -#ifdef USE3D - XtNbackground,_vControlFace, - XtNinternalWidth,2, -#else - XtNinternalHeight,1, - XtNinternalWidth,1, -#endif - NULL); - -#endif - // add callback for action - XtAddCallback(_wUp, Ncallback, CUpCB, (XtPointer)this); - XtAddCallback(_wDown, Ncallback, CDownCB, (XtPointer)this); - - // Need to set to insensitive if it is set insensitive - if (!_Sensitive) - { - XtVaSetValues(wCmd, // the widget to set - Nsensitive, 0, // change to insensitive - NULL); - XtVaSetValues(_wUp, // the widget to set - Nsensitive, 0, // change to insensitive - NULL); - XtVaSetValues(_wDown, // the widget to set - Nsensitive, 0, // change to insensitive - NULL); - } - - } - -//==================>>> vSpinnerCmd::GetCmdValue <<<========================= - int vSpinnerCmd::GetCmdValue(ItemVal id) VCONST - { - if (id != _cmdId) - return -1; - return _curSelection; - } - -//=====================>>> vSpinnerCmd::SetCmdVal <<<========================= - void vSpinnerCmd::SetCmdVal(ItemVal val, ItemSetType st) - { - - SysDebug2(Misc,"vSpinnerCmd::SetCmdVal(val:%d, type:%d)\n",val,st) - - if (st == ChangeListPtr || st == ChangeList) - { - if (st == ChangeListPtr) - _itemList = dlgCmd->itemList; - int oldMax = _maxWidth; // track current max width - - SetupList(); // resetup the list - - if (oldMax > _maxWidth) - _maxWidth = oldMax; // don't let it get narrower - - goto SetValue; - } - else if (st == Hidden) // hide or unhide - { - if (val) - { - XtUnmapWidget(wCmd); // unmap this widget - } - else - { - XtMapWidget(wCmd); // unmap this widget - } - } - else if (st == Value) - { -SetValue: - _curSelection = val; - - if (_TextList) // handle like this for text list - { - if (_curSelection < 0) - _curSelection = 0; - if (_curSelection >= _numItems) - _curSelection = _numItems - 1; - - int newSel = _curSelection; - - if (newSel >= 0 && newSel < _numItems) - { - // Now show the new current selection - - setLabel(tstr,_fullList[_curSelection]) - XtVaSetValues(wCmd, // the widget to set - Nlabel,tstr, // the current value - Nwidth, _maxWidth+4, // widest string - NULL); - freeLabel(tstr) - } - } - else // integer values - { - if (_itemList) - { - if (_curSelection < _minVal) - _curSelection = _minVal; - if (_curSelection >= _maxVal) - _curSelection = _maxVal; - } - char intval[30]; - IntToStr(_curSelection, intval); - setLabel(tmp,intval) - XtVaSetValues(wCmd, // the widget to set - Nlabel,tmp, // the current value - Nwidth, _maxWidth+4, // widest string - NULL); - freeLabel(tmp) - } - - // Need to set explicitly if not yet realized - if (!XtIsRealized(wCmd)) - { - XtVaSetValues(wCmd, - Nwidth,_maxWidth, // widest string - NULL); - } - } - else if (st == Sensitive) - { - _Sensitive = val; - XtVaSetValues(wCmd, // the widget to set - Nsensitive, val, // change to val - NULL); - XtVaSetValues(_wUp, // the widget to set - Nsensitive, val, // change to val - NULL); - XtVaSetValues(_wDown, // the widget to set - Nsensitive, val, // change to val - NULL); - } - } - -//====================>>> vSpinnerCmd::DownUpCB <<<======================= - void vSpinnerCmd::DownUpCB(int down) - { - - // Change the value, either in the list or the value. - // The increment will depend on various things - - if (_TextList) - { - if (down) - { - if (_TextList && _curSelection < (_numItems-1)) - _curSelection += _step; - } - else - { - if (_TextList && _curSelection > 0) - _curSelection -= _step; - } - } - else // up/down mean opposite for numbers - { - if (down) - { - if ((_maxVal == 0 && _minVal == 0) || (_curSelection - _step) >= _minVal) - _curSelection -= _step; - } - else - { - if ((_maxVal == 0 && _minVal == 0) || (_curSelection + _step) <= _maxVal) - _curSelection += _step; - } - } - - // Now show the new current selection - - if (_TextList) - { - setLabel(tmp,_fullList[_curSelection]) - XtVaSetValues(wCmd, // the widget to set - Nlabel,tmp, // the current value - Nwidth, _maxWidth+4, // widest string - NULL); - freeLabel(tmp) - } - else - { - char intval[30]; - IntToStr(_curSelection, intval); - setLabel(tmp,intval) - XtVaSetValues(wCmd, // the widget to set - Nlabel,tmp, // the current value - Nwidth, _maxWidth+4, // widest string - NULL); - freeLabel(tmp) - } - - if (!(dlgCmd->attrs & CA_NoNotify)) // Notify on each selection? - _parentWin->ProcessCmd(_cmdId, _curSelection, dlgCmd->cmdType); - } - -extern "C" -{ -//============================>>> CUpCB <<<============================= - void CUpCB(Widget w, XtPointer This, XtPointer lr) - { - ((vSpinnerCmd*)This)->DownUpCB( 0 ); - } - -//============================>>> CDownCB <<<============================= - void CDownCB(Widget w, XtPointer This, XtPointer lr) - { - ((vSpinnerCmd*)This)->DownUpCB( 1 ); - } -} - -//====================>>> vSpinnerCmd::SetupList <<<======================= - void vSpinnerCmd::SetupList(void) - { - // Set up the list for use - - int width, len; - - // First, count how many items are in the supplied list - - _fullList = (char**)_itemList; // list - - _maxWidth = 0; // no items yet - - if (dlgCmd->attrs & CA_Text) // A text list of values - { - _TextList = 1; // This is a text list - _step = 1; - for ( _numItems = 0 ; _fullList[_numItems] != 0 ; ++_numItems) - { - - len = strlen(_fullList[_numItems]); // strlen - width = XTextWidth(theApp->_XDefaultFont, - _fullList[_numItems], len); - if (width > _maxWidth) - _maxWidth = width; // track largest so far - } - - if (_numItems <= 0) - SysDebug(BadVals,"Bad list provided for Spinner\n"); - - // Set to default value - - if (_retVal >= 0 && _retVal < _numItems) - _curSelection = _retVal; - else - _curSelection = 0; // item 0 by default - } - else // an integer list - { - _TextList = 0; // This is an integer list - - int* minMaxList = (int *) _itemList; // list - _minVal = 0; _maxVal = 0; _step = 1; - if (minMaxList != 0) // provided a range list - { - _minVal = minMaxList[0]; - _maxVal = minMaxList[1]; - _step = minMaxList[2]; - - // Try to make the width pretty - - char buff[20]; - IntToStr(_minVal,buff); - _maxWidth = XTextWidth(theApp->_XDefaultFont, - buff, strlen(buff)); - IntToStr(_maxVal,buff); - int maxW = XTextWidth(theApp->_XDefaultFont, - buff, strlen(buff)); - if (maxW > _maxWidth) - _maxWidth = maxW; - } - else - _maxWidth = XTextWidth(theApp->_XDefaultFont, - "1234567", 10); - _curSelection = _retVal; - } - _maxWidth += 2; // just a little margin - - } diff --git a/v/srcx/vstartup.cxx b/v/srcx/vstartup.cxx deleted file mode 100644 index 3dfe495..0000000 --- a/v/srcx/vstartup.cxx +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include - -//======================>>> main <<<====================================== - int main(int argc, char** argv) - { - int Xargc = argc; - int retcode; - - theApp->initialize(Xargc,argv); // Create top level widget - - if ((retcode = AppMain(Xargc,argv)) != 0) // call the app main program - exit(retcode); - - theApp->doXEventLoop(); // And enter the event loop - } diff --git a/v/srcx/vstatusp.cxx b/v/srcx/vstatusp.cxx deleted file mode 100644 index 6ea4765..0000000 --- a/v/srcx/vstatusp.cxx +++ /dev/null @@ -1,307 +0,0 @@ -//=============================================================== -// vStatusPane - the status bar pane class used by the vWindow class -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include -#include -#include - -extern "C" -{ -#ifndef Athena - -#define lblWidgetClass xmLabelWidgetClass -#define NborderWidth XmNborderWidth -#define Nlabel XmNlabelString -#define Nwidth XmNwidth -#define Nsensitive XmNsensitive - -#include -#include -#include -#define setLabel(x,y) XmString x = XmStringCreateSimple(y); -#define freeLabel(x) XmStringFree(x); - -#else // *** ATHENA - -#define lblWidgetClass labelWidgetClass -#define NborderWidth XtNborderWidth -#define Nlabel XtNlabel -#define Nwidth XtNwidth -#define Nsensitive XtNsensitive - -#include -#include -#include -#define setLabel(x,y) VCONST char* x = y; -#define freeLabel(x) -#endif -} - -#include // we are part of a window -#include -#include - -#ifdef Athena -#define statbar_width 4 -#define statbar_height 2 -static char statbar_bits[] = { - 0x01, 0x04}; -static Pixmap statbar_bitmap = 0; -#endif - -//===================>>> vStatusPane::vStatusPane <<<==================== - vStatusPane::vStatusPane(vStatus* s_bar) : vPane(P_Status) - { - // The main job of this constructor is to add the list of - // status boxes to our internal data structure. We will not - // realize the status boxes until the initialize routine is called. - - StatusList* temp; - - SysDebug(Constructor,"vStatusPane::vStatusPane() constructor\n") - - _statusList = 0; // empty list - - // we are going to reverse these as we realize the list, - // so work the list in reverse order by finding the end first - - int limit; - for (limit = 0 ; s_bar[limit].label ; ++limit) - ; - - // now, work the list backwards - - for (int ix = limit - 1 ; ix >= 0 ; --ix) - { - temp = new StatusList; // a new list cell - temp->statusPtr = &s_bar[ix]; // use the static definition of caller - temp->nextSL = _statusList; // link in - _statusList = temp; // to front of list - } - } - -//===================>>> vStatusPane::vStatusPane <<<==================== - vStatusPane::vStatusPane(const vStatusPane& b) : vPane(b) - { - vSysError("vStatusPane: V Semantics do not allow copy constructors."); - } - -//===================>>> vStatusPane::~vStatusPane <<<==================== - vStatusPane::~vStatusPane() - { - - SysDebug(Destructor,"vStatusPane::~vStatusPane() destructor\n") - - StatusList* temp; - - for (StatusList* sl = _statusList ; sl != 0 ;) - { - temp = sl; // now need to free the status list - sl = sl->nextSL; - delete temp; - } - } - -//===================>>> vStatusPane::ShowPane <<<======================== - void vStatusPane::ShowPane(int OnOrOff) - { - if (OnOrOff) - { - XtManageChild(_statusBar); - } - else - { - XtUnmanageChild(_statusBar); - } - } - -//===================>>> vStatusPane::SetPaneValue <<<======================== - void vStatusPane::SetPaneValue(ItemVal id, int val, ItemSetType setType) - { - // set any matching status boxes in list to val - - - if (setType != Sensitive) - return; - for (StatusList* sl = _statusList ; sl != 0 ; sl = sl->nextSL ) - { - if ((sl->statusPtr)->statId == id) - { - (sl->statusPtr)->sensitive = val; - - XtVaSetValues(sl->w, // the widget to set - Nsensitive, val, // change sensitive - NULL); - } - } - } - -//====================>>> vStatusPane::SetPaneString <<<====================== - void vStatusPane::SetPaneString(ItemVal id, char* str) - { - // change the label in a status - for (StatusList* sl = _statusList ; sl != 0 ; sl = sl->nextSL ) - { - if ((sl->statusPtr)->statId == id) - { - setLabel(tmp,str); - XtVaSetValues(sl->w, // widget - Nlabel, tmp, // change label - NULL); - freeLabel(tmp); - if ((sl->statusPtr)->width > 0) // they specified width - { - XtVaSetValues(sl->w, // the widget to set - Nwidth, (sl->statusPtr)->width, - NULL); - } - } - } - } - -//====================>>> vStatusPane::initialize <<<======================= - void vStatusPane::initialize(vWindow* pWin, Widget pWidget, - Widget drawCanvas, Widget drawArea) - { - // now, build the status bar items in the widget provided - - vPane::initialize(pWin, pWidget); // initialize base class - -#ifdef Athena - // Create pixmap - if (statbar_bitmap == 0) // haven't built the pixmap yet - { - statbar_bitmap = XCreatePixmapFromBitmapData( - theApp->display(), // our display - DefaultRootWindow(theApp->display()), // a Drawable - statbar_bits, // the statbar bitmap data - statbar_width, // from the file - statbar_height, - (unsigned long) theApp->Xfg(), // Forground color - (unsigned long) theApp->Xbg(), // Background color - DefaultDepth(theApp->display(),DefaultScreen(theApp->display()))); - } -#endif - - // Now the status bar that will have status boxes -#ifndef Athena - _Shadow = XtVaCreateManagedWidget( - "vStatusShadow", // name - xmFrameWidgetClass, // class - _baseW, // parent - XmNshadowType,XmSHADOW_IN, - - // PanedWindow constrants - XmNallowResize,0, - XmNskipAdjust,1, - - NULL); - - pWin->setmsgArea(_Shadow); // set our widget - - _statusBar = XtVaCreateManagedWidget( - "vStatusBar", - xmRowColumnWidgetClass, // widget class - _Shadow, // parent widget - // PanedWindow constrants -// XmNallowResize,1, -// XmNskipAdjust,1, - // RowColumn values - XmNspacing,2, - XmNmarginHeight,1, - XmNmarginWidth,1, - XmNnumColumns,1, - XmNadjustMargin,0, - XmNadjustLast,0, - XmNorientation,XmHORIZONTAL, - XmNpacking,XmPACK_TIGHT, - XmNisAligned,0, - - // PanedWindow constrants - XmNallowResize,0, - XmNskipAdjust,1, - - NULL); // argument list -#else - _statusBar = XtVaCreateManagedWidget( - "vStatusBar", - boxWidgetClass, // widget class - _baseW, // parent widget - XtNvSpace,2, - - XtNshowGrip,FALSE, - XtNallowResize,1, // We can resize - XtNresizeToPreferred,1, // To our preferred size - XtNskipAdjust,TRUE, // Change only if have to - NULL); // argument list - - // set the background pattern - if (theApp->Xdepth() <= 1) - XtVaSetValues(_statusBar, // the widget to set - XtNbackgroundPixmap, statbar_bitmap, NULL); - else - XtVaSetValues(_statusBar, // the widget to set - XtNbackground, _vStatusBarBG,NULL); -#endif - - for (StatusList* sl = _statusList ; sl != 0 ; sl = sl->nextSL ) - { - int border = ((sl->statusPtr)->attrs & CA_NoBorder) ? 0 : 1; // border? - - setLabel(tmp, (sl->statusPtr)->label); // label on the status - -#ifndef Athena - // For Motif, make a shadowed border for bordered text - Widget tmpW; // A throwaway widget... - - if (border > 0) - { - tmpW = XtVaCreateManagedWidget( - "vStatusTextShadow", // name - xmFrameWidgetClass, // class - _statusBar, // parent - XmNshadowType,XmSHADOW_ETCHED_IN, - NULL); - sl->w = XtVaCreateManagedWidget( - "vStatusLabel", // name - lblWidgetClass, // type of widget - tmpW, // status's parent - Nlabel, tmp, // label on the status - XmNalignment,XmALIGNMENT_CENTER, - Nsensitive, (sl->statusPtr)->sensitive, // sensitive? - NULL); - } - else // Athena and noborder Motif -#endif - sl->w = XtVaCreateManagedWidget( - "vStatusLabel", // name - lblWidgetClass, // type of widget - _statusBar, // status's parent - Nlabel, tmp, // label on the status - Nsensitive, (sl->statusPtr)->sensitive, // sensitive? - NborderWidth, border, -#ifdef Athena - XtNbackground, _vStatusBarBG, // ATHENA ONLY -#else - XmNalignment,XmALIGNMENT_BEGINNING, -#endif - NULL); - - freeLabel(tmp); - - if ((sl->statusPtr)->width > 0) // they specified width - { - XtVaSetValues(sl->w, // the widget to set - XtNwidth, (sl->statusPtr)->width, - NULL); - } - } - } diff --git a/v/srcx/vtextc.cxx b/v/srcx/vtextc.cxx deleted file mode 100644 index 128fa6d..0000000 --- a/v/srcx/vtextc.cxx +++ /dev/null @@ -1,160 +0,0 @@ -//=============================================================== -// vtextc.cxx - Text output cmd -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // Motif/Athena mapping -#include -#include // our definitions -#include // a command parent -#include - -extern "C" -{ -#include - -#ifndef Athena -#include -#include -#else - -#include -#include -#endif -} - -#ifndef Athena - -#define lblWidgetClass xmLabelWidgetClass -#define NborderWidth XmNborderWidth -#define Ncallback XmNactivateCallback -#define Nheight XmNheight -#define Nlabel XmNlabelString -#define NmappedWhenManaged XmNmappedWhenManaged -#define Nwidth XmNwidth -//@@ These use athena parent for now -#define Nresizable(x) // XtNresizable,x, - -#define setLabel(x,y) XmString x = XmStringCreateLtoR(y,XmFONTLIST_DEFAULT_TAG); -#define freeLabel(x) XmStringFree(x); - -#else //------------------------------------------------------ - -#define lblWidgetClass labelWidgetClass -#define NborderWidth XtNborderWidth -#define Ncallback XtNcallback -#define Nheight XtNheight -#define Nlabel XtNlabel -#define NmappedWhenManaged XtNmappedWhenManaged -#define Nwidth XtNwidth -#define Nresizable(x) XtNresizable,x, -#define setLabel(x,y) char* x = y; -#define freeLabel(x) - -#endif // ----------------------------------------------------- - - -//=====================>>> vTextCmd::vTextCmd <<<======================= - vTextCmd::vTextCmd(vCmdParent* dp, CommandObject* dc) : - vCmd(dp, dc) - { - initialize(); - } - -//=====================>>> vTextCmd::~vTextCmd <<<======================= - vTextCmd::~vTextCmd() - { - - SysDebug(Destructor,"vTextCmd::~vTextCmd() destructor\n") - - } - -//=====================>>> vTextCmd::initialize <<<======================= - void vTextCmd::initialize(void) - { - // build a button command for use in a parent window - - - SysDebug(Constructor,"vTextCmd::vTextCmd() constructor\n") - - CopyToLocal(); // make local copies - - Widget WfHoriz = _parentWin->getWidgetFromId(dlgCmd->cRightOf); - Widget WfVert = _parentWin->getWidgetFromId(dlgCmd->cBelow); - - char* theText = (_itemList && *(char*)_itemList) ? (char *) _itemList - : _title; - int border = (dlgCmd->attrs & CA_NoBorder) ? 0 : 1; // border? - - int map = !(dlgCmd->attrs & CA_Hidden); - - setLabel(tmp,theText) -#ifndef Athena - wCmd = XtVaCreateManagedWidget( - "vText", // name - lblWidgetClass, // class - wParent, // parent - Nlabel, tmp, // label - NborderWidth,border, // A border! - NmappedWhenManaged, map, - NULL); -#else - wCmd = XtVaCreateManagedWidget( - "vText", // name - lblWidgetClass, // class - wParent, // parent - Nlabel, tmp, // label - NborderWidth,border, // A border! - Nresizable(TRUE) - NmappedWhenManaged, map, - XtNbackground, _vControlBG, - NULL); -#endif - if (WfVert != 0) - XtVaSetValues(wCmd, Nbelow(WfVert) NULL); - if (WfHoriz != 0) - XtVaSetValues(wCmd, NrightOf(WfHoriz) NULL); - freeLabel(tmp) - - wBox = 0; // no Box, but make copy for placement - - } - -//================>>> vTextCmd::SetCmdVal <<<============================ - void vTextCmd::SetCmdVal(ItemVal val, ItemSetType st) - { - - if (st == Hidden) // hide or unhide - { - if (val) - { - XtUnmapWidget(wCmd); // unmap this widget - } - else - { - XtMapWidget(wCmd); // unmap this widget - } - } - } - -//================>>> vTextCmd::SetCmdStr <<<============================ - void vTextCmd::SetCmdStr(VCONST char* str) - { - - SysDebug1(Misc,"vTextCmd::SetCmdStr(str:%s)\n",str) - - _title = str; - setLabel(tmp,str) // allocate label - XtVaSetValues(wCmd, // the widget to set - Nlabel, tmp, // label - NULL); - freeLabel(tmp) - - - } diff --git a/v/srcx/vtextcnv.cxx b/v/srcx/vtextcnv.cxx deleted file mode 100644 index 82f2d1d..0000000 --- a/v/srcx/vtextcnv.cxx +++ /dev/null @@ -1,662 +0,0 @@ -//=============================================================== -// vtextcnv.cxx - TextCanvasPane, terminal like Text Drawing Canvas -// -// Copyright (C) 1995,1996,1997, 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include - -//================>>> vTextCanvasPane::vTextCanvasPane <<<==================== - vTextCanvasPane::vTextCanvasPane() : vCanvasPane(P_TextCanvas) - { - - SysDebug(Constructor,"vTextCanvasPane::vTextCanvasPane() constructor\n") - - screen = new dChar[MAX_ROWS*MAX_COLS]; - - rowsAllocated = MAX_ROWS; - colsAllocated = MAX_COLS; - - for (int row = 0 ; row < MAX_ROWS ; ++row) - for (int col = 0 ; col < MAX_COLS ; ++col) - { - ScrChar(row,col) = 0 ; ScrAttr(row,col) = 0; - } - - cHeight = 0; cWidth = 0; - curRow = 0; curCol = 0; - - cursorRow = -1; cursorCol = -1; // no cursor yet - cursorChr = 0; cursorAttr = ChNormal; - - maxRows = -1; maxCols = -1; // We don't know this yet - - _cursorSet = 0; - } - -//================>>> vTextCanvasPane::vTextCanvasPane <<<==================== - vTextCanvasPane::vTextCanvasPane(const vTextCanvasPane& t) - { - vSysError("vTextCanvasPane - V semantics do not support copy constructors!"); - } - -//================>>> vTextCanvasPane::vTextCanvasPane <<<==================== - vTextCanvasPane::~vTextCanvasPane() - { - - SysDebug(Destructor,"vTextCanvasPane::~vTextCanvasPane() desstructor\n") - - delete [] screen; - } - -//======================>>> vTextCanvasPane::Clear <<<====================== - void vTextCanvasPane::Clear(void) - { - // Clear screen - including contents - - SysDebug(Text,"vTextCanvasPane::Clear\n") - - for (int row = 0 ; row < rowsAllocated ; ++row) - for (int col = 0 ; col < colsAllocated ; ++col) - { - ScrChar(row,col) = 0 ; ScrAttr(row,col) = ChNormal; - } - - vCanvasPane::Clear(); - - cursorChr = 0; cursorAttr = ChNormal; - cursorRow = cursorCol = -1; // The cursor is gone - - GotoRC(0,0); // Go to Row & Column - } - -//=================>>> vTextCanvasPane::ClearRow <<<====================== - void vTextCanvasPane::ClearRow(const int r, const int c) - { - // Clear screen row - including the contents - - SysDebug2(Text,"vTextCanvasPane::ClearRow(r:%d, c: %d)\n",r,c) - - - //1.18 GotoRC(r,c); // update cursor for sure - - // Clearing implies that the previous part of the row should - // have valid characters, so change them to blanks if now 0 - for (int cc = 0 ; cc < c ; ++cc) - { - if (ScrChar(r,cc) == 0) - { - ScrChar(r,cc) = ' '; ScrAttr(r,cc) = ChNormal; - } - } - - GotoRC(r,c); // update cursor for sure (1.18) - - // Now clear the rest of the row - for (int col = c ; col < maxCols ; ++col) - { - ScrChar(r,col) = 0 ; ScrAttr(r,col) = ChNormal; - } - - cursorChr = 0; cursorAttr = ChNormal; // cursor is now "0" - // instead of whatever it was - ClearRowDisplay(r,c); - - GotoRC(r,c); - } - -//=============>>> vTextCanvasPane::ClearRowDisplay <<<====================== - void vTextCanvasPane::ClearRowDisplay(const int r, const int c) - { - // Clear display row - - int x, y; - - x = ColToX(c); - y = RowToY(r); - - ClearRect(x, y - cAscent, _width - x + 1, cDescent+cAscent); - } - -//=================>>> vTextCanvasPane::ClearToEnd <<<====================== - void vTextCanvasPane::ClearToEnd(const int r, const int c) - { - // Clear from r,c to end of screen - - SysDebug2(Text,"vTextCanvasPane::ClearToEnd(r:%d, c: %d)\n",r,c) - ClearRow(r,c); - for (int row = r+1 ; row < maxRows ; ++row) - ClearRow(row,0); - - GotoRC(r,c); - } - -//=================>>> vTextCanvasPane::DrawTextCursor <<<================= - void vTextCanvasPane::DrawTextCursor(int r, int c) - { - // Draw a cursor need the lower level code here because drawchar - // calls drawcursor - - ChrAttr attr; - char copy[2]; - - copy[1] = 0; // terminante - - if (cursorRow >= 0) // We have a cursor, so unreverse - { - // Fix screen buffer contents - ScrChar(cursorRow,cursorCol) = cursorChr ; - ScrAttr(cursorRow,cursorCol) = cursorAttr; - copy[0] = cursorChr; // need to copy - if (cursorChr == 0) - copy[0] = ' '; - vCanvasPane::DrawAttrText(ColToX(cursorCol), RowToY(cursorRow), - copy, cursorAttr); - } - - // OK, now draw a cursor at new location - - cursorRow = r; // update to new location - cursorCol = c; - if (cursorRow < 0) - return; // This is how to turn the cursor off - - // remember what character was there before - if ((cursorChr = ScrChar(cursorRow,cursorCol)) == 0) - ScrChar(cursorRow,cursorCol) = ' '; - - copy[0] = ScrChar(cursorRow,cursorCol); // need to copy for redraw - - cursorAttr = ScrAttr(cursorRow,cursorCol); // remember old attribute - - - // Toggle the reverse attribute to get a cursor - - attr = (cursorAttr & ChReverse) ? (cursorAttr & ~ChReverse) // rev off - : (cursorAttr | ChReverse); // rev on - - ScrAttr(cursorRow,cursorCol) = attr; - - vCanvasPane::DrawAttrText(ColToX(cursorCol), RowToY(cursorRow), - copy, attr); - } - -//======================>>> vTextCanvasPane::DrawChar <<<====================== - void vTextCanvasPane::DrawChar(const char chr, const ChrAttr attr) - { - // Overwrite a char at current cursor, incr cursor - char copy[2]; // for a copy - - copy[0] = chr; copy[1] = 0; - - SysDebug1(Text,"vTextCanvasPane::DrawChar(chr:%c)\n",chr) - - ScrChar(curRow,curCol) = chr ; ScrAttr(curRow,curCol) = attr; - - // for now, assume just reverse or normal on WHOLE row - - if (attr != ChNormal) // normal or with attributes? - vCanvasPane::DrawAttrText(ColToX(curCol), RowToY(curRow), copy, attr); - else - vCanvasPane::DrawText(ColToX(curCol), RowToY(curRow), copy); - - if (cursorRow == curRow && cursorCol == curCol) - cursorRow = cursorCol = -1; // we just fixed the cursor - - if (++curCol >= maxCols) - curCol = maxCols - 1; - - cursorRow = -1; // we just overwrote the cursor @@@ - GotoRC(curRow, curCol); - } - -//======================>>> vTextCanvasPane::DrawText <<<====================== - void vTextCanvasPane::DrawText(const char* text) - { - DoDrawText(text, ChNormal); // Draw normal text - } - -//======================>>> vTextCanvasPane::DrawAttrText <<<====================== - void vTextCanvasPane::DrawAttrText(const char* text, const ChrAttr attr) - { - DoDrawText(text, attr); // Draw reverse text - } - -//======================>>> vTextCanvasPane::DoDrawText <<<====================== - void vTextCanvasPane::DoDrawText(const char* text, const ChrAttr attr) - { - // Draw scrolling text starting at current r,c - - if (!text || !*text) - return; - - int startC = curCol; - int needsFinalDraw = 0; - - - for (int cc = 0 ; cc < curCol ; ++cc) // change 0's to blanks if in middle of row - { - if (ScrChar(curRow,cc) == 0) - { - ScrChar(curRow,cc) = ' '; ScrAttr(curRow,cc) = ChNormal; - } - } - - cursorRow = cursorCol = -1; // we just fixed the cursor - - for (const char* cp = text ; *cp != 0 ; ++cp) - { - if (*cp == '\n') // new lines take special treatment - { - // Terminate current row with 0 - ScrChar(curRow,curCol) = ' ' ; ScrAttr(curRow,curCol) = attr; - - // And draw row on the screen! - DrawTextScr(curRow,startC,ScrAddr(curRow,startC)); - startC = curCol = 0; // reset column to 0 - ++curRow; // move to the next row - needsFinalDraw = 0; // Don't need final draw - // Next row is empty - ScrChar(curRow,curCol) = 0 ; ScrAttr(curRow,curCol) = ChNormal; - if (curRow >= maxRows) // see if off bottom - { - ScrollText(1); // scroll up 1 row - } - } - else if (curCol < maxCols) // overwrite current line - { - ScrChar(curRow,curCol) = *cp ; ScrAttr(curRow,curCol) = attr; - ++curCol; - needsFinalDraw = 1; // Need final draw - } - } - - - if (needsFinalDraw) - DrawTextScr(curRow,startC,ScrAddr(curRow,startC)); - - GotoRC(curRow,curCol); - } - -//======================>>> vTextCanvasPane::DrawAttrsText <<<====================== - void vTextCanvasPane::DrawAttrsText(const char* text, const ChrAttr* attr) - { - // Draw scrolling text starting at current r,c - // this was simply copied from DrawAttrText but uses array for attr (1.23) - - if (!text || !*text) - return; - - int startC = curCol; - int needsFinalDraw = 0; - - - for (int cc = 0 ; cc < curCol ; ++cc) // change 0's to blanks if in middle of row - { - if (ScrChar(curRow,cc) == 0) - { - ScrChar(curRow,cc) = ' '; ScrAttr(curRow,cc) = ChNormal; - } - } - - - cursorRow = cursorCol = -1; // we just fixed the cursor - - int ix; - for ( ix = 0; text[ix] != 0 ; ++ix) - { - if (text[ix] == '\n') // new lines take special treatment - { - // Terminate current row with 0 - ScrChar(curRow,curCol) = ' ' ; ScrAttr(curRow,curCol) = attr[ix]; - - // And draw row on the screen! - DrawTextScr(curRow,startC,ScrAddr(curRow,startC)); - startC = curCol = 0; // reset column to 0 - ++curRow; // move to the next row - needsFinalDraw = 0; // Don't need final draw - // Next row is empty - ScrChar(curRow,curCol) = 0 ; ScrAttr(curRow,curCol) = ChNormal; - if (curRow >= maxRows) // see if off bottom - { - ScrollText(1); // scroll up 1 row - } - } - else if (curCol < maxCols) // overwrite current line - { - ScrChar(curRow,curCol) = text[ix] ; ScrAttr(curRow,curCol) = attr[ix]; - ++curCol; - needsFinalDraw = 1; // Don't need final draw - } - } - - if (needsFinalDraw) - DrawTextScr(curRow,startC,ScrAddr(curRow,startC)); - - GotoRC(curRow,curCol); - } - -//======================>>> vTextCanvasPane::DrawTextScr <<<====================== - void vTextCanvasPane::DrawTextScr(int r, int c, VCONST dChar* txt) - { - char copy[MAX_COLS]; // for a copy - - char* to = copy; - - ChrAttr curAttr = txt->attr; // initial attribute - - int curColl = c; - - int startColl = c; - - for (dChar* dcp = txt ; dcp->chr != 0 ; ++dcp) - { - if (dcp->attr != curAttr) // changing attr - need to show what - { // we've built so far - *to = 0; // terminate - if (curAttr != ChNormal) // normal or with attributes? - { - vCanvasPane::DrawAttrText(ColToX(startColl), RowToY(r), - copy, curAttr); - } - else - { - vCanvasPane::DrawText(ColToX(startColl), RowToY(r), copy); - } - // Now resetup for next portion of the row - to = copy; // restart buffer - curAttr = dcp->attr; // new attribute - startColl = curColl; // and new start column - // fall through for rest of the row - } - *to++ = dcp->chr; - curColl++; - } - *to = 0; - - // write rest of the row - - if (copy[0] != 0) // don't bother with empty row - { - if (curAttr != ChNormal) // normal or with attributes? - { - vCanvasPane::DrawAttrText(ColToX(startColl), RowToY(r), - copy, curAttr); - } - else - { - vCanvasPane::DrawText(ColToX(startColl), RowToY(r), copy); - } - } - } - -//======================>>> vTextCanvasPane::FontChanged <<<====================== - void vTextCanvasPane::FontChanged(VCONST vFont& newFont) - { - // The font has changed, so we must recalculate everything - - Clear(); - ResizeText(); - } - -//======================>>> vTextCanvasPane::GotoRC <<<====================== - void vTextCanvasPane::GotoRC(const int r, const int c) - { - - // Move cursor to row, col - // First, a sanity check - - int row = (r < 0) ? 0 : r; - int col = (c < 0) ? 0 : c; - - if (row >= maxRows) - row = maxRows - 1; - if (col >= maxCols) - col = maxCols - 1; - - curRow = row; - curCol = col; - - // have to be sure column is blank filled if moved to new column - - for (int cc = 0 ; cc < col ; ++cc) - { - if (ScrChar(row,cc) == 0) - { - ScrChar(row,cc) = ' '; ScrAttr(row,cc) = ChNormal; - } - } - - DrawTextCursor(curRow, curCol); // draw the cursor to here - } - -//======================>>> vTextCanvasPane::MouseDown <<<====================== - void vTextCanvasPane::MouseDown(int x, int y, int button) - { - // Map xy to text positions, call alternate mouse down - - TextMouseDown(YToRow(y), XToCol(x), button); - } - -//========================>>> vTextCanvasPane::MouseUp <<<====================== - void vTextCanvasPane::MouseUp(int x, int y, int button) - { - // Map xy to text positions, call alternate mouse up - TextMouseUp(YToRow(y), XToCol(x), button); - } - -//======================>>> vTextCanvasPane::MouseMove <<<====================== - void vTextCanvasPane::MouseMove(int x, int y, int button) - { - // Map xy to text positions, call alternate mouse Move - TextMouseMove(YToRow(y), XToCol(x), button); - } - -//=========================>>> vTextCanvasPane::Redraw <<<====================== - void vTextCanvasPane::Redraw(int x, int y, int width, int height) - { - if (maxRows < 0) // This is the FIRST redraw - { - ResizeText(); // resize the text! - return; // don't redraw twice! - } - -#ifdef vDEBUG // Don't have a SysDebug4 macro, so do it by hand - if (DebugState.WindowEvents && DebugState.System) - fprintf(stderr,"vTextCanvasPane::Redraw(x=%d, y=%d, w=%d, h=%d)\n",x,y,width,height); -#endif - - if (!_cursorSet) - { - SetCursor(VC_IBar); // Change here - _cursorSet = 1; - } - - // OK, do a REALLY stupid redraw - - for (int r = 0 ; r < maxRows ; ++r) - DrawTextScr(r,0,ScrAddr(r,0)); - - } - -//===================>>> vTextCanvasPane::SetTextRowsCols <<<====================== - void vTextCanvasPane::SetTextRowsCols(int rows, int cols) - { - int newheight = (rows * cHeight) + (2*MARGIN) + cHeight;; - int newwidth = (cols * cWidth) + (2*MARGIN) + cWidth;; - SetWidthHeight(newwidth, newheight); - ResizeText(); - } - -//===================>>> vTextCanvasPane::ResizeText <<<====================== - void vTextCanvasPane::ResizeText(const int rows, const int cols) - { - // This one is overridable so user can pick up new size - - SysDebug2(WindowEvents,"vTextCanvasPane::ResizeText(%d,%d)\n",rows,cols) - } - -//===================>>> vTextCanvasPane::ResizeText <<<====================== - void vTextCanvasPane::ResizeText(void) - { - // determine how many rows and columns we have - - cHeight = TextHeight(cAscent, cDescent); - cWidth = TextWidth("c"); // Use "c" as average char - - maxRows = (_height-(2*MARGIN)) / cHeight; // how many rows - if (maxRows > rowsAllocated) - maxRows = rowsAllocated; - - maxCols = (_width-(2*MARGIN)) / cWidth; - - if (maxCols >= (colsAllocated - 1)) - maxCols = colsAllocated - 2; // leave room for 0 terminator - - if (curRow > maxRows) // sanity check - curRow = 0; - if (curCol > maxCols) - curCol = 0; - - Clear(); - - ResizeText(maxRows,maxCols); - - Redraw(0,0,_width,_height); // force a redraw - } - -//======================>>> vTextCanvasPane::Resize <<<====================== - void vTextCanvasPane::Resize(int w, int h) - { - vCanvasPane::Resize(w,h); - ResizeText(); - } - -//======================>>> vTextCanvasPane::ScrollText <<<====================== - void vTextCanvasPane::ScrollText(const int lineCount) - { - // scroll text on screen up or down by lineCount - - int count = (lineCount < 0) ? -lineCount : lineCount; // abs val - - if (count >= maxRows) // see if doing the whole screen - { - Clear(); - if (lineCount < 0) - GotoRC(maxRows-1,0); - } - - // May need to fix cursor... - - if (cursorRow >= 0 && cursorCol >= 0) - { - if (cursorChr != 0) // V 1.15a - { - ScrChar(cursorRow,cursorCol) = cursorChr ; - ScrAttr(cursorRow,cursorCol) = cursorAttr; - } - else - { - ScrChar(cursorRow,cursorCol) = ' ' ; - ScrAttr(cursorRow,cursorCol) = ChNormal; - } - } - - if (lineCount > 0) // Scroll up -- blank lines at bottom - { - int r,c, to; - // Do the scroll: move all the data up count rows - for (r = count ; r < maxRows ; ++r) - { - to = r - count; // ScrChar is a macro, so need this - // copy one row up - for (c = 0 ; c < maxCols ; ++c) - { - ScrChar(to,c) = ScrChar(r,c); - ScrAttr(to,c) = ScrAttr(r,c); - } - } - - curRow = maxRows - count; // set to bottom used row of screen - curCol = 0; - - // Now, draw the screen with new rows - for (r = 0 ; r < curRow ; ++r) - { - ClearRowDisplay(r,0); - DrawTextScr(r,0,ScrAddr(r,0)); - } - // And clear the rest of the screen - for (r = curRow ; r < maxRows ; ++r) - { - ClearRow(r,0); - } - } - else // scroll down - { - int r,c, to; - int lastRow = maxRows -1; // the last row on the screen - // Do the scroll: move all the data down count rows - for (r = lastRow - count ; r >= 0 ; --r) - { - to = r + count; // ScrChar is a macro, so need this - // copy one row down - for (c = 0 ; c < maxCols ; ++c) - { - ScrChar(to,c) = ScrChar(r,c); - ScrAttr(to,c) = ScrAttr(r,c); - } - } - - curRow = count; // set to topmost used row of screen - curCol = 0; - - // Now, draw the screen with new rows - for (r = curRow ; r < maxRows ; ++r) - { - ClearRowDisplay(r,0); - DrawTextScr(r,0,ScrAddr(r,0)); - } - // And clear the top part of the screen - for (r = 0 ; r < curRow ; ++r) - { - ClearRow(r,0); - } - } - } - -//======================>>> vTextCanvasPane::YToRow <<<====================== - int vTextCanvasPane::YToRow(int y) - { - if (cHeight == 0) - cHeight = 1; - int row = (y - MARGIN) / cHeight; - - - if (row >= maxRows) - return maxRows - 1; // adjust for margins - else if (row < 0) - return 0; - else - return row; - } - -//======================>>> vTextCanvasPane::XToCol <<<====================== - int vTextCanvasPane::XToCol(int x) - { - if (cWidth == 0) - cWidth = 1; - int col = (x - MARGIN) / cWidth; - - if (col >= maxCols) - return maxCols - 1; // adjust for margins - else if (col < 0) - return 0; - else - return col; - } diff --git a/v/srcx/vtextinc.cxx b/v/srcx/vtextinc.cxx deleted file mode 100644 index ba36df5..0000000 --- a/v/srcx/vtextinc.cxx +++ /dev/null @@ -1,290 +0,0 @@ -//=============================================================== -// vtextinc.xxx - TextIn Cmd -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // Motif/Athena mapping -#include -#include // our definitions -#include // a command parent - -extern "C" -{ -#include - - -#ifndef Athena -#include -#include -#else - -#include -#include - -#endif -} - -#ifndef Athena -#define Nsensitive XmNsensitive -#else -#define Nsensitive XtNsensitive -#endif - - vTextInCmd* vTextInCmd::_TList = 0; // initialize static class data - -//=====================>>> vTextInCmd::vTextInCmd <<<======================= - vTextInCmd::vTextInCmd(vCmdParent* dp, CommandObject* co) : - vCmd(dp, co) - { - initialize(); - } - -//=====================>>> vTextInCmd::~vTextInCmd <<<======================= - vTextInCmd::~vTextInCmd() - { - - SysDebug(Destructor,"vTextInCmd::~vTextInCmd() destructor\n") - - // have to remove ourself from the list of all TextInCmds - if (_TList == this) // first one special - { - _TList = _nextT; - } - else - { - for (vTextInCmd* tl = _TList ; tl != 0 ; tl = tl->_nextT) - { - if (tl->_nextT == this) // we found ourself! - { - tl->_nextT = _nextT; // unlink us - break; - } - } - } - } - -//=====================>>> vTextInCmd::initialize <<<======================= - void vTextInCmd::initialize(void) - { - // build a TextIn command for use in a parent window - - SysDebug(Constructor,"vTextInCmd::vTextInCmd() constructor\n") - - CopyToLocal(); // make local copies - - Widget WfHoriz = _parentWin->getWidgetFromId(dlgCmd->cRightOf); - Widget WfVert = _parentWin->getWidgetFromId(dlgCmd->cBelow); - - static XtActionsRec actions[] = - { - {"CtextReturnA",CtextReturnA}, - }; - - int defLen = strlen(_title); // length of supplied string - - int defWidth; - - if (dlgCmd->size <= 0) // BEW: 7/24/96 - for V 1.13 - { - defWidth = (dlgCmd->attrs & CA_Large) ? 350 : 200; - - if (dlgCmd->attrs & CA_Small) // allow small, too. - defWidth = 100; - } - else - { -#ifndef Athena - defWidth = (dlgCmd->size+2) * XTextWidth(theApp->_XDefaultFont, "M",1); -#else - defWidth = dlgCmd->size * XTextWidth(theApp->_XDefaultFont, "M",1) + 2; -#endif - if (defWidth > 800) // Sanity check - defWidth = 500; - } - - _nextT = _TList; - _TList = this; // add us in at front of list - - wBox = 0; - - int map = !(dlgCmd->attrs & CA_Hidden); - -#ifndef Athena - wCmd = XtVaCreateManagedWidget( - "vTextIn", // name - xmTextFieldWidgetClass, // class - wParent, // parent - XtNvalue, _title, - XmNcursorPosition, defLen, - XmNwidth, defWidth, - XmNmappedWhenManaged, map, - NULL); - - if (dlgCmd->attrs & CA_Password) // password entry - { - Pixel bgcolor; - XtVaGetValues(wCmd, // the text's widget - XmNbackground, &bgcolor, // the text's bg color - NULL); - XtVaSetValues(wCmd, // the text's widget - XmNforeground, bgcolor, // make fg = bg to be invisible - NULL); - } - - -#else - - wCmd = XtVaCreateManagedWidget( - "vTextIn", // name - asciiTextWidgetClass, // class - wParent, // parent - XtNstring, _title, - XtNeditType, XawtextEdit, // editable - XtNinsertPosition, defLen, - XtNresizable, True, - XtNwidth, defWidth, - XtNmappedWhenManaged, map, - XtNecho, !(dlgCmd->attrs & CA_Password), - NULL); - - // kill off the search and return functions - XtTranslations txtT = - XtParseTranslationTable("Return: CtextReturnA()\n\ - CtrlR: no-op(RingBell)\n\ - CtrlS: no-op(RingBell)\n"); - - XtOverrideTranslations(wCmd, txtT); - XtAppAddActions(theApp->appContext(), actions, XtNumber(actions)); -#endif - if (WfVert != 0) - XtVaSetValues(wCmd, Nbelow(WfVert) NULL); - if (WfHoriz != 0) - XtVaSetValues(wCmd, NrightOf(WfHoriz) NULL); - - // Need to set to insensitive if it is set insensitive - if (!_Sensitive) - { - XtVaSetValues(wCmd, // the widget to set - Nsensitive, 0, // change to insensitive - NULL); - } - } - -//=====================>>> vTextInCmd::GetTextIn <<<======================= - int vTextInCmd::GetTextIn(ItemVal /* id */, char* str, int maxlen) VCONST - { - // recover the data from a TextInCmd - return text + length - - String text; // X type - - XtVaGetValues(wCmd, // the text's widget -#ifndef Athena - XmNvalue, &text, // the text's address -#else - XtNstring, &text, // the text's address -#endif - NULL); - - // now, copy the string from the widget to the user - // we will take account for length, too. - char* toP = str; - int l = 0; // track the length - - for (char* fromP = (char*)text ; *fromP && l < maxlen ; ++l) - { - *toP++ = *fromP++; - } - *toP = 0; // terminate the string - return l; - } - -//================>>> vTextInCmd::SetCmdVal <<<============================ - void vTextInCmd::SetCmdVal(ItemVal val, ItemSetType st) - { - - SysDebug1(Misc,"vTextInCmd::SetCmdVal(val:%d)\n",val) - - if (st == Sensitive) - { - _Sensitive = val; // set - XtVaSetValues(wCmd, // the widget to set - Nsensitive, val, // change sensitive - NULL); - } - else if (st == Hidden) // hide or unhide - { - if (val) - { - XtUnmapWidget(wCmd); // unmap this widget - } - else - { - XtMapWidget(wCmd); // unmap this widget - } - } - else - { - SysDebug2(BadVals,"vTextInCmd::SetCmdVal(val:%d,type:%d) - BAD TYPE\n",val,st) - } - - } - -//================>>> vTextInCmd::SetCmdStr <<<============================ - void vTextInCmd::SetCmdStr(VCONST char* str) - { - - SysDebug1(Misc,"vTextInCmd::SetCmdStr(str:%s)\n",str) - - int defLen = strlen(str); // length of supplied string - - XtVaSetValues(wCmd, // the widget to set -#ifndef Athena - XmNvalue, str, -#else - XtNstring, str, -#endif - NULL); - - XtVaSetValues(wCmd, // the widget to set - XtNinsertPosition, defLen, - NULL); - } - -extern "C" -{ -//==========================>>> CtextReturnA <<<============================= - void CtextReturnA(Widget w, XEvent* ev, String* pars, Cardinal* np) - { - // Make the Return key return from the dialog if there is a default cmd. - - // _TList is a static, so we can get the this back by looking - // for the proper widget. - - for (vTextInCmd* tl = vTextInCmd::_TList ; tl != 0 ; tl = tl->_nextT) - { - if (tl->wCmd == w) // we've found our widget! - { - tl->textReturn(); - break; - } - } - - } -} - -//=====================>>> vTextInCmd::textReturn <<<======================= - void vTextInCmd::textReturn(void) - { - //@@@ This will interact with the Dialog to return if there - // was a default button. - SysDebug(Misc,"vTextInCmd::textReturn\n") - - _parentWin->ProcessCmd(_cmdId, _retVal, C_TextIn); - - } diff --git a/v/srcx/vtimer.cxx b/v/srcx/vtimer.cxx deleted file mode 100644 index 44132a1..0000000 --- a/v/srcx/vtimer.cxx +++ /dev/null @@ -1,106 +0,0 @@ -//=============================================================== -// vTimer.cxx - vTimer class functions - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include -#include - -// Define static data of the class - - -//======================>>> vTimer::vTimer <<<======================= - vTimer::vTimer( ) // default constructor - { - SysDebug(Constructor,"vTimer::vTimer - constructor\n") - - _id = 0; // no id - _interval = 0; // no interval - } - -//======================>>> vTimer::~vTimer <<<======================= - vTimer::~vTimer( ) - { - SysDebug(Destructor,"vTimer::~vTimer - destructor\n") - - if (_id) // remove timer if in effect - { - XtRemoveTimeOut(_id); - _id = 0; - } - } - -//======================>>> vTimer::TimerSet <<<======================= - int vTimer::TimerSet(long interval) - { - - if (_id) // remove timer if in effect - { - XtRemoveTimeOut(_id); - _id = 0; - } - - _interval = interval; - - _id = XtAppAddTimeOut( - theApp->appContext(), // needs app context - _interval, // interval in ms - CtimerCB, // the callback - (XtPointer)this); // us - - return (_id == 0) ? 0 : 1; - } - -//======================>>> vTimer::TimerStop <<<======================= - void vTimer::TimerStop(void) - { - if (_id) // remove timer if in effect - { - XtRemoveTimeOut(_id); - _id = 0; - } - } - -//======================>>> vTimer::TimerTick <<<======================= - void vTimer::TimerTick(void) - { - // default has no action - will be overridden - } - -//=========================>>> vTimer::tick <<<======================= - void vTimer::tick(void) - { - // internal tick routine - - TimerTick(); // call the work routine - - // X requires you to reinstall timer to get another tick - if (_id != 0) // TimerTick might call TimerStop - { - _id = XtAppAddTimeOut( - theApp->appContext(), // needs app context - _interval, // interval in ms - CtimerCB, // the callback - (XtPointer)this); // us - } - - } - -extern "C" -{ -//============================>>> CtimerCB <<<========================== - void CtimerCB(XtPointer client_data, XtIntervalId* notUsed) - { - // timer tick callback - // - // client_data will have the this pointer of our object - - ((vTimer*)client_data)->tick(); // call our tick routine - } -} diff --git a/v/srcx/vtipwin.cxx b/v/srcx/vtipwin.cxx deleted file mode 100644 index 07ab018..0000000 --- a/v/srcx/vtipwin.cxx +++ /dev/null @@ -1,172 +0,0 @@ -//=============================================================== -// vtipwin.cxx - vTipWindow class functions - X11R5 -// -// Copyright (C) 1998 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // we are a friend of App -#include // our header -#include -#include // Athena/Motif mapping -#include // for yellow bg - -extern "C" -{ -#include -#include - -#ifndef Athena -#include -#include -#else -#include -#endif -} - - -#ifndef Athena -#define setLabel(x,y) XmString x = XmStringCreateSimple(y); -#define freeLabel(x) XmStringFree(x); -#define lblWidgetClass xmLabelWidgetClass -#define Nlabel XmNlabelString -//@@ These use athena parent for now -#else -#define setLabel(x,y) char* x = y; -#define freeLabel(x) -#define lblWidgetClass labelWidgetClass -#define Nlabel XtNlabel - -#endif - -//======================>>> vTipWindow::vTipWindow <<<======================= - vTipWindow::vTipWindow() - { - - SysDebug(Constructor,"vTipWindow::vTipWindow") - - _popup = 0; - _wLbl = 0; - } - -//======================>>> vTipWindow::vTipWindow <<<======================= - vTipWindow::vTipWindow(const vTipWindow& w) // Copy Constructor - { - // Copy is shallow, but we track that it is a copy - vSysError("vTipWindow - V semantics do not support copy constructors!"); - } - -//======================>>> vTipWindow::~vTipWindow <<<======================= - vTipWindow::~vTipWindow() // destructor - { - - SysDebug(Destructor,"vTipWindow::~vTipWindow destructor\n") - - if (_popup == 0) - return; - if (PoppedUp) - XtPopdown(_popup); // another way to get it down - } - -//======================>>> vTipWindow::initialize <<<======================= - void vTipWindow::initialize(void) - { - _popup = XtVaCreatePopupShell( - "vTipWindow", // use name supplied - overrideShellWidgetClass, // a toplevel shell - theApp->vHandle(), // based on App window - XtNoverrideRedirect,1, - XtNallowShellResize,1, - NULL); - - PoppedUp = 0; - - setLabel(tmp," ") - _wLbl = XtVaCreateManagedWidget( - "vTipLabel", // name - lblWidgetClass, // class - _popup, // parent - Nlabel, tmp, // label -#ifndef Athena - XmNbackground, vStdColors[vC_Cyan].pixel(), - XmNmarginTop,2, - XmNmarginBottom,2, - XmNmarginLeft,2, - XmNmarginRight,2, -#else - XtNinternalWidth,2, - XtNinternalHeight,3, // adjust to make same height as button -#endif - NULL); - freeLabel(tmp) - } - -//============================>>> vTipWindow::CloseTipWindow <<<========================== - void vTipWindow::CloseTipWindow(void) - { - SysDebug(Build,"vTipWindow::CloseTipWin()") - if (!PoppedUp) - return; - XtPopdown(_popup); // another way to get it down - PoppedUp = 0; - } - -//======================>>> vTipWindow::ShowTipWindow <<<======================= - void vTipWindow::ShowTipWindow(int x, int y, VCONST char* tip) - { - - if (PoppedUp) - return; - - if (_popup == 0) // have to create popups - initialize(); - - XtVaSetValues(_popup, // set loc of popup - XtNx, x, - XtNy, y, - NULL); - - setLabel(tmp,tip) - XtVaSetValues(_wLbl, // the widget to set - Nlabel, tmp, // label - NULL); - freeLabel(tmp) - - XtPopup(_popup,XtGrabNone); - PoppedUp = 1; - } - -//================>>> vTipWindow::GetPosition <<<======================== - void vTipWindow::GetPosition(int& left, int& top, int& width, int& height) - { - Dimension w,h,b; - Position l,t; - - XtVaGetValues(_popup, XtNwidth, &w, XtNheight, &h, - XtNx, &l, XtNy, &t, XtNborderWidth, &b, NULL); - - left = l; top = t; width = w+b+b; height = h+b+b; - - } - -//================>>> vTipWindow::SetPosition <<<======================== - void vTipWindow::SetPosition(int left, int top) - { - Position l = left; - Position t = top; - XtVaSetValues(_popup,XtNx,l, XtNy,t,NULL); - } - -//================>>> vTipWindow::RaiseWindow <<<======================== - void vTipWindow::RaiseWindow(void) - { - // raise this window to the top of all other windows - - XRaiseWindow(XtDisplay(_popup), // our display - XtWindow(_popup)); // our window - - } diff --git a/v/srcx/vutil.cxx b/v/srcx/vutil.cxx deleted file mode 100644 index fb9a322..0000000 --- a/v/srcx/vutil.cxx +++ /dev/null @@ -1,168 +0,0 @@ -//=============================================================== -// General Purpose V Utilities -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include -#include - -#include -#include -#include - -//=============================>>> IntToStr <<<============================ - void IntToStr(int intg, char* str) - { // convert int intg to char string in str - - LongToStr((long)intg, str); - } - -//=============================>>> StrToLong <<<============================ - long StrToLong(VCONST char* str) - { // convert char string into long - - long val = 0; - long neg = 1; - if (*str == '-') - { - neg = -1; - str++; - } - while (str && *str) - { - if (*str < '0' || *str > '9') - break; - val = (val * 10) + (*str - '0'); - str++; - } - return neg*val; - } - -//=============================>>> LongToStr <<<============================ - void LongToStr(long intg, char* str) - { // convert long intg to char string in str - - long i; - long d, intval, j; - char k; - static char digits[] = "0123456789"; - - intval = intg >= 0L ? intg : (-intg); - str[0] = '\0'; - i = 0; - do - { // generate digits - i++; - d = intval % 10L; // mod 10 - str[i] = digits[d]; - intval = intval / 10L; - } - while (intval != 0L); - - if (intg < 0L) - { // then sign - str[++i] = '-'; - } - for (j = 0 ; j < i ; j++ ) - { // then reverse - k = str[i]; - str[i--] = str[j]; - str[j] = k; - } - } - -//=============================>>> ByteToStr <<<============================ - void ByteToStr(unsigned char intg, char* str) - { // convert byte intg to char string in str - - int i; - int d, intval, j; - char k; - static char digits[] = "0123456789ABCDEF"; - - intval = intg; - str[0] = '\0'; - i = 0; - do - { // generate digits - i++; - d = intval % 16; // mod 10 - str[i] = digits[d]; - intval = intval / 16; - } - while (intval != 0); - - for (j = 0 ; j < i ; j++ ) - { // then reverse - k = str[i]; - str[i--] = str[j]; - str[j] = k; - } - if (str[1] == 0) // one char only - { - str[1] = str[0]; str[2] = 0; str[0] = '0'; - } - } - -//=============================>>> vGetLocalTime <<<========================== - void vGetLocalTime(char* tm) - { - char buff[20]; - time_t t; - t = time(0); - strftime(buff,20,"%r",localtime(&t)); - strcpy(tm,buff); - } - -//=============================>>> vGetLocalDate <<<========================== - void vGetLocalDate(char* tm) - { - char buff[20]; - time_t t; - t = time(0); - strftime(buff,20,"%d %b %Y",localtime(&t)); - strcpy(tm,buff); - } - -//=============================>>> vBeep <<<========================== - void vBeep() - { - XBell(theApp->display(),0); - } - -//================================================================== -// -// Some special case utils for working with CommandObjects -// - -//=============================>>> vGetcmdIdIndex <<<========================== - int vGetcmdIdIndex(ItemVal cmdId, CommandObject *cmdObj) - { - // Return the index to the CommandObject array for the - // I which has the matching cmdId. - for (int i = 0 ; cmdObj[i].cmdType != C_EndOfList ; ++i) - { - if (cmdObj[i].cmdId == cmdId) - return i; - } - return -1; - } - -//=============================>>> vGetMenuIdIndex <<<========================== - int vGetMenuIdIndex(ItemVal cmdId, vMenu *cmdObj) - { - // Return the index to the CommandObject array for the - // I which has the matching cmdId. - for (int i = 0 ; cmdObj[i].label != 0 ; ++i) - { - if (cmdObj[i].menuId == cmdId) - return i; - } - return -1; - } diff --git a/v/srcx/vwindow.cxx b/v/srcx/vwindow.cxx deleted file mode 100644 index aadcb31..0000000 --- a/v/srcx/vwindow.cxx +++ /dev/null @@ -1,788 +0,0 @@ -//=============================================================== -// vWindow.cxx - vWindow class functions - X11R5 -// -// Copyright (C) 1995=2000 Bruce E. Wampler -// date: 01 Mar 2000 02:36:18 PM -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Lesser General Public License, -// Version 2.1. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // we are a friend of App -#include // our header -#include // we have panes -#include // to map x key to v key -#include -#include - -#include - -extern "C" -{ -#include -#include -#include -#include -#include - - -#ifndef Athena // Motif -#include -#include -#include -#include -#include -#include -#else -#ifdef USE3D -#define cmdWidgetClass command3dWidgetClass -#include - -#else // ATHENA - -#define cmdWidgetClass commandWidgetClass -#include -#endif - -#include -#include -#include -#include -#endif -} - -// Define static data of the class - - int vWindow::_numWindows = 0; - vWindow* vWindow::_WinList = 0; - -#ifdef USE_CLOSE_BOX -#define close_width 13 -#define close_height 12 -static char close_bits[] = { - 0xff, 0x1f, 0x01, 0x10, 0x0d, 0x16, 0x19, 0x13, 0xb1, 0x11, 0xe1, 0x10, - 0xe1, 0x10, 0xb1, 0x11, 0x19, 0x13, 0x0d, 0x16, 0x01, 0x10, 0xff, 0x1f}; -static Pixmap close_bitmap = 0; -#endif - -#ifdef Athena -#define gray_width 2 -#define gray_height 2 -static char gray_bits[] = { - 0x01, 0x02}; -static Pixmap gray_bitmap = 0; -#endif - - -//======================>>> vWindow::vWindow <<<======================= - vWindow::vWindow(VCONST char *name, int width, int height, - WindowType wintype ) : vBaseWindow(name) // constructor - { - - SysDebug2(Constructor,"vWindow::vWindow(height %d, width %d) constructor\n",height,width) - - // make widgets null - _menuPane = 0; - _cmdArea = _msgArea = _workArea = // misc widgets - _menuBar = 0; // the button bar widget - _closeButton = 0; // close button widget - - _paneList = 0; // no panes yet - - // Set height and width using default if <0 supplied - _WinHeight = (height > 0) ? height : theApp->DefaultHeight(); - _WinWidth = (width > 0) ? width : theApp->DefaultWidth(); - - _wType = wintype; - - _NextWin = _WinList; // link in at top - _WinList = this; - - _shown = 0; - _vHandle = 0; - wm_delete_added = 0; - - initialize(); // set this guy up - } - -//======================>>> vWindow::vWindow <<<======================= - vWindow::vWindow(const vWindow& w) : // Copy Constructor - vBaseWindow(w) - { - // Copy is shallow, but we track that it is a copy - vSysError("vWindow - V semantics do not support copy constructors!"); - } - -//======================>>> vWindow::~vWindow <<<======================= - vWindow::~vWindow() // destructor - { - - SysDebug(Destructor,"vWindow::~vWindow destructor\n") - - if (_vHandle == 0) - return; - PaneList* temp; - for (PaneList* pl = _paneList ; pl != 0 ; ) - { - temp = pl; - pl = pl->nextPL; - delete temp; // delete the PaneLists we allocated - } - } - -//======================>>> vWindow::AddPane <<<======================= - void vWindow::AddPane(vPane* add_pane) - { - // Add a pane to the window - - PaneList* newPane = new PaneList; // add a new pane to the list - - if (_topLevel == 0) // no top level yet - { - vSysWarning("In vWindow::AddPane - topLevel not defined yet."); - return; - } - - SysDebug1(Build,"vWindow::AddPane() to %s\n",_name) - - newPane->pane = add_pane; // this is the pane we are adding - - newPane->nextPL = _paneList; // add new pane in at top - _paneList = newPane; - - if (add_pane->_paneType == P_Menu) // P_Menu is special - { - vAddMenuBar(); // Make sure we got one - _menuPane = add_pane; // Remember menu pane - add_pane->initialize(this, _menuBar); - XtManageChild(_menuBar); - } - else - { - add_pane->initialize(this, _topLevel); // add to _toplevel paneWidget - } - } - -//======================>>> vWindow::initialize <<<======================= - void vWindow::initialize(void) - { - // All top level windows in this frame are implemented - // as popup shells based on the vApp's base widget. - - // Create a shell window that will serve as basis for all windows - - if (_wType == CMDWINDOW) - { - _vHandle = XtVaCreatePopupShell( - _name, // use name supplied - applicationShellWidgetClass, // an app shell - theApp->vHandle(), // based on App window - XtNtitle,_name, - XtNallowShellResize, TRUE, -#ifndef Athena - XmNkeyboardFocusPolicy,XmPOINTER, - XmNdeleteResponse,XmDO_NOTHING, // 1.24 - bad bug! -#endif - NULL); - } - else - { - _vHandle = XtVaCreatePopupShell( - _name, // use name supplied - topLevelShellWidgetClass, // a toplevel shell - theApp->vHandle(), // based on App window - XtNtitle,_name, - XtNallowShellResize, TRUE, - XtNwidth, _WinWidth, - XtNheight, _WinHeight, -#ifndef Athena - XmNkeyboardFocusPolicy,XmPOINTER, - XmNdeleteResponse,XmDO_NOTHING, // 1.24 - bad bug! -#endif - NULL); - } - - // Now the outer window to manage the children - -#ifndef Athena -#ifndef XmPANED - _topLevel = XtVaCreateWidget( - "vWindow", // Widget name - xmMainWindowWidgetClass, // widget class - _vHandle, // parent widget - XmNshowSeparator,1, - NULL); -#else - _topLevel = XtVaCreateWidget( - "vWindow", // Widget name - xmPanedWindowWidgetClass, // widget class - _vHandle, // parent widget - XmNsashHeight,5, XmNsashWidth,8, - XmNsashIndent,-8, XmNsashShadowThickness,2, - XmNspacing,4, - NULL); - - XawPanedAllowResize(_topLevel, 1); -// XawPanedSetRefigureMode(_topLevel, 0); -// XawPanedSetRefigureMode(_topLevel,1); -#endif - - if (theApp->_frameWidth > 0 && theApp->_frameHeight > 0) - { - XtVaSetValues(_topLevel, // the widget to set - XmNwidth, theApp->_frameWidth, - XmNheight, theApp->_frameHeight, - NULL); - } - -#else // **** Athena - - _topLevel = XtVaCreateWidget( - "vWindow", // Widget name - panedWidgetClass, // widget class - _vHandle, // parent widget - XtNvSpace,0, - NULL); - if (theApp->_frameWidth > 0 && theApp->_frameHeight > 0) - { - XtVaSetValues(_topLevel, // the widget to set - XtNwidth, theApp->_frameWidth, - XtNheight, theApp->_frameHeight, - NULL); - } - - if (gray_bitmap == 0) // haven't built the pixmap yet - { - gray_bitmap = XCreatePixmapFromBitmapData( - theApp->display(), // our display - DefaultRootWindow(theApp->display()), // a Drawable - gray_bits, // the gray bitmap data - gray_width, // from the file - gray_height, - (unsigned long) theApp->Xfg(), // Forground color - (unsigned long) theApp->Xbg(), // Background color - DefaultDepth(theApp->display(),DefaultScreen(theApp->display()))); - - } -#endif - -#ifdef Athena - XtAddEventHandler(_topLevel,KeyPressMask, 0, - (XtEventHandler)CKeyInEV,(XtPointer)this); -#endif - - ++_numWindows; // bump how many windows up - } - -//============================>>> vWindow::vAddMenuBar <<<========================== - void vWindow::vAddMenuBar(void) - { - if (_menuBar != 0) - return; - - // Now the menu bar that will have close and menus -#ifndef Athena - _menuBar = XmCreateMenuBar(_topLevel,"vMenuBar",NULL,0); -#else //**** ATHENA - - _menuBar = XtVaCreateWidget( - "vMenuBar", - boxWidgetClass, // widget class - _topLevel, // parent widget - XtNshowGrip,FALSE, - XtNborderWidth,0, - XtNvSpace, 0, - XtNallowResize,1, // Allow to resize - XtNskipAdjust,TRUE, // Don't readjust if possible - XtNresizeToPreferred,1, // try to make it original size - NULL); // argument list - - // set the background pattern - if (theApp->Xdepth() <= 1) - XtVaSetValues(_menuBar, // the widget to set - XtNbackgroundPixmap, gray_bitmap, NULL); - else - XtVaSetValues(_menuBar, // the widget to set - XtNbackground, _vMenuBarBG, NULL); -#endif - - // Now the Close button - -#ifndef USE_CLOSE_BOX - _closeButton = 0; // don't use close box -#else - if (close_bitmap == 0) // haven't built the pixmap yet - { - close_bitmap = XCreatePixmapFromBitmapData( - XtDisplay(_vHandle), // our display - DefaultRootWindow(XtDisplay(_vHandle)), // a Drawable - close_bits, // the close bitmap data - close_width, // from the file - close_height, - theApp->Xfg(),_vControlFace, - DefaultDepth(theApp->display(),DefaultScreen(theApp->display()))); - } - - _closeButton = XtVaCreateManagedWidget( - "vCloseButton", - cmdWidgetClass, // widget class - _menuBar, // parent widget - XtNbitmap,close_bitmap, // an icon - XtNinternalHeight, 1, - XtNinternalWidth, 1, - XtNborderWidth,0, - XtNbackground, _vControlFace, - NULL); // argument list - - XtAddCallback(_closeButton, XtNcallback, CcloseCB, (XtPointer)this); -#endif - } - -//============================>>> vWindow::CloseWin <<<========================== - void vWindow::CloseWin(void) - { -#ifndef Athena - // Motif requires wierd closing stuff... - if (!theApp->MotifSetTask(this, M_Close)) - _CloseWinFinal(); // Athena is normal -#else - - _CloseWinFinal(); // Athena is normal -#endif - } - -//============================>>> vWindow::_CloseWinFinal <<<========================== - void vWindow::_CloseWinFinal(void) - { - // close button class callback - // - vWindow* w_list; - - // close base window, which cleans up some stuff - - SysDebug1(Build,"vWindow::CloseWin() - %s.\n",_name) - - closeBaseWindow(); // close this window - - --_numWindows; - - // Remove from active list - - if (_WinList == this) // first one on list - { - _WinList = _WinList->_NextWin; // point to next - } - else - { - for (w_list = _WinList ; w_list != 0 ; w_list = w_list->_NextWin) - { - if (w_list->_NextWin == this) - { - // remove from list - w_list->_NextWin = (w_list->_NextWin)->_NextWin; - break; - } - } - } - - theApp->unregisterWindow(this); -#ifndef Athena -// XtDestroyWidget(_vHandle); -#endif - } - -extern "C" -{ -#ifdef USE_CLOSE_BOX -//============================>>> CcloseCB <<<========================== - void CcloseCB(Widget w, XtPointer client_data, XtPointer call_data) - { - // close button "C" Call Back - // - // client_data will have the this pointer of our object - - vWindow* thisWindow = (vWindow*) client_data; // get back this - if (theApp->IsHelpWin(thisWindow)) - theApp->CloseHelpWin(thisWindow); - else - theApp->CloseAppWin(thisWindow); - } -#endif - -//============================>>> CwmDeleteCB <<<========================== - void CwmDeleteCB(Widget w, XtPointer client_data, XEvent* e) - { - // WM_DELETE protocol - // - // client_data will have the this pointer of our object - // Apparently things get recursive with WM_DELETE, so we - // need the inUse flag. - - static int inUse = 0; - XClientMessageEvent* c = (XClientMessageEvent*)e; - -#ifndef Athena - if (inUse) - return; -#else - if (inUse || e->type != ClientMessage || - c->message_type != theApp->vx_wm_protocols) - return; -#endif - - inUse = 1; - - vWindow* thisWindow = (vWindow*) client_data; // get back this - - if (theApp->IsHelpWin(thisWindow)) - theApp->CloseHelpWin(thisWindow); - else - theApp->CloseAppWin(thisWindow); - -#ifndef Athena -// XtDestroyWidget(thisWindow->_vHandle); -#endif - inUse = 0; - } -} - -//======================>>> vWindow::ShowWindow <<<======================= - void vWindow::ShowWindow(bool show) - { - int t1, t2; - - // X11R5 Paned doesn't seem to quite work right. These - // calles force the pane to resize its children. - // X11R6 - don't seem to make any difference now BEW: V 1.21 10/28/98 - - SysDebug(Build,"vWindow::ShowWindow()\n") - - if (_shown) - { - if (show) - XtMapWidget(_vHandle); - else - XtUnmapWidget(_vHandle); - return; - } - else - _shown = 1; // after 1st time, shown - -#ifndef Athena - XmMainWindowSetAreas(_topLevel, _menuBar, _cmdArea, 0, 0, _workArea); - XtVaSetValues(_topLevel, // the widget to set - XmNmessageWindow, _msgArea, NULL); -#endif - - - if (!XtIsManaged(_topLevel)) - XtManageChild(_topLevel); - - XtPopup(_vHandle, XtGrabNone); // same as: vBaseWindow::ShowWindow(); - - theApp->XWaitUntilMapped(_vHandle); - - // Setup protocol stuff for this window - -#ifndef Athena - if (!wm_delete_added) - { - wm_delete_added = 1; - XmAddWMProtocolCallback(_vHandle, theApp->vx_wm_delete_window, - (XtCallbackProc)CwmDeleteCB, (XtPointer)this); - } -#else - if (!wm_delete_added) - { - wm_delete_added = 1; - XSetWMProtocols(theApp->display(), XtWindow(_vHandle), - &theApp->vx_wm_delete_window, 1); - - XtAddEventHandler(_vHandle, (EventMask)0L, 1, - (XtEventHandler)CwmDeleteCB, (XtPointer)this); - } -#endif - - } - - -//======================>>> vWindow::ShowPane <<<======================= - void vWindow::ShowPane(vPane* wpane, int OnOrOff) VCONST - { - // Show or hide this pane - - // Search all panes until we find this one - for (PaneList* pl = _paneList ; pl != 0 ; pl = pl->nextPL) - { - if (pl->pane == wpane) - { - (pl->pane)->ShowPane(OnOrOff); // let each pane show/hide - return; - } - } - - return; - } - -//====================>>> vWindow::GetValue <<<====================== - int vWindow::GetValue(ItemVal id) VCONST - { - // scan all buttons in this window to retrieve the what value - - int retval = 0; // default to 0 - - // Search all panes until we find this id - for (PaneList* pl = _paneList ; pl != 0 ; pl = pl->nextPL) - { - if ((pl->pane)->GetPaneValue(id, retval)) - { - return retval; - } - } - - return 0; - } - -//====================>>> vWindow::GetTextIn <<<====================== - int vWindow::GetTextIn(ItemVal id, char* val, int maxlen) VCONST - { - // scan all buttons in this window to retrieve the what value - - int retval = 0; // default to 0 - - // Search all panes until we find this id - for (PaneList* pl = _paneList ; pl != 0 ; pl = pl->nextPL) - { - if ((pl->pane)->GetPaneTextIn(id, val, maxlen)) - { - return 1; - } - } - - return 0; - } - -//====================>>> vWindow::GetMenuThis <<<====================== - vMenuPane* vWindow::GetMenuThis(Widget w) - { - // scan menu object to see if it has the widget - - vMenuPane* mypane; - int retval = 0; // default to 0 - - for (PaneList* pl = _paneList ; pl != 0 ; pl = pl->nextPL) - { - if ((pl->pane)->_paneType == P_Menu) - { - vMenuPane* menup = (vMenuPane*) pl->pane; - if ((mypane = menup->GetMenuThis(w)) != 0) - return mypane; - } - } - - return 0; - } - -//=========================>>> vWindow::KeyIn <<<========================== - void vWindow::KeyIn(vKey keysym, unsigned int shift) - { - // General interface to a keyboard event - -#ifdef vDEBUG - if (vk_IsModifier(keysym)) - return; - if (keysym < ' ') - { - SysDebug1(Misc,"vWindow::KeyIn: ^%c",keysym+ '@') - } - else if (keysym < 128) - { - SysDebug1(Misc,"vWindow::KeyIn: %c",keysym) - } - else - { - SysDebug1(Misc,"vWindow::KeyIn:<%x>",keysym); - } - SysDebug2(Misc," shift=%d in window %s.\n",shift,_name); -#endif - - theApp->KeyIn(this, keysym, shift); // pass on unprocessed keys to app - } - -//=======================>>> vWindow::KeyInEV <<<========================== - void vWindow::KeyInEV(unsigned int keycode, unsigned int state) - { - // Local interface to a keyboard event - - vKey vkey; - KeySym keysym; - Modifiers modifiers_used; - ItemVal id; - -#ifndef Athena - XmTranslateKey(theApp->display(), // the display - keycode, // the keycode input - state, // and the shift state - &modifiers_used, // used in translation - &keysym); // what we care about -#else - XtTranslateKeycode(theApp->display(), // the display - keycode, // the keycode input - state, // and the shift state - &modifiers_used, // used in translation - &keysym); // what we care about -#endif - - vkey = MapXtoVkey(keysym, state); - - if (vkey == vk_None) - return; - - if (_menuPane && ((vMenuPane*)_menuPane)->CheckAccel(vkey, state, id)) - MenuCommand(id); - else - KeyIn(vkey,state); // pass on to general code - } - -extern "C" -{ -//============================>>> CKeyInEV <<<========================== - void CKeyInEV(Widget w, XtPointer client_data, XEvent* event, char *x) - { - // KeyPress Event Handler - // - // client_data will have the this pointer of our object - - XKeyPressedEvent *kp; - - kp = (XKeyPressedEvent*)event; - vWindow* thisWindow = (vWindow*) client_data; // get back this - - thisWindow->KeyInEV(kp->keycode, kp->state); - } -} - -//======================>>> vWindow::MenuCommand <<<========================== - void vWindow::MenuCommand(ItemVal id) - { - // Menu Commands go through here first, then the regular WindowCommand - - WindowCommand(id, id, C_Menu); - } - -//================>>> vWindow::GetPosition <<<======================== - void vWindow::GetPosition(int& left, int& top, int& width, - int& height) VCONST - { - Dimension w,h,b; - Position l,t; - - XtVaGetValues(_vHandle, XtNwidth, &w, XtNheight, &h, - XtNx, &l, XtNy, &t, XtNborderWidth, &b, NULL); - - left = l; top = t; width = w+b+b; height = h+b+b; - - } - -//================>>> vWindow::SetPosition <<<======================== - void vWindow::SetPosition(int left, int top) - { - Position l = left; - Position t = top; - XtVaSetValues(_vHandle,XtNx,l, XtNy,t,NULL); - } - -//================>>> vWindow::RaiseWindow <<<======================== - void vWindow::RaiseWindow(void) - { - // raise this window to the top of all other windows - - XRaiseWindow(XtDisplay(_vHandle), // our display - XtWindow(_vHandle)); // our window - - } - -//================>>> vWindow::SetString <<<======================== - void vWindow::SetString(ItemVal id, VCONST char* str) - { - for (PaneList* pl = _paneList ; pl != 0 ; pl = pl->nextPL) - { - (pl->pane)->SetPaneString(id, str); - } - } - -//================>>> vWindow::SetStringAll <<<======================== - void vWindow::SetStringAll(ItemVal id, VCONST char* str) - { - // search all buttons in all windows to set to correct value - - for (vWindow* w_list = _WinList ; w_list != 0 ; w_list = w_list->_NextWin) - { - // in each window, search each pane list - for (PaneList* pl = w_list->_paneList ; pl != 0 ; pl = pl->nextPL) - { - (pl->pane)->SetPaneString(id, str); - } - } - } - -//======================>>> vWindow::SetTitle <<<========================== - void vWindow::SetTitle(VCONST char* title) - { - // set the title in the title bar - - XtVaSetValues(_vHandle, - XtNtitle,title, - NULL); - } - -//==================>>> vWindow::SetValue <<<======================== - void vWindow::SetValue(ItemVal id, int val, ItemSetType setType) - { - for (PaneList* pl = _paneList ; pl != 0 ; pl = pl->nextPL) - { - (pl->pane)->SetPaneValue(id, val, setType); - } - } - -//==================>>> vWindow::SetValueAll <<<======================== - void vWindow::SetValueAll(ItemVal id, int val, ItemSetType setType) - { - // search all windows to set all buttons - for (vWindow* w_list = _WinList ; w_list != 0 ; w_list = w_list->_NextWin) - { - // in each window, search each pane list - for (PaneList* pl = w_list->_paneList ; pl != 0 ; pl = pl->nextPL) - { - (pl->pane)->SetPaneValue(id, val, setType); - } - } - } - -//======================>>> vWindow::UpdateView <<<======================== - void vWindow::UpdateView(vWindow* sender, int hint, void* pHint) - { - // This is the overridable function called by the framwork to take - // action on changes which happened in the model (document). - // - // sender: Hint on which window caused the change in model - // hint: Enum defined in your derived app class. - // Hints about which kind of change is made, so that only - // appropriate action is taken on appropriate windows. - // pHint: This is normally a pointer to a object representing the - // document, or part of it. If the App has multiple open - // documents, and multiple views for each document, a - // typical use is to update only the views for the - // document, except the sender's. - } - -//======================>>> vWindow::WindowCommand <<<========================== - void vWindow::WindowCommand(ItemVal id, ItemVal retval, CmdType ctype) - { - - SysDebug1(CmdEvents,"vWindow::WindowCommand(id: %d)\n",id) - - theApp->AppCommand(this, id, retval, ctype); // Pass on unprocessed cmds to app - } diff --git a/v/srcx/vx2vkey.cxx b/v/srcx/vx2vkey.cxx deleted file mode 100644 index 7d0d014..0000000 --- a/v/srcx/vx2vkey.cxx +++ /dev/null @@ -1,142 +0,0 @@ -//=============================================================== -// vx2vkey.cxx - routines for converting V key codes -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include -#include -#include -#include -#ifndef Athena -#include -#endif - - -#ifndef XK_KP_Home // X11R5 vs. X11R6 -#define XK_KP_Home XK_Home -#define XK_KP_Left XK_Left -#define XK_KP_Up XK_Up -#define XK_KP_Right XK_Right -#define XK_KP_Down XK_Down -#define XK_KP_Page_Up XK_Prior -#define XK_KP_Page_Down XK_Next -#define XK_KP_End XK_End -#define XK_KP_Insert XK_Insert -#define XK_KP_Delete XK_Delete -#endif - -#ifndef XK_Mode_switch -#define XK_Mode_switch 0xFF7E -#endif - - static vKey XtoV[] = - { - XK_BackSpace, vk_BackSpace, XK_Tab, vk_Tab, XK_Linefeed, vk_Linefeed, - XK_Return, vk_Return, XK_Pause, vk_Pause, XK_Escape, vk_Escape, - XK_Delete, vk_Delete, XK_Home, vk_Home, XK_Left, vk_Left, - XK_Insert, vk_Insert, - XK_Up, vk_Up, XK_Right, vk_Right, XK_Down, vk_Down, XK_Prior, vk_Page_Up, - XK_Next, vk_Page_Down, XK_End, vk_End, XK_Num_Lock, vk_Num_Lock, - XK_KP_Enter, vk_KP_Enter, XK_KP_Home, vk_KP_Home, XK_KP_Left, vk_KP_Left, - XK_KP_Up, vk_KP_Up, XK_KP_Right, vk_KP_Right, XK_KP_Down, vk_KP_Down, - XK_KP_Page_Up, vk_KP_Page_Up, XK_KP_Page_Down, vk_KP_Page_Down, - XK_KP_End, vk_KP_End, XK_KP_Insert, vk_Insert, XK_KP_Delete, vk_KP_Delete, - XK_KP_Equal, vk_KP_Equal, XK_KP_Multiply, vk_KP_Multiply, - XK_KP_Add, vk_KP_Add, XK_KP_Subtract, vk_KP_Subtract, - XK_KP_Decimal, vk_KP_Decimal, XK_KP_Divide, vk_KP_Divide, - XK_KP_0, vk_KP_0, XK_KP_1, vk_KP_1, XK_KP_2, vk_KP_2, XK_KP_3, vk_KP_3, - XK_KP_4, vk_KP_4, XK_KP_5, vk_KP_5, XK_KP_6, vk_KP_6, XK_KP_7, vk_KP_7, - XK_KP_8, vk_KP_8, XK_KP_9, vk_KP_9, XK_F1, vk_F1, XK_F2, vk_F2, - XK_F3, vk_F3, XK_F4, vk_F4, XK_F5, vk_F5, XK_F6, vk_F6, XK_F7, vk_F7, - XK_F8, vk_F8, XK_F9, vk_F9, XK_F10, vk_F10, XK_F11, vk_F11, XK_F12, vk_F12, - - // The following might only apply to Linux, but there probably won't - // be many using F12-F20 anyway. Linux maps Shift-F1 to F13. - - XK_F13, vk_F1, XK_F14, vk_F2, XK_F15, vk_F3, XK_F16, vk_F4, XK_F17, vk_F5, - XK_F18, vk_F6, XK_F19, vk_F7, XK_F20, vk_F8, - - // The following are modifer keys pressed by themselves - - XK_Shift_L, vk_Shift, XK_Shift_R, vk_Shift, XK_Control_L, vk_Control, - XK_Control_R, vk_Control, XK_Caps_Lock, vk_Caps_Lock, - XK_Alt_L, vk_Alt, XK_Alt_R, vk_Alt, XK_Mode_switch, vk_Alt, -#ifndef Athena - osfXK_BackSpace, vk_BackSpace, - osfXK_BeginLine, vk_Home, - osfXK_Cancel, vk_Escape, - osfXK_Clear, vk_Delete, - osfXK_Delete, vk_Delete, - osfXK_Down, vk_Down, - osfXK_EndLine, vk_End, - osfXK_Help, vk_F1, - osfXK_Insert, vk_Insert, - osfXK_Left, vk_Left, - osfXK_PageDown, vk_Page_Down, - osfXK_PageUp, vk_Page_Up, - osfXK_Right, vk_Right, - osfXK_Up, vk_Up, -#endif - 0, 0 - }; - - -//===============================>>> MapXtoVkey <<<================================ - vKey MapXtoVkey(unsigned int Xkey, unsigned int& shift) - { - // Map an X Window System keyvalue to the internal code used by V - - unsigned int tmp; - vKey vtmp; - - if (Xkey > 0 && Xkey <= 255) // Normal & ISO ascii character - { - if (shift == 0) // no ctrl or alt or shift, so return - return Xkey; - - if (shift == VKM_Shift) // only shifted - kill the flag - { - shift = 0; // kill the shift flag - if (Xkey == XK_Tab) - return vk_BackTab; // special case - return Xkey; // return actual value - } - else if (shift == VKM_Ctrl || shift == (VKM_Ctrl | VKM_Shift)) - // control-X or ctrl-shift-X - { - if (Xkey >= '@' && Xkey <= '_') - { - shift &= VKM_Shift; // kill the ctrl flag - vtmp = Xkey - '@'; // normal range - } - else if (Xkey >= '`' && Xkey <= '~') - { - shift &= VKM_Shift; // kill the ctrl flag - vtmp = Xkey - '`'; // normal range - } - else - vtmp = Xkey; // just let it map; - - return vtmp; - } - // else it is combination of Alt, Shift, cTRL - return Xkey; - } - - // To here, then need to map - for (int ix = 0 ; XtoV[ix] != 0 ; ix += 2 ) - { - // Search the XtoV table - if (XtoV[ix] == Xkey) - { - return XtoV[ix+1]; - } - } - return vk_None; - } diff --git a/v/srcx/vxdc.cxx b/v/srcx/vxdc.cxx deleted file mode 100644 index 2dff20e..0000000 --- a/v/srcx/vxdc.cxx +++ /dev/null @@ -1,1170 +0,0 @@ -//=============================================================== -// vXDC - a basic canvas for drawing -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include - -#include -#include - -#include // need access to the app -#include // for icons - -//----------------------------------------------------------------------- -// Define some X bitmaps for patterned fill -// -#define ldiag_width 16 -#define ldiag_height 16 -static char ldiag_bits[] = { - 0x01, 0x01, 0x02, 0x02, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, - 0x40, 0x40, 0x80, 0x80, 0x01, 0x01, 0x02, 0x02, 0x04, 0x04, 0x08, 0x08, - 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x80}; - static Pixmap ldiagPM = 0; - -#define cdiag_width 16 -#define cdiag_height 16 -static char cdiag_bits[] = { - 0x81, 0x81, 0x42, 0x42, 0x24, 0x24, 0x18, 0x18, 0x18, 0x18, 0x24, 0x24, - 0x42, 0x42, 0x81, 0x81, 0x81, 0x81, 0x42, 0x42, 0x24, 0x24, 0x18, 0x18, - 0x18, 0x18, 0x24, 0x24, 0x42, 0x42, 0x81, 0x81}; - static Pixmap cdiagPM = 0; - -#define cross_width 15 -#define cross_height 15 -static char cross_bits[] = { - 0x84, 0x10, 0x84, 0x10, 0xff, 0x7f, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, - 0x84, 0x10, 0xff, 0x7f, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, - 0xff, 0x7f, 0x84, 0x10, 0x84, 0x10}; - static Pixmap crossPM = 0; - -#define rdiag_width 16 -#define rdiag_height 16 - static char rdiag_bits[] = { - 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x04, - 0x02, 0x02, 0x01, 0x01, 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, - 0x08, 0x08, 0x04, 0x04, 0x02, 0x02, 0x01, 0x01}; - static Pixmap rdiagPM = 0; - -#define horiz_width 15 -#define horiz_height 15 -static char horiz_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00}; - static Pixmap horizPM = 0; - -#define verti_width 15 -#define verti_height 15 -static char verti_bits[] = { - 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, - 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, - 0x84, 0x10, 0x84, 0x10, 0x84, 0x10}; - static Pixmap vertiPM = 0; - - vFont vXDC::_GCFont; // the font actually in the GC - vPen vXDC::_GCPen; // the pen in use - vBrush vXDC::_GCBrush; // the brush in use - -//================>>> vXDC::vXDC <<<======================== - vXDC::vXDC() - { - - SysDebug(Constructor,"vXDC::vXDC() constructor\n") - } - -//================>>> vXDC::~vXDC <<<======================== - vXDC::~vXDC() - { - SysDebug(Destructor,"vXDC::~vXDC() destructor\n") - } - -//=====================>>> vXDC::GetDrawable <<<====================== - Drawable vXDC::GetDrawable() - { - return 0; - } - -//=====================>>> vXDC::Clear <<<========================== - void vXDC::Clear(void) - { - ClearRect(0, 0, _physWidth, _physHeight); - return; - } - -//==================>>> vXDC::ClearRect <<<========================== - void vXDC::ClearRect(int x, int y, int width, int height) - { - // Clear a rectangluar area starting at left,top of width and height - - if (height == 0 || width == 0) // ignore 0 h/w - return; - - int xx = Scale(x+_tx); - int yy = Scale(y+_ty); - int h = Scale(height); - int w = Scale(width); - - if (w < 0) // convert to something we like - { - w = -w; // make a positive width - xx = xx - w; // translate x - } - if (h < 0) - { - h = -h; // positive h - yy = yy - h; // translate x - } - - Drawable dw = GetDrawable(); - if (dw != 0) - XClearArea(_XDisplay, dw, xx, yy, w, h, 0); - } - -//=====================>>> vXDC::CopyFromMemoryDC <<<========================== - void vXDC::CopyFromMemoryDC(vMemoryDC* vmemdc, int destX, int destY, - int srcX, int srcY, int srcW, int srcH) - { - // Copy myself to another DC - int ch = vmemdc->_physHeight; - int cw = vmemdc->_physWidth; - int cx = 0; - int cy = 0; - - if (srcX > 0) // Fixed: 10/11/96 - cx = srcX; - if (srcY > 0) - cy = srcY; - if (srcW > 0) - cw = srcW; - if (srcH > 0) - ch = srcH; - - if ((cw + cx) > vmemdc->_physWidth && _physWidth > 0) // only copy what will fi - cw = _physWidth - cx; - if ((ch + cy) > vmemdc->_physHeight && _physHeight > 0) - ch = _physHeight - cy; - - if ((cw + destX) > _physWidth && _physWidth > 0) - cw = _physWidth - destX; - if ((ch + destY) > _physHeight && _physHeight > 0) - ch = _physHeight - destY; - - Drawable dw = GetDrawable(); - Drawable mdw = vmemdc->GetDrawable(); - - if (dw != 0 && mdw != 0) - XCopyArea(_XDisplay, - mdw, // Source drawable - dw, // Destination drawable - _GC, // Use Destination GC - cx,cy, // draw from 0,0 in source - cw, ch, // using this width and height - destX, destY); // to here in destination - - } - -#ifdef DRAWARC -//====================>>> vXDC::DrawArc <<<========================== - void vXDC::DrawArc(int xx1, int yy1, int xx2, int yy2, - int xxc, int yyc) - { - double dx = xx1 - xxc; - double dy = yy1 - yyc; - double radius = sqrt(dx * dx + dy * dy); - int r = (int) radius; - -const double PIx2 = 6.283185; - - double radius1, radius2; - - if (xx1 == xx2 && yy1 == yy2) - { - radius1 = 0.0; - radius2 = 360.0; - } - else if (radius == 0.0) - radius1 = radius2 = 0.0; - else - { - if (xx1 - xxc == 0) - { - if (yy1 - yyc < 0) - radius1 = 90.0; - else - radius1 = -90.0; - } - else - radius1 = -atan2 ((double) (yy1 - yyc), (double) (xx1 - xxc)) * 360.0 / PIx2; - - if (xx2 - xxc == 0) - { - if (yy2 - yyc < 0) - radius2 = 90.0; - else - radius2 = -90.0; - } - else - radius2 = -atan2 ((double) (yy2 - yyc), (double) (xx2 - xxc)) * 360.0 / PIx2; - } - radius1 *= 64.0; - radius2 *= 64.0; - int alpha1 = (int) radius1; - int alpha2 = (int) (radius2 - radius1); - while (alpha2 <= 0) - alpha2 += 360 * 64; - - while (alpha2 > 360 * 64) - alpha2 -= 360 * 64; - - if (_brush.brushStyle != vTransparent) - { - SetGCtoBrush(); - if (GetDrawable() != 0) - XFillArc(_XDisplay, GetDrawable(), _GC, - xxc - r, yyc - r, 2 * r, 2 * r, alpha1, alpha2); - } - - if (_pen.penStyle != vTransparent) - { - SetGCtoPen(); - if (GetDrawable()!=0) - XDrawArc(_XDisplay, GetDrawable(), _GC, - xxc - r, yyc - r, 2 * r, 2 * r, alpha1, alpha2); - } - } -#endif - -//====================>>> vXDC::DrawEllipse <<<========================== - void vXDC::DrawEllipse(int x, int y, int width, int height) - { - static const int angle = (360 * 64); - - if (height == 0 || width == 0) // ignore 0 h/w - return; - - int xx = Scale(x+_tx); - int yy = Scale(y+_ty); - int w = Scale(width); - int h = Scale(height); - - if (w < 0) // convert to something we like - { - w = -w; // make a positive width - xx = xx - w; // translate x - } - if (h < 0) - { - h = -h; // positive h - yy = yy - h; // translate x - } - - if (_brush.brushStyle != vTransparent) - { - SetGCtoBrush(); - XFillArc(_XDisplay, GetDrawable(), _GC, xx, yy, w, h, 0, angle); - } - - if (_pen.penStyle != vTransparent) - { - SetGCtoPen(); - XDrawArc(_XDisplay, GetDrawable(), _GC, xx, yy, w, h, 0, angle); - } - } - -//====================>>> vXDC::DrawIcon <<<========================== - void vXDC::DrawIcon(int x, int y, VCONST vIcon& icon) - { - - int xx = Scale(x+_tx); - int yy = Scale(y+_ty); - - Pixmap iconPM = icon.GetXPM(0); // may already be mapped - - if (iconPM == 0) - { - DrawRectangle(x,y,icon.width,icon.height); - } - else if (icon.depth == 1) // monochrome bitmap - { - XCopyPlane (_XDisplay, iconPM, GetDrawable(), _GC, - 0, 0, icon.width, icon.height, xx, yy, 1); - } - else - { - XCopyArea(_XDisplay, iconPM, GetDrawable(), _GC, - 0, 0, icon.width, icon.height, xx, yy); - } - } - -//====================>>> vXDC::DrawLine <<<========================== - void vXDC::DrawLine(int x, int y, int xend, int yend) - { - // Draw a line from x,y to xend,yend - - int xx = Scale(x+_tx); - int yy = Scale(y+_ty); - int xe = Scale(xend+_tx); - int ye = Scale(yend+_ty); - - SetGCtoPen(); - -#ifdef NO_NEGATIVE_LINES // Some versions of X die on this - if (xx < 0) xx = 0; - if (yy < 0) yy = 0; - if (xe < 0) xe = 0; - if (ye < 0) ye = 0; // X hates negative coords -#endif - - XDrawLine(_XDisplay, GetDrawable(), _GC, xx, yy, xe, ye); - } - -//====================>>> vXDC::DrawLines <<<========================== - void vXDC::DrawLines(vLine* lineList, int count) - { - // Draw a line from x,y to xend,yend - - if (count < 1 || lineList == 0) - return; - - SetGCtoPen(); - - vLine* lp = lineList ; - for (int num = 0 ; num < count ; ++lp, ++num) - { - int xx = Scale(lp->x+_tx); - int yy = Scale(lp->y+_ty); - int xe = Scale(lp->xend+_tx); - int ye = Scale(lp->yend+_ty); - - -#ifdef NO_NEGATIVE_LINES // Some versions of X die on this - if (xx < 0) xx = 0; - if (yy < 0) yy = 0; - if (xe < 0) xe = 0; - if (ye < 0) ye = 0; // X hates negative coords -#endif - - XDrawLine(_XDisplay, GetDrawable(), _GC, xx, yy, xe, ye); - } - } - -//==================>>> vXDC::DrawLines <<<====================== - void vXDC::DrawLines(vPoint* points, int n) - { - // Draw a poly line contecting each point - - - if (n < 2 || points == 0) - return; - - SetGCtoPen(); - - XPoint* xpoints; - - if (_hasScale || _tx != 0 || _ty != 0) // If we have to scale, then we need to copy - { - xpoints = new XPoint[n]; // allocate space for copy - for (int i = 0; i < n; i++) - { - xpoints[i].x = ((points[i].x+_tx) * _Mult) / _Div; // scale - xpoints[i].y = ((points[i].y+_ty) * _Mult) / _Div; - } - } - else - { - xpoints = (XPoint*)points; // just use original values - } - - XDrawLines (_XDisplay, GetDrawable(), _GC, xpoints, n, 0); - - if (_hasScale) - delete[]xpoints; - } - -//==================>>> vXDC::DrawColorPoints <<<====================== - void vXDC::DrawColorPoints(int x, int y, int nPoints, vColor* pointList) - { - // Draw a bunch of color points. - - if (nPoints < 1 || pointList == 0) - return; - - int xx = Scale(x+_tx); - int yy = Scale(y+_ty); - - if (yy < 0) - return; // row not displayed - - Pixel curpix = pointList[0].pixel(); // First pixel - Pixel prevpix = curpix; - - XSetBackground(_XDisplay, _GC, _canvasBG); - XSetForeground(_XDisplay, _GC, curpix); - - if (xx < 0) // need to check every time - { - for (int ix = 0 ; ix < nPoints ; ++ix) - { - if (xx+ix < 0) - continue; // this one not displayed - curpix = pointList[ix].pixel(); - if (curpix != prevpix) // don't reset color if same - { - XSetForeground(_XDisplay, _GC, curpix); - prevpix = curpix; - } - XDrawPoint(_XDisplay, GetDrawable(), _GC, xx+ix, yy); - } - } - else // don't need xx check - { - for (int ix = 0 ; ix < nPoints ; ++ix) - { - curpix = pointList[ix].pixel(); - if (curpix != prevpix) // don't reset color if same - { - XSetForeground(_XDisplay, _GC, curpix); - prevpix = curpix; - } - XDrawPoint(_XDisplay, GetDrawable(), _GC, xx+ix, yy); - } - } - } - -//==================>>> vXDC::DrawPoint <<<====================== - void vXDC::DrawPoint(int x, int y) - { - - int xx = Scale(x+_tx); - int yy = Scale(y+_ty); - - if (xx < 0 || yy < 0) return; // not displayable - - SetGCtoPen(); - - XDrawPoint(_XDisplay, GetDrawable(), _GC, xx, yy); - } - -//==================>>> vXDC::DrawPoints <<<====================== - void vXDC::DrawPoints(vPoint* pointList, int count) - { - - if (count < 1 || pointList == 0) - return; - SetGCtoPen(); - - vPoint* pl = pointList ; - for (int num = 0 ; num < count ; ++pl, ++num) - { - int xx = Scale(pl->x+_tx); - int yy = Scale(pl->y+_ty); - - if (xx < 0 || yy < 0) - continue; // not displayable - - XDrawPoint(_XDisplay, GetDrawable(), _GC, xx, yy); - } - } - -//==================>>> vXDC::DrawPolygon <<<====================== - void vXDC::DrawPolygon(int n, vPoint points[], int fillStyle) - { - // draw a complete polygon (starting point specified twice!) - - - XPoint* xpoints; - - if (_hasScale || _tx != 0 || _ty != 0) // If we have to scale, then we need to copy - { - xpoints = new XPoint[n]; // allocate space for copy - for (int i = 0; i < n; i++) - { - xpoints[i].x = ((points[i].x+_tx) * _Mult) / _Div; // scale - xpoints[i].y = ((points[i].y+_ty) * _Mult) / _Div; - } - } - else - { - xpoints = (XPoint*)points; // just use original values - } - - - if (_brush.brushStyle != vTransparent) - { - SetGCtoBrush(); - XSetFillRule (_XDisplay, _GC, // how to fill the polygon - (fillStyle == vAlternate) ? EvenOddRule : WindingRule); - // xpoints1 - XFillPolygon (_XDisplay, GetDrawable(), _GC, xpoints, n-1, Complex, 0); - XSetFillRule (_XDisplay, _GC, EvenOddRule); // default mode - } - - if (_pen.penStyle != vTransparent) - { - SetGCtoPen(); - // xpoints2 - XDrawLines (_XDisplay, GetDrawable(), _GC, xpoints, n, 0); - } - - if (_hasScale) - delete[]xpoints; -} - -//==================>>> vXDC::DrawRectangle <<<====================== - void vXDC::DrawRectangle(int x, int y, int width, int height) - { - - if (height == 0 || width == 0) // ignore 0 h/w - return; - - int xx = Scale(x+_tx); - int yy = Scale(y+_ty); - int w = Scale(width); - int h = Scale(height); - - if (w < 0) // convert to something we like - { - w = -w; // make a positive width - xx = xx - w; // translate x - } - if (h < 0) - { - h = -h; // positive h - yy = yy - h; // translate x - } - - if (_brush.brushStyle != vTransparent) - { - SetGCtoBrush(); - XFillRectangle(_XDisplay, GetDrawable(), _GC, xx, yy, w, h); - } - - if (_pen.penStyle != vTransparent) - { - SetGCtoPen(); - XDrawRectangle(_XDisplay, GetDrawable(), _GC, xx, yy, w, h); - } - } - -//==================>>> vXDC::DrawRectangles <<<====================== - void vXDC::DrawRectangles(vRect* rectList, int count) - { - - if (count < 1 || rectList == 0) - return; - - if (_brush.brushStyle != vTransparent) - SetGCtoBrush(); - - if (_pen.penStyle != vTransparent) - SetGCtoPen(); - - vRect* rp = rectList ; - for (int num = 0 ; num < count ; ++rp, ++num) - { - int xx = Scale(rp->x + _tx); - int yy = Scale(rp->y + _ty); - int w = Scale(rp->w); - int h = Scale(rp->h); - - if (h == 0 || w == 0) // ignore 0 h/w - continue; - - if (w < 0) // convert to something we like - { - w = -w; // make a positive width - xx = xx - w; // translate x - } - if (h < 0) - { - h = -h; // positive h - yy = yy - h; // translate x - } - - if (_brush.brushStyle != vTransparent) - { - XFillRectangle(_XDisplay, GetDrawable(), _GC, xx, yy, w, h); - } - - if (_pen.penStyle != vTransparent) - { - XDrawRectangle(_XDisplay, GetDrawable(), _GC, xx, yy, w, h); - } - } - } - -//================>>> vXDC::DrawRoundedRectangle <<<=================== - void vXDC::DrawRoundedRectangle(int x, int y, - int width, int height, int radius) - { - if (height == 0 || width == 0) // ignore 0 h/w - return; - - int xx = Scale(x+_tx); - int yy = Scale(y+_ty); - int w = Scale(width); - int h = Scale(height); - int r; - - if (w < 0) // convert to something we like - { - w = -w; // make a positive width - xx = xx - w; // translate x - } - if (h < 0) - { - h = -h; // positive h - yy = yy - h; // translate x - } - - if (radius < 0) - { - // Negative radius means divide average of hight and width - // by this - r = ((w+h)/(-2 * radius)); - } - else - r = Scale(radius); - - int cw = r + r; - - if (_brush.brushStyle != vTransparent) - { - SetGCtoBrush(); - // Draw three rectangles: the vertical, and then the sides - - XFillRectangle(_XDisplay, GetDrawable(), _GC, // full height in middle - xx+r, yy, w-cw, h); - XFillRectangle(_XDisplay, GetDrawable(), _GC, // left vertical box - xx, yy+r, r, h-cw); - XFillRectangle(_XDisplay, GetDrawable(), _GC, // right vertical box - xx+w-r, yy+r, r, h-cw); - - XFillArc(_XDisplay, GetDrawable(), _GC, // upper left - xx,yy,cw,cw, 90*64, 90*64); - XFillArc(_XDisplay, GetDrawable(), _GC, // upper right - xx+w-cw, yy, cw, cw, 0, 90*64); - XFillArc(_XDisplay, GetDrawable(), _GC, // bottom left - xx, yy+h-cw, cw, cw, 180 * 64, 90 * 64); - XFillArc(_XDisplay, GetDrawable(), _GC, // bottom right - xx+w-cw, yy+h-cw,cw,cw, 270 * 64, 90 * 64); - } - - if (_pen.penStyle != vTransparent) - { - SetGCtoPen(); - XDrawLine(_XDisplay, GetDrawable(), _GC, xx+r, yy, xx+w-r, yy); - XDrawLine(_XDisplay, GetDrawable(), _GC, xx+r, yy+h, xx+w-r, yy+h); - XDrawLine(_XDisplay, GetDrawable(), _GC, xx, yy+r, xx, yy+h-r); - XDrawLine(_XDisplay, GetDrawable(), _GC, xx+w, yy+r, xx+w, yy+h-r); - XDrawArc(_XDisplay, GetDrawable(), _GC, // upper left - xx,yy,cw,cw, 90*64, 90*64); - XDrawArc(_XDisplay, GetDrawable(), _GC, // upper right - xx+w-cw, yy, cw, cw, 0, 90*64); - XDrawArc(_XDisplay, GetDrawable(), _GC, // bottom left - xx, yy+h-cw, cw, cw, 180 * 64, 90 * 64); - XDrawArc(_XDisplay, GetDrawable(), _GC, // bottom right - xx+w-cw, yy+h-cw,cw,cw, 270 * 64, 90 * 64); - } - } - -//==================>>> vXDC::DrawRubberEllipse <<<=================== - void vXDC::DrawRubberEllipse(int x, int y, int width, int height) - { - if (height == 0 || width == 0) // ignore 0 h/w - return; - - int xx = Scale(x+_tx); - int yy = Scale(y+_ty); - int w = Scale(width); - int h = Scale(height); - - if (w < 0) // convert to something we like - { - w = -w; // make a positive width - xx = xx - w; // translate x - } - if (h < 0) - { - h = -h; // positive h - yy = yy - h; // translate x - } - - static const int angle = (360 * 64); - - SetPenStyle(_XorGC); - XDrawArc(_XDisplay, GetDrawable(), _XorGC, xx, yy, w, h, 0, angle); - } - -//==================>>> vXDC::DrawRubberLine <<<====================== - void vXDC::DrawRubberLine(int x, int y, int xend, int yend) - { - // Draw a rubber-band line from x,y to xend,yend. Redrawing - // over the same with will erase it. - - int xx = Scale(x+_tx); - int yy = Scale(y+_ty); - int xe = Scale(xend+_tx); - int ye = Scale(yend+_ty); - if (xx < 0) xx = 0; - if (yy < 0) yy = 0; - if (xe < 0) xe = 0; - if (ye < 0) ye = 0; // X hates negative coords - - SetPenStyle(_XorGC); - XDrawLine(_XDisplay, GetDrawable(), _XorGC, xx, yy, xe, ye); - } - -//==================>>> vXDC::DrawRubberPoint <<<====================== - void vXDC::DrawRubberPoint(int x, int y) - { - int xx = Scale(x+_tx); - int yy = Scale(y+_ty); - - if (xx < 0) xx = 0; - if (yy < 0) yy = 0; - - SetPenStyle(_XorGC); - XDrawPoint(_XDisplay, GetDrawable(), _GC, xx, yy); - } - -//==================>>> vXDC::DrawRubberRectangle <<<================== - void vXDC::DrawRubberRectangle(int x, int y, int width, int height) - { - if (height == 0 || width == 0) // ignore 0 h/w - return; - - int xx = Scale(x+_tx); - int yy = Scale(y+_ty); - int w = Scale(width); - int h = Scale(height); - - if (w < 0) // convert to something we like - { - w = -w; // make a positive width - xx = xx - w; // translate x - } - if (h < 0) - { - h = -h; // positive h - yy = yy - h; // translate x - } - - SetPenStyle(_XorGC); - XDrawRectangle(_XDisplay, GetDrawable(), _XorGC, xx, yy, w, h); - } - -//=====================>>> vXDC::DrawAttrText <<<========================== - void vXDC::DrawAttrText(int x, int y, VCONST char* text, const ChrAttr attr) - { - // Draw text with attributes at given x, y. - - // The fonts may not be equal because we are using a shared GC, - // and another window might change the font in the GC. We - // need to check the current font and change to our font if - // it is not the same - - static int mapColor[] = - { - vC_Black, vC_Blue, vC_Green, vC_Cyan, - vC_Red, vC_Magenta, vC_Yellow, vC_White, - vC_DarkGray, vC_DimBlue, vC_DimGreen, vC_DimCyan, - vC_DimRed, vC_DimMagenta, vC_DimYellow, vC_MedGray - }; - int xx = Scale(x+_tx); - int yy = Scale(y+_ty); - - if (_GCFont.GetXFont() != _font.GetXFont()) - { - // Change the font in the server - XSetFont( theApp->display(), _GC, - _font.GetXFont()->fid); - _GCFont = _font; // update current font - } - - Pixel attrColor = _pen.penColor.pixel(); // Default - if (attr & 0xF0 && theApp->Xdepth() > 1) // a color attribute - attrColor = vStdColors[ mapColor[((attr & 0xF0) >> 4)] ].pixel(); - - if (attr & ChReverse || attr & ChHighlight) - { - XSetForeground(_XDisplay, _GC, _canvasBG); - XSetBackground(_XDisplay, _GC, attrColor); - } - else if (attr & ChBlackOnBG) - { - XSetForeground(_XDisplay,_GC, - vStdColors[ mapColor[vC_Black] ].pixel()); - XSetBackground(_XDisplay, _GC, - vStdColors[ mapColor[((attr & 0xF0) >> 4)] ].pixel()); - } - else if (attr & ChWhiteOnBG) - { - XSetForeground(_XDisplay,_GC, - vStdColors[ mapColor[vC_Black] ].pixel()); - XSetBackground(_XDisplay, _GC, - vStdColors[ mapColor[((attr & 0xF0) >> 4)] ].pixel()); - } - else - { - XSetForeground(_XDisplay, _GC, attrColor); - XSetBackground(_XDisplay, _GC, _canvasBG); - } - - int len = strlen(text); - if (_font.GetAngle() == 90 || _font.GetAngle() == 180) - { - int asc, des; - int height = _font.XFontH(asc, des); - int ny; - if (_font.GetAngle() == 90) - ny = yy - (height-des)*(len-1); - else - ny = yy; - for (int i = 0 ; i>> vXDC::DrawText <<<========================== - void vXDC::DrawText(int x, int y, VCONST char* text) - { - // simple draw text at given x, y - - // The fonts may not be equal because we are using a shared GC, - // and another window might change the font in the GC. We - // need to check the current font and change to our font if - // it is not the same - - if (!text || !*text) - return; - int xx = Scale(x+_tx); - int yy = Scale(y+_ty); - - if (_GCFont.GetXFont() != _font.GetXFont()) - { - // Change the font in the server - XSetFont( theApp->display(), _GC, - _font.GetXFont()->fid); - _GCFont = _font; // update current font - } - - XSetForeground(_XDisplay, _GC, _pen.penColor.pixel()); - XSetBackground(_XDisplay, _GC, _canvasBG); - - int len = strlen(text); - if (_font.GetAngle() == 90 || _font.GetAngle() == 180) - { - int asc, des; - int height = _font.XFontH(asc, des); - int ny; - if (_font.GetAngle() == 90) - ny = yy - (height-des)*(len-1); - else - ny = yy; - for (int i = 0 ; i>> vXDC::SetBackground <<<========================== - void vXDC::SetBackground(VCONST vColor& color) - { - if (!color.IsMapped()) // Map the color? - color.MapColor(); - - _canvasBG = color.pixel(); // retrieve X pixel value - } - -//=====================>>> vXDC::SetBrush <<<============================ - void vXDC::SetBrush(VCONST vBrush& brush) - { - _brush = brush; - if (!_brush.brushColor.IsMapped()) // Map the color? - _brush.brushColor.MapColor(); - } - -//=====================>>> vXDC::SetGCtoBrush <<<======================== - void vXDC::SetGCtoBrush() - { - - XSetForeground(_XDisplay, _GC, _brush.brushColor.pixel()); - - if (_GCBrush == _brush) - return; - - Pixmap my_stipple = 0; - - switch (_brush.brushStyle) - { - case vSolid: - XSetFillStyle(_XDisplay,_GC,FillSolid); - break; - - case vTransparent: - XSetFillStyle(_XDisplay,_GC,FillSolid); - break; - - case vHorizontalHatch: - { - if (!horizPM) - horizPM = XCreateBitmapFromData (_XDisplay, - RootWindow (_XDisplay, DefaultScreen (_XDisplay)), - horiz_bits, horiz_width, horiz_height); - XSetFillStyle(_XDisplay,_GC,FillStippled); // we will set pixmaps - XSetStipple (_XDisplay, _GC, horizPM); - break; - } - - case vVerticleHatch: - { - if (!vertiPM) - vertiPM = XCreateBitmapFromData (_XDisplay, - RootWindow (_XDisplay, DefaultScreen (_XDisplay)), - verti_bits, verti_width, verti_height); - XSetFillStyle(_XDisplay,_GC,FillStippled); // we will set pixmaps - XSetStipple (_XDisplay, _GC, vertiPM); - break; - } - - case vLeftDiagonalHatch: - { - if (!ldiagPM) - ldiagPM = XCreateBitmapFromData (_XDisplay, - RootWindow (_XDisplay, DefaultScreen (_XDisplay)), - ldiag_bits, ldiag_width, ldiag_height); - XSetFillStyle(_XDisplay,_GC,FillStippled); // we will set pixmaps - XSetStipple (_XDisplay, _GC, ldiagPM); - break; - } - - case vRightDiagonalHatch: - { - if (!rdiagPM) - rdiagPM = XCreateBitmapFromData (_XDisplay, - RootWindow (_XDisplay, DefaultScreen (_XDisplay)), - rdiag_bits, rdiag_width, rdiag_height); - XSetFillStyle(_XDisplay,_GC,FillStippled); // we will set pixmaps - XSetStipple (_XDisplay, _GC, rdiagPM); - break; - } - - case vCrossHatch: - { - if (!crossPM) - crossPM = XCreateBitmapFromData (_XDisplay, - RootWindow (_XDisplay, DefaultScreen (_XDisplay)), - cross_bits, cross_width, cross_height); - XSetFillStyle(_XDisplay,_GC,FillStippled); // we will set pixmaps - XSetStipple (_XDisplay, _GC, crossPM); - break; - } - - case vDiagonalCrossHatch: - { - if (!cdiagPM) - cdiagPM = XCreateBitmapFromData (_XDisplay, - RootWindow (_XDisplay, DefaultScreen (_XDisplay)), - cdiag_bits, cdiag_width, cdiag_height); - XSetFillStyle(_XDisplay,_GC,FillStippled); // we will set pixmaps - XSetStipple (_XDisplay, _GC, cdiagPM); - break; - } - - default: - XSetFillStyle(_XDisplay,_GC,FillSolid); - break; - } - - _GCBrush = _brush; - - } - - -//=====================>>> vXDC::SetPenStyle <<<======================== - void vXDC::SetPenStyle(GC gc) - { - static char dot[] = {2, 5}; - static char dash[] = {4, 4}; - static char dashdot[] = {6, 6, 2, 6}; - - int ps; - switch (_pen.penStyle) // find a suitable X line style - { - case vSolid: - case vTransparent: - ps = LineSolid; - break; - - case vDash: - ps = LineOnOffDash; - XSetDashes(_XDisplay, gc, 0, dash, 2); - break; - - case vDot: - ps = LineOnOffDash; - XSetDashes(_XDisplay, gc, 0, dot, 2); - break; - - case vDashDot: - ps = LineOnOffDash; - XSetDashes(_XDisplay, gc, 0, dashdot, 4); - break; - - default: - ps = LineSolid; - break; - } - - XSetLineAttributes(_XDisplay, gc, _pen.penWidth, ps, CapButt, JoinMiter); - } - -//=====================>>> vXDC::SetGCtoPen <<<======================== - void vXDC::SetGCtoPen() - { - - XSetForeground(_XDisplay, _GC, _pen.penColor.pixel()); - XSetBackground(_XDisplay, _GC, _canvasBG); - - if (_GCPen == _pen) - return; - - SetPenStyle(_GC); - - XSetFillStyle(_XDisplay,_GC,FillSolid); - - _GCPen = _pen; - - } - -//=====================>>> vXDC::SetPen <<<============================ - void vXDC::SetPen(VCONST vPen& pen) - { - _pen = pen; - if (!_pen.penColor.IsMapped()) // Map the color? - _pen.penColor.MapColor(); - } - -//======================>>> vXDC::SetFont <<<=========================== - void vXDC::SetFont(VCONST vFont& vf) - { - // Change the font associated with this window. - - _font = vf; - - // First, make sure the font is loaded - - _GCFont = _font; // we have changed the font in - // the shared GC - _font.LoadFont(); - - XSetFont( theApp->display(), _GC, - _font.GetXFont()->fid); - } - -//====================>>> vXDC::TextHeight <<<============================= - int vXDC::TextHeight(int& asc, int& des) VCONST - { - // Return total height of this font. V will use total height, which - // is most often made up of ascent + descent. This is too much - // detail for the kind of apps V will support. - - return _font.XFontH(asc, des); - } - -//========================>>> vXDC::TextWidth <<<========================== - int vXDC::TextWidth(VCONST char* str) VCONST - { - if (_font.GetAngle() != 0) - { - int asc, des; - int height = _font.XFontH(asc, des); - if (_font.GetAngle() == 90 || _font.GetAngle() == 180) - return (height-des)*(strlen(str)); - } - - return _font.XTextW(str); - } diff --git a/v/srcx/vynreply.cxx b/v/srcx/vynreply.cxx deleted file mode 100644 index a06860f..0000000 --- a/v/srcx/vynreply.cxx +++ /dev/null @@ -1,87 +0,0 @@ -//=============================================================== -// vynreply.cxx - vYNReplyDialog class functions - X11R5 -// -// Copyright (C) 1995,1996 Bruce E. Wampler -// -// This file is part of the V C++ GUI Framework, and is covered -// under the terms of the GNU Library General Public License, -// Version 2. This library has NO WARRANTY. See the source file -// vapp.cxx for more complete information about license terms. -//=============================================================== - -#include // our header -#include // for icon - -// Define static data of the class - -#define prompt_width 32 -#define prompt_height 32 -static unsigned char prompt_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0x1f, 0x04, 0x00, 0x00, 0x20, - 0xe4, 0xff, 0xff, 0x27, 0x14, 0x00, 0x00, 0x28, 0x14, 0xc0, 0x01, 0x28, - 0x14, 0xe0, 0x03, 0x28, 0x14, 0x30, 0x06, 0x28, 0x14, 0x30, 0x06, 0x28, - 0x14, 0x00, 0x03, 0x28, 0x14, 0x80, 0x01, 0x28, 0x14, 0xc0, 0x00, 0x28, - 0x14, 0xc0, 0x00, 0x28, 0x14, 0xc0, 0x00, 0x28, 0x14, 0xc0, 0x00, 0x28, - 0x14, 0x00, 0x00, 0x28, 0x14, 0xc0, 0x00, 0x28, 0x14, 0x00, 0x00, 0x28, - 0xe4, 0xff, 0xff, 0x27, 0x04, 0x00, 0x00, 0x20, 0xf8, 0xff, 0xff, 0x1f, - 0xfe, 0xff, 0xff, 0x7f, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, - 0x02, 0x00, 0xe0, 0x47, 0x02, 0x00, 0x00, 0x40, 0xfa, 0xff, 0xff, 0x5f, - 0xae, 0xaa, 0xaa, 0x6a, 0x56, 0x55, 0x55, 0x55, 0xaa, 0xaa, 0xaa, 0x6a, - 0xfe, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00}; - - static vIcon prompt(&prompt_bits[0], prompt_height, prompt_width); - - static CommandObject YNDialog[] = - { - {C_Icon, 10, 0, "Pick?", (void*)&prompt, CA_None, isSens,NoFrame,0,0}, - {C_Label, 1, 0, "Select:", - NoList, CA_MainMsg, isSens,NoFrame, 10,0}, - - {C_Blank, 2, 0, " ", NoList, CA_None,isSens,NoFrame, 0, 10}, - {C_Button, M_Yes, M_Yes, " Yes ", NoList, - CA_DefaultButton, isSens, NoFrame, 2, 10}, - {C_Button, M_No, M_No, " No ", NoList,CA_None,isSens,NoFrame, M_Yes, 10}, - {C_Button, M_Cancel, M_Cancel, " Cancel ", NoList, - CA_None,isSens,NoFrame, M_No, 10}, - {C_Blank, 6, 0, " ", NoList, CA_None,isSens,NoFrame, 5, 10}, - {C_EndOfList,0,0,0,0,CA_None,0,0,0} - }; - - -//========================>>> vYNReplyDialog::AskYN <<<======================= - int vYNReplyDialog::AskYN(VCONST char* msg) - { - // Show a message, ask user Yes/No/Cancel - // returns < 0 for cancel, 0 for No, 1 for Yes - - int id, val; - - if (!_cmdsAdded) // only add commands once - { - AddDialogCmds(YNDialog); // Set up standard dialog - _cmdsAdded = 1; - } - id = ShowModalDialog(msg, val); // show and wait - switch (id) // convert to our system - { - case M_Yes: - return 1; - - case M_No: - return 0; - - case M_Cancel: - return -1; - }; - return -1; - } - -//====================>>> vYNReplyDialog::DialogCommand <<<======================= - void vYNReplyDialog::DialogCommand(ItemVal id, ItemVal val, CmdType ctype) - { - vModalDialog::DialogCommand(id,val,ctype); - if (id == M_Yes || id == M_No) - CloseDialog(); - } - -// ---------------------------------------------------------------------