pixmap-2.6pl4.orig/ 40755 243 144 0 6263264216 12702 5ustar joostuserspixmap-2.6pl4.orig/COPYRIGHT100644 243 144 2406 5564631736 14304 0ustar joostusersPixmap: ------- Copyright (c) 1991-1994 Lionel MALLET 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 Lionel MALLET 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 Lionel MALLET shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Lionel MALLET. pixmap-2.6pl4.orig/CHANGES100644 243 144 2311 5564664134 13775 0ustar joostusersChanges to the pixmap program are summarized here: 1.1 September 1991 Original version. Support for the Xpm3.0 library. Released as the MIT R5 contrib version. 1.1pl1 October 1991 Fix to functions' prototypes and casts. 1.1pl2 November 1991 Allocs protected by calling Xt functions. Initialization of PixmapWidget's comments fixed. 2.0 October 1992 Version 2.0. Support for the Xpm3.2 library. Redesigned color interface, full support for transparent color, extension and text edition. 2.1 October 1992 Version 2.1. A lot of fixes for ANSI compilers. 2.2 February 1994 Version 2.2. Port to Xpm3.3. File selector dialog in both Athena and Motif versions (Thx to Erik M. van der Poel, erik@sra.co.jp for the Athena version). Support for EditRes protocol. Private colormap. 2.3 February 1994 Version 2.3. Distribution packing mismatch on Graphics.c in 2.2. 2.4 Februrary 1994 Version 2.4. Distribution packing mismatch on several files in 2.3. Patch from R.K.Lloyd@csc.liv.ac.uk to compile on HP-UX 9.01 with ANSI C. 2.5 April 1994 Version 2.5. Port to Xpm 3.4. Fix of selection mechanism. 2.6 May 1994 Version 2.6. Submission to X11R6 contrib. pixmap-2.6pl4.orig/MANIFEST100644 243 144 2155 5564665562 14147 0ustar joostuserspixmap/COPYRIGHT pixmap/CHANGES pixmap/MANIFEST pixmap/README pixmap/patchlevel.h pixmap/Version.h pixmap/Imakefile pixmap/Makefile pixmap/CutPaste.c pixmap/Dialog.c pixmap/Dialog.h pixmap/ExtEdit.c pixmap/Extensions.c pixmap/Graphics.c pixmap/Handlers.c pixmap/PixEdit.c pixmap/Pixmap.h pixmap/Pixmap.c pixmap/PixmapP.h pixmap/PortEdit.c pixmap/Requests.h pixmap/ReqMach.c pixmap/TextOpt.c pixmap/TextOpt.h pixmap/pixmap.man pixmap/Pixmap.tex pixmap/APixmap.ad pixmap/MPixmap.ad pixmap/Stipple pixmap/Excl pixmap/Term pixmap/Up pixmap/MUp pixmap/Down pixmap/MDown pixmap/FlipHoriz pixmap/MFlipHoriz pixmap/FlipVert pixmap/MFlipVert pixmap/Fold pixmap/MFold pixmap/Left pixmap/MLeft pixmap/Right pixmap/MRight pixmap/RotateLeft pixmap/MRotateLeft pixmap/RotateRight pixmap/MRotateRight pixmap/wave.xpm pixmap/window.xpm pixmap/plaid.xpm pixmap/plaid_m.xpm pixmap/X11/Xfuncs.h pixmap/X11/Xfuncproto.h pixmap/X11/Xosdefs.h pixmap/SelFile/README pixmap/SelFile/Imakefile pixmap/SelFile/Makefile pixmap/SelFile/Dir.c pixmap/SelFile/Draw.c pixmap/SelFile/Path.c pixmap/SelFile/SFinternal.h pixmap/SelFile/SelFile.c pixmap/SelFile/xstat.h pixmap-2.6pl4.orig/README100644 243 144 10204 5565636513 13703 0ustar joostusers** Copyright 1991-94 Lionel MALLET -- See file COPYRIGHT ** Pixmap version 2.6 R4/R5/R6 version WHAT IS Pixmap? ============== Pixmap is a pixmap editor based on XPM version 3.4 library from Arnaud Le Hors - GROUPE BULL, derived from Davor Matic's bitmap editor (Davor Matic is member of the XConsortium AnneX). Here is provided a program similar to the bitmap editor. As Bitmap, it provides facilities to edit pixmaps stored in files in XPM 3 format. NOTE: The XPM library is mandatory. You should have got and installed it before proceeding. See the Pixmap Manual (pixmap.man) for more details. HOW TO GET Pixmap? ================= New pixmap updates are announced on the comp.windows.x newsgroup, and on the "pixmap" list. All new "official" pixmap releases can be found by ftp on: ftp.x.org (198.112.44.100) contrib/applications/pixmap (Boston, USA) avahi.inria.fr (192.5.60.47) pub/pixmap (Sophia Antipolis, France) DOCUMENTATION: ============= Pixmap is not fully documented but is also self explanatory. A Reference Card in LaTeX format is joined which contains the main facilities of the editor: accelerator keys, resources, application files, ... The rest of the information can be found in the manual file pixmap.man. We can mail you a PostScript version of the documentation if you are not able to print it (quite impossible). INSTALLATION: ============ To obtain the Pixmap editor program, first uncompress and untar the compressed tar file (or unshar the shar file) in an approriate directory. Pixmap only compiles with Imake. As Pixmap can have two different interfaces, based on Athena and Motif, (see MOTIF DISCUSSION about Motif version) you should look at the Imakefile to set the variables corresponding to the version you wish to obtain. The default version is the Athena one. The variable of interest is USE_MOTIF (#define or #undef it as you like). You should also look at the lines concerning the Pixmap.ad file creation. In any case, you should set up the XPM relative variables correctly. These are XPM_INCLUDEDIR and XPM_LIBDIR. You should also check the setting of APPDEFDIR and RGBF so that they point to your site application defaults directory and rgb.txt file (the latter is usually under $(LIBDIR)/rgb.txt with LIBDIR=/usr/lib/X11). Double check the Imakefile and type: xmkmf -a make which will build the pixmap program and its application defaults file. Then do: make install make install.man which will install the program, application defaults file, the pixmap man page and the bitmaps used as image labels of buttons. If it fails, you may edit the Imakefile to add compilation flags to suit your machine. NOTE: A sample dotpixmap file (color configuration file) is created by the Makefile based on the rgb.txt file (RGBF variable). You can extract parts of this file to build your own .pixmap file used by Pixmap. NOTE: This version is an intermediate between R4 and R5/R6. It provides R5 include files missing in R4. Thus, if you are already running R5, you can remove the files Xfuncs.h, Xosdefs.h and Xfuncproto.h under pixmap/X11 directory. CONVERTERS: ========== In the Xmu directory you can find different converters about XPM. These are converters that can be installed in an application to allow specification of pixmap resources in .Xdefaults and application default files. No Makefile or Imakefile is provided to compile or install them. However, someone is currently working on converters to allow full use of the Xpm library features through resources. KNOWN PROBLEMS: ============== The accelerators don't seem to work with Athena with X11R4. Sometimes pixmap stops when not able to malloc memory after a few loading ops. DISCUSSION: ========== There is a mailing list to discuss about Pixmap which is pixmap@sophia.inria.fr. Any request to subscribe should be sent to pixmap-talk-request@sophia.inria.fr. COPYRIGHT: ========== Copyright 1991-1994 Lionel MALLET -- See licence conditions in the COPYRIGHT file of the Pixmap distribution Please mail any bug reports or modifications done, comments, suggestions, requests for updates or patches to port on another machine to: pixmap@sophia.inria.fr (INTERNET) pixmap-2.6pl4.orig/patchlevel.h100440 243 144 2704 6263264165 15277 0ustar joostusers/* * $Id: patchlevel.h,v 1.9 1996/09/02 16:53:01 lmallet Exp $ * * Copyright (c) 1991-1994 Lionel MALLET * * 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 Lionel MALLET 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 Lionel MALLET shall * not be used in advertising or otherwise to promote the sale, use or * other dealings in this Software without prior written authorization * from Lionel MALLET. * * Author: Lionel Mallet, SIMULOG */ #define PATCHLEVEL 4 pixmap-2.6pl4.orig/Version.h100440 243 144 632 6263264165 14553 0ustar joostusersstatic char *version = "$PixmapEditorVersion: 2.6 $"; static char *info ="\n\ Pixmap 2.6.%d was derived from Davor Matic's Bitmap\n\ by Lionel Mallet - Simulog, helped by Tim Wise - SES Inc.\n\ (Davor Matic is member of the Xconsortium AnneX)\n\ Pixmap uses the enhanced Xpm library written by\n\ Arnaud Le Hors from Groupe Bull.\n\ \n\ For bugs and suggestions write to:\n\ pixmap@sophia.inria.fr"; pixmap-2.6pl4.orig/Imakefile100644 243 144 5260 5564657306 14624 0ustar joostusers#ifdef BandAidCompiler #include BandAidCompiler #endif XCOMM XCOMM Author: Lionel Mallet, Simulog XCOMM Created: April 20, 1991. XCOMM XCOMM def/undef USE_MOTIF there if you want Pixmap to use Motif or not. #undef USE_MOTIF #ifdef HPArchitecture CCOPTIONS = -Aa -D_HPUX_SOURCE -DNO_EDITRES #if ProjectX > 4 MOTIFVER = Motif1.2 R5EXT = #else MOTIFVER = Motif1.1 R5EXT = -I. #endif #endif XCOMM Where you have rgb.txt RGBTXT = $(LIBDIR)/rgb.txt XCOMM LUCS extra variable for where bitmaps go PIXMAPDIR = $(LIBDIR)/Pixmap XCOMM Specify here your Xpm installation directories XPM_INCLUDEDIR = /usr/local/include XPM_LIBDIR = $(LIBDIR)/xpm XPM_INCLUDEDIR = /net/koala/include XPM_LIBDIR = /net/koala/lib/sun4 EXTRA_INCLUDES = $(R5EXT) -I. -I.. -I$(XPM_INCLUDEDIR) -I/usr/include/$(MOTIFVER) #ifdef USE_MOTIF XCOMM Motif configuration LOCAL_DEFINES = $(IEEE_DEFS) $(SIGNAL_DEFINES) -D_NO_PROTO LOCAL_LIBRARIES = -L$(XPM_LIBDIR) -lXpm -L/usr/lib/$(MOTIFVER) -lXm $(XMULIB) $(XTOOLLIB) $(XLIB) BITMAPS = MDown MFlipHoriz MFlipVert MFold MLeft MRight MRotateLeft \ MRotateRight Stipple MUp #else XCOMM Athena configuration LOCAL_DEFINES = $(IEEE_DEFS) $(SIGNAL_DEFINES) -DUSE_ATHENA DEPLIBS = XawClientDepLibs LOCAL_LIBRARIES = -L$(XPM_LIBDIR) -lXpm -LSelFile -lXgnu XawClientLibs BITMAPS = Down FlipHoriz FlipVert Fold Left Right RotateLeft \ RotateRight Stipple Up Term Excl #define IHaveSubdirs #define PassCDebugFlags 'CC=$(CC)' 'CFLAGS=$(CFLAGS)' SUBDIRS = SelFile DEPLIBS = Xgnu #endif SYS_LIBRARIES = -lm SRCS = PixEdit.c Pixmap.c Dialog.c OBJS = PixEdit.o Pixmap.o Dialog.o #if ProjectX < 5 DEFINES = $(LOCAL_DEFINES) -DXPointer="char *" \ -DAPPDEFDIR=\"$(XAPPLOADDIR)\" \ -DRGBF=\"$(RGBTXT)\" -DNO_EDITRES #else DEFINES = $(LOCAL_DEFINES) -DAPPDEFDIR=\"$(XAPPLOADDIR)\" \ -DRGBF=\"$(RGBTXT)\" #endif ComplexProgramTarget(pixmap) InstallAppDefaults(Pixmap) MakeDirectories(install, $(PIXMAPDIR)) InstallMultipleFlags($(BITMAPS), $(PIXMAPDIR), $(INSTDATFLAGS)) AllTarget(dotpixmap) all:: Pixmap.ad clean:: Pixmap.ad $(RM) Pixmap.ad #ifdef USE_MOTIF Pixmap.ad: MPixmap.ad @echo Pixmap compiled with Motif. @sed -e "s#@PIXMAPDIR@#$(PIXMAPDIR)/#g" Pixmap.ad #else NamedMakeSubdirs(Xgnu, SelFile) Pixmap.ad: APixmap.ad @echo Pixmap compiled with Athena. @sed -e "s#@PIXMAPDIR@#$(PIXMAPDIR)/#g" Pixmap.ad #endif dotpixmap: $(RGBTXT) awk 'NF == 4 && $$4 !~ /[Gg]rey/ && $$4 !~ /[0-9]/ {print $$4}' $(RGBTXT) > dotpixmap doc: Pixmap.tex latex Pixmap.tex latex Pixmap.tex dvips -o Pixmap.ps Pixmap.dvi pixmap-2.6pl4.orig/Makefile100644 243 144 51541 5565614114 14465 0ustar joostusers# Makefile generated by imake - do not edit! # $XConsortium: imake.c,v 1.87 94/04/17 20:10:28 rws Exp $ # ----------------------------------------------------------------------- # Makefile generated from "Imake.tmpl" and # $XConsortium: Imake.tmpl,v 1.218 94/03/31 20:11:26 matt Exp $ # .SUFFIXES: .i # $XConsortium: Imake.cf,v 1.12 94/03/29 15:42:08 gildea Exp $ # ----------------------------------------------------------------------- # site-specific configuration parameters that need to come before # the platform-specific parameters - edit site.def to change # site: $XConsortium: site.sample,v 1.9 94/04/08 17:02:06 rws Exp $ # ----------------------------------------------------------------------- # platform-specific configuration parameters - edit sun.cf to change # platform: $XConsortium: sun.cf,v 1.129 94/04/09 16:06:28 rws Exp $ # operating system: SunOS 4.1.3 # $XConsortium: sunLib.rules,v 1.14 94/03/28 15:24:43 gildea Exp $ # ----------------------------------------------------------------------- # site-specific configuration parameters that go after # the platform-specific parameters - edit site.def to change # site: $XConsortium: site.sample,v 1.9 94/04/08 17:02:06 rws Exp $ # ----------------------------------------------------------------------- # Imake rules for building libraries, programs, scripts, and data files # rules: $XConsortium: Imake.rules,v 1.193 94/04/10 17:39:55 rws Exp $ PATHSEP = / SHELL = /bin/sh TOP = . CURRENT_DIR = . IMAKE = imake DEPEND = makedepend MKDIRHIER = mkdirhier CONFIGSRC = $(TOP)/config IMAKESRC = $(CONFIGSRC)/imake DEPENDSRC = $(CONFIGSRC)/makedepend IXXSRC = $(UNSUPPORTEDSRC)/programs/ixx IXX = ixx IXXFLAGS = -s BaseObject -m TypeObj -r RequestObj -p Xf IXXINCLUDES = -i '' INCROOT = /usr/X11R6/include USRLIBDIR = /usr/X11R6/lib SHLIBDIR = /usr/X11R6/lib LINTLIBDIR = $(USRLIBDIR)/lint MANPATH = /usr/X11R6/man MANSOURCEPATH = $(MANPATH)/man MANDIR = $(MANSOURCEPATH)$(MANSUFFIX) LIBMANDIR = $(MANSOURCEPATH)$(LIBMANSUFFIX) FILEMANDIR = $(MANSOURCEPATH)$(FILEMANSUFFIX) AR = ar clq BOOTSTRAPCFLAGS = CC = cc AS = as COMPRESS = compress CPP = /lib/cpp $(STD_CPP_DEFINES) PREPROCESSCMD = cc -E $(STD_CPP_DEFINES) INSTALL = install INSTALLFLAGS = -c LD = ld LEX = lex LEXLIB = -ll YACC = yacc CCYACC = yacc LINT = lint LINTLIBFLAG = -C LINTOPTS = -axz LN = ln -s MAKE = make MV = mv CP = cp RANLIB = ranlib RANLIBINSTFLAGS = RM = rm -f MANSUFFIX = n LIBMANSUFFIX = 3 FILEMANSUFFIX = 4 TROFF = psroff MSMACROS = -ms TBL = tbl EQN = eqn STD_INCLUDES = STD_CPP_DEFINES = STD_DEFINES = EXTRA_LOAD_FLAGS = EXTRA_LDOPTIONS = EXTRA_LIBRARIES = TAGS = ctags SHAREDCODEDEF = -DSHAREDCODE SHLIBDEF = -DSUNSHLIB SHLIBLDFLAGS = -assert pure-text PICFLAGS = -pic CXXPICFLAGS = -pic PROTO_DEFINES = INSTPGMFLAGS = INSTBINFLAGS = -m 0755 INSTUIDFLAGS = -m 4755 INSTLIBFLAGS = -m 0644 INSTINCFLAGS = -m 0444 INSTMANFLAGS = -m 0444 INSTDATFLAGS = -m 0444 INSTKMEMFLAGS = -g kmem -m 2755 PROJECTROOT = /usr/X11R6 TOP_INCLUDES = -I$(INCROOT) CDEBUGFLAGS = -O CCOPTIONS = ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(STD_INCLUDES) ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(THREADS_DEFINES) $(DEFINES) CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(THREADS_CFLAGS) $(ALLDEFINES) LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES) $(DEPEND_DEFINES) LDPRELIB = -L$(USRLIBDIR) LDPOSTLIB = LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) $(EXTRA_LDOPTIONS) $(THREADS_LDFLAGS) $(LOCAL_LDFLAGS) $(LDPRELIB) CXXLDOPTIONS = $(CDEBUGFLAGS) $(CXXOPTIONS) $(EXTRA_LDOPTIONS) $(THREADS_CXXLDFLAGS) $(LOCAL_LDFLAGS) $(LDPRELIB) LDLIBS = $(LDPOSTLIB) $(THREADS_LIBS) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) CCLINK = $(CC) CXXLINK = $(CXX) LDSTRIPFLAGS = -x LDCOMBINEFLAGS = -X -r DEPENDFLAGS = MACROFILE = sun.cf RM_CMD = $(RM) IMAKE_DEFINES = IRULESRC = $(CONFIGDIR) IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES) ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Project.tmpl \ $(IRULESRC)/site.def $(IRULESRC)/$(MACROFILE) \ $(EXTRA_ICONFIGFILES) # ----------------------------------------------------------------------- # X Window System Build Parameters and Rules # $XConsortium: Project.tmpl,v 1.242 94/04/13 14:58:40 rws Exp $ # ----------------------------------------------------------------------- # X Window System make variables; these need to be coordinated with rules BINDIR = /usr/X11R6/bin BUILDINCROOT = $(TOP) BUILDINCDIR = $(BUILDINCROOT)/X11 BUILDINCTOP = .. BUILDLIBDIR = $(TOP)/usrlib BUILDLIBTOP = .. INCDIR = $(INCROOT)/X11 ADMDIR = /usr/adm LIBDIR = $(USRLIBDIR)/X11 FONTDIR = $(LIBDIR)/fonts XINITDIR = $(LIBDIR)/xinit XDMDIR = $(LIBDIR)/xdm TWMDIR = $(LIBDIR)/twm NLSDIR = $(LIBDIR)/nls XLOCALEDIR = $(LIBDIR)/locale PEXAPIDIR = $(LIBDIR)/PEX XAPPLOADDIR = $(LIBDIR)/app-defaults FONTCFLAGS = -t INSTAPPFLAGS = $(INSTDATFLAGS) RGB = rgb FONTC = bdftopcf MKFONTDIR = mkfontdir DOCUTILSRC = $(TOP)/doc/util XDOCMACROS = $(DOCUTILSRC)/macros.t XIDXMACROS = $(DOCUTILSRC)/indexmacros.t PROGRAMSRC = $(TOP)/programs LIBSRC = $(TOP)/lib FONTSRC = $(TOP)/fonts INCLUDESRC = $(TOP)/X11 SERVERSRC = $(TOP)/programs/Xserver CONTRIBSRC = $(TOP)/../contrib UNSUPPORTEDSRC = $(TOP)/unsupported DOCSRC = $(TOP)/doc RGBSRC = $(TOP)/programs/rgb BDFTOPCFSRC = $(PROGRAMSRC)/bdftopcf MKFONTDIRSRC = $(PROGRAMSRC)/mkfontdir FONTSERVERSRC = $(PROGRAMSRC)/xfs FONTINCSRC = $(TOP)/include/fonts EXTINCSRC = $(TOP)/include/extensions TRANSCOMMSRC = $(LIBSRC)/xtrans TRANS_INCLUDES = -I$(TRANSCOMMSRC) # $XConsortium: sunLib.tmpl,v 1.36 94/04/08 19:13:50 rws Exp $ XLIBSRC = $(LIBSRC)/X11 SOXLIBREV = 4.20 DEPXONLYLIB = XONLYLIB = -lX11 LINTXONLY = $(LINTLIBDIR)/llib-lX11.ln XLIBONLY = $(XONLYLIB) XEXTLIBSRC = $(LIBSRC)/Xext SOXEXTREV = 4.20 DEPEXTENSIONLIB = EXTENSIONLIB = -lXext LINTEXTENSION = $(LINTLIBDIR)/llib-lXext.ln LINTEXTENSIONLIB = $(LINTEXTENSION) DEPXLIB = $(DEPEXTENSIONLIB) $(DEPXONLYLIB) XLIB = $(EXTENSIONLIB) $(XONLYLIB) LINTXLIB = $(LINTXONLYLIB) XAUTHSRC = $(LIBSRC)/Xau DEPXAUTHLIB = $(USRLIBDIR)/libXau.a XAUTHLIB = -lXau LINTXAUTH = $(LINTLIBDIR)/llib-lXau.ln XDMCPLIBSRC = $(LIBSRC)/Xdmcp DEPXDMCPLIB = $(USRLIBDIR)/libXdmcp.a XDMCPLIB = -lXdmcp LINTXDMCP = $(LINTLIBDIR)/llib-lXdmcp.ln XMUSRC = $(LIBSRC)/Xmu SOXMUREV = 4.20 DEPXMULIB = $(USRLIBDIR)/libXmu.sa.$(SOXMUREV) XMULIB = -lXmu LINTXMU = $(LINTLIBDIR)/llib-lXmu.ln OLDXLIBSRC = $(LIBSRC)/oldX SOOLDXREV = 4.20 DEPOLDXLIB = OLDXLIB = -loldX LINTOLDX = $(LINTLIBDIR)/llib-loldX.ln TOOLKITSRC = $(LIBSRC)/Xt SOXTREV = 4.20 DEPXTOOLONLYLIB = $(USRLIBDIR)/libXt.sa.$(SOXTREV) XTOOLONLYLIB = -lXt LINTXTOOLONLY = $(LINTLIBDIR)/llib-lXt.ln DEPXTOOLLIB = $(DEPXTOOLONLYLIB) $(DEPSMLIB) $(DEPICELIB) XTOOLLIB = $(XTOOLONLYLIB) $(SMLIB) $(ICELIB) LINTXTOOLLIB = $(LINTXTOOLONLYLIB) AWIDGETSRC = $(LIBSRC)/Xaw SOXAWREV = 6.0 DEPXAWLIB = $(USRLIBDIR)/libXaw.sa.$(SOXAWREV) XAWLIB = -lXaw LINTXAW = $(LINTLIBDIR)/llib-lXaw.ln XTFSRC = $(TOP)/workInProgress/Xtf SOXTFREV = 0.7 DEPXTFLIB = XTFLIB = -lXtf LINTXTF = $(LINTLIBDIR)/llib-lXtf.ln FRESCOSRC = $(TOP)/workInProgress/Fresco SOFRESCOREV = 0.7 DEPFRESCOLIB = FRESCOLIB = -lFresco LINTFRESCO = $(LINTLIBDIR)/llib-lFresco.ln XILIBSRC = $(LIBSRC)/Xi SOXINPUTREV = 4.20 DEPXILIB = XILIB = -lXi LINTXI = $(LINTLIBDIR)/llib-lXi.ln XTESTLIBSRC = $(LIBSRC)/Xtst SOXTESTREV = 1.10 DEPXTESTLIB = XTESTLIB = -lXtst LINTXTEST = $(LINTLIBDIR)/llib-lXtst.ln PEXLIBSRC = $(LIBSRC)/PEX5 SOPEXREV = 1.10 DEPPEXLIB = PEXLIB = -lPEX5 LINTPEX = $(LINTLIBDIR)/llib-lPEX5.ln XIELIBSRC = $(LIBSRC)/XIE SOXIEREV = 6.0 DEPXIELIB = XIELIB = -lXIE LINTXIE = $(LINTLIBDIR)/llib-lXIE.ln PHIGSLIBSRC = $(LIBSRC)/PHIGS DEPPHIGSLIB = $(USRLIBDIR)/libphigs.a PHIGSLIB = -lphigs LINTPHIGS = $(LINTLIBDIR)/llib-lphigs.ln DEPXBSDLIB = $(USRLIBDIR)/libXbsd.a XBSDLIB = -lXbsd LINTXBSD = $(LINTLIBDIR)/llib-lXbsd.ln ICESRC = $(LIBSRC)/ICE SOICEREV = 6.0 DEPICELIB = ICELIB = -lICE LINTICE = $(LINTLIBDIR)/llib-lICE.ln SMSRC = $(LIBSRC)/SM SOSMREV = 6.0 DEPSMLIB = SMLIB = -lSM LINTSM = $(LINTLIBDIR)/llib-lSM.ln FSLIBSRC = $(LIBSRC)/FS DEPFSLIB = $(USRLIBDIR)/libFS.a FSLIB = -lFS LINTFS = $(LINTLIBDIR)/llib-lFS.ln FONTLIBSRC = $(LIBSRC)/font DEPFONTLIB = $(USRLIBDIR)/libfont.a FONTLIB = -lfont LINTFONT = $(LINTLIBDIR)/llib-lfont.ln DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB) DEPLIBS1 = $(DEPLIBS) DEPLIBS2 = $(DEPLIBS) DEPLIBS3 = $(DEPLIBS) CONFIGDIR = $(LIBDIR)/config # ----------------------------------------------------------------------- # start of Imakefile # # Author: Lionel Mallet, Simulog # Created: April 20, 1991. # # def/undef USE_MOTIF there if you want Pixmap to use Motif or not. # Where you have rgb.txt RGBTXT = $(LIBDIR)/rgb.txt # LUCS extra variable for where bitmaps go PIXMAPDIR = $(LIBDIR)/Pixmap # Specify here your Xpm installation directories XPM_INCLUDEDIR = /usr/local/include XPM_LIBDIR = $(LIBDIR)/xpm XPM_INCLUDEDIR = /net/koala/include XPM_LIBDIR = /net/koala/lib/sun4 EXTRA_INCLUDES = $(R5EXT) -I. -I.. -I$(XPM_INCLUDEDIR) # Specify here where you want the Pixmap private bitmaps to be # installed BITMAPSDIR = $(INCDIR)/bitmaps/Pixmap # Athena configuration LOCAL_DEFINES = $(IEEE_DEFS) $(SIGNAL_DEFINES) -DUSE_ATHENA DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB) LOCAL_LIBRARIES = -L$(XPM_LIBDIR) -lXpm -LSelFile -lXgnu $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB) BITMAPS = Down FlipHoriz FlipVert Fold Left Right RotateLeft \ RotateRight Stipple Up Term Excl SUBDIRS = SelFile DEPLIBS = Xgnu SYS_LIBRARIES = -lm SRCS = PixEdit.c Pixmap.c Dialog.c OBJS = PixEdit.o Pixmap.o Dialog.o DEFINES = $(LOCAL_DEFINES) -DAPPDEFDIR=\"$(XAPPLOADDIR)\" \ -DRGBF=\"$(RGBTXT)\" PROGRAM = pixmap all:: pixmap pixmap: $(OBJS) $(DEPLIBS) $(RM) $@ $(CCLINK) -o $@ $(LDOPTIONS) $(OBJS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS) install:: pixmap @if [ -d $(DESTDIR)$(BINDIR) ]; then set +x; \ else (set -x; $(MKDIRHIER) $(DESTDIR)$(BINDIR)); fi $(INSTALL) $(INSTALLFLAGS) $(INSTPGMFLAGS) pixmap $(DESTDIR)$(BINDIR)/pixmap install.man:: pixmap.man @if [ -d $(DESTDIR)$(MANDIR) ]; then set +x; \ else (set -x; $(MKDIRHIER) $(DESTDIR)$(MANDIR)); fi $(INSTALL) $(INSTALLFLAGS) $(INSTMANFLAGS) pixmap.man $(DESTDIR)$(MANDIR)/pixmap.$(MANSUFFIX) depend:: $(DEPEND) $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- $(SRCS) lint: $(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS) lint1: $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS) clean:: $(RM) pixmap install:: Pixmap.ad @if [ -d $(DESTDIR)$(XAPPLOADDIR) ]; then set +x; \ else (set -x; $(MKDIRHIER) $(DESTDIR)$(XAPPLOADDIR)); fi $(INSTALL) $(INSTALLFLAGS) $(INSTAPPFLAGS) Pixmap.ad $(DESTDIR)$(XAPPLOADDIR)/Pixmap install:: @case '${MFLAGS}' in *[i]*) set +e;; esac; @for i in $(PIXMAPDIR); do if [ -d $(DESTDIR)$$i ]; then \ set +x; else (set -x; $(MKDIRHIER) $(DESTDIR)$$i); fi \ done install:: $(BITMAPS) @if [ -d $(DESTDIR) $(PIXMAPDIR) ]; then set +x; \ else (set -x; $(MKDIRHIER) $(DESTDIR) $(PIXMAPDIR)); fi @case '${MFLAGS}' in *[i]*) set +e;; esac; \ for i in $(BITMAPS); do \ (set -x; $(INSTALL) $(INSTALLFLAGS) $(INSTDATFLAGS) $$i $(DESTDIR) $(PIXMAPDIR)); \ done all:: dotpixmap all:: Pixmap.ad clean:: Pixmap.ad $(RM) Pixmap.ad Xgnu:: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ for i in SelFile ;\ do \ (cd $$i ; echo "making" Xgnu "in $(CURRENT_DIR)/$$i..."; \ $(MAKE) $(MFLAGS) 'CC=$(CC)' 'CFLAGS=$(CFLAGS)' all); \ done Pixmap.ad: APixmap.ad @echo Pixmap compiled with Athena. @sed -e "s#@PIXMAPDIR@#$(PIXMAPDIR)/#g" Pixmap.ad dotpixmap: $(RGBTXT) awk 'NF == 4 && $$4 !~ /[Gg]rey/ && $$4 !~ /[0-9]/ {print $$4}' $(RGBTXT) > dotpixmap doc: Pixmap.tex latex Pixmap.tex latex Pixmap.tex dvips -o Pixmap.ps Pixmap.dvi # ----------------------------------------------------------------------- # common rules for all Makefiles - do not edit .c.i: $(RM) $@ $(CC) -E $(CFLAGS) $(_NOOP_) $*.c > $@ emptyrule:: clean:: $(RM_CMD) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut "#"* Makefile:: -@if [ -f Makefile ]; then set -x; \ $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \ else exit 0; fi $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) tags:: $(TAGS) -w *.[ch] $(TAGS) -xw *.[ch] > TAGS # ----------------------------------------------------------------------- # rules for building in SUBDIRS - do not edit install:: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ for i in $(SUBDIRS) ;\ do \ (cd $$i ; echo "installing" "in $(CURRENT_DIR)/$$i..."; \ $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) install); \ done install.man:: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ for i in $(SUBDIRS) ;\ do \ (cd $$i ; echo "installing man pages" "in $(CURRENT_DIR)/$$i..."; \ $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) install.man); \ done clean:: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ for i in $(SUBDIRS) ;\ do \ (cd $$i ; echo "cleaning" "in $(CURRENT_DIR)/$$i..."; \ $(MAKE) $(MFLAGS) RM_CMD='$(RM_CMD)' clean); \ done tags:: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ for i in $(SUBDIRS) ;\ do \ (cd $$i ; echo "tagging" "in $(CURRENT_DIR)/$$i..."; \ $(MAKE) $(MFLAGS) TAGS='$(TAGS)' tags); \ done Makefiles:: -@case '${MFLAGS}' in *[ik]*) set +e;; esac; \ case '${MFLAGS}' in *n*) executeit="no";; esac; \ for i in $(SUBDIRS) ;\ do \ case "$(CURRENT_DIR)" in \ .) curdir= ;; \ *) curdir=$(CURRENT_DIR)/ ;; \ esac; \ echo "making Makefiles in $$curdir$$i..."; \ case "$$i" in \ */?*/?*/?*) newtop=../../../..;; \ */?*/?*) newtop=../../..;; \ */?*) newtop=../..;; \ *) newtop=..;; \ esac; \ case "$(TOP)" in \ /?*) imaketop=$(TOP) \ imakeprefix= ;; \ .) imaketop=$$newtop \ imakeprefix=$$newtop/ ;; \ *) imaketop=$$newtop/$(TOP) \ imakeprefix=$$newtop/ ;; \ esac; \ cd $$i; \ $(RM) Makefile.bak; \ if [ -f Makefile ]; then \ echo " $(MV) Makefile Makefile.bak"; \ if [ "$$executeit" != "no" ]; then \ $(MV) Makefile Makefile.bak; \ fi; \ fi; \ if [ "$$executeit" != "no" ]; then \ $(IMAKE_CMD) -DTOPDIR=$$imaketop -DCURDIR=$$curdir$$i; \ fi; \ $(MAKE) $(MFLAGS) Makefiles; \ cd $$newtop; \ done includes:: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ for i in $(SUBDIRS) ;\ do \ (cd $$i ; echo including "in $(CURRENT_DIR)/$$i..."; \ $(MAKE) $(MFLAGS) includes); \ done # ----------------------------------------------------------------------- # dependencies generated by makedepend # DO NOT DELETE # DO NOT DELETE THIS LINE -- make depend depends on it. PixEdit.o: /usr/include/stdio.h /usr/X11R6/include/X11/Intrinsic.h PixEdit.o: /usr/X11R6/include/X11/Xlib.h /usr/include/sys/types.h PixEdit.o: /usr/include/sys/stdtypes.h /usr/include/sys/sysmacros.h PixEdit.o: /usr/X11R6/include/X11/X.h ./X11/Xfuncproto.h ./X11/Xosdefs.h PixEdit.o: /usr/include/stddef.h /usr/X11R6/include/X11/Xutil.h PixEdit.o: /usr/X11R6/include/X11/Xresource.h /usr/include/string.h PixEdit.o: /usr/X11R6/include/X11/Core.h /usr/X11R6/include/X11/Composite.h PixEdit.o: /usr/X11R6/include/X11/Constraint.h PixEdit.o: /usr/X11R6/include/X11/Object.h /usr/X11R6/include/X11/RectObj.h PixEdit.o: /usr/X11R6/include/X11/Xos.h /usr/include/fcntl.h PixEdit.o: /usr/include/sys/fcntlcom.h /usr/include/sys/stat.h PixEdit.o: /usr/include/unistd.h /usr/include/sys/time.h PixEdit.o: /usr/include/sys/time.h X11/Xfuncs.h PixEdit.o: /usr/X11R6/include/X11/StringDefs.h PixEdit.o: /usr/X11R6/include/X11/extensions/shape.h PixEdit.o: /usr/X11R6/include/X11/Xaw/AsciiText.h PixEdit.o: /usr/X11R6/include/X11/Xaw/Text.h PixEdit.o: /usr/X11R6/include/X11/Xaw/Simple.h PixEdit.o: /usr/X11R6/include/X11/Xmu/Converters.h PixEdit.o: /usr/X11R6/include/X11/Xaw/TextSink.h PixEdit.o: /usr/X11R6/include/X11/Xaw/TextSrc.h PixEdit.o: /usr/X11R6/include/X11/Xaw/AsciiSrc.h PixEdit.o: /usr/X11R6/include/X11/Xaw/AsciiSink.h PixEdit.o: /usr/X11R6/include/X11/Xaw/MultiSrc.h PixEdit.o: /usr/X11R6/include/X11/Xaw/Box.h PixEdit.o: /usr/X11R6/include/X11/Xaw/Paned.h PixEdit.o: /usr/X11R6/include/X11/Xaw/Form.h PixEdit.o: /usr/X11R6/include/X11/Xaw/Command.h PixEdit.o: /usr/X11R6/include/X11/Xaw/Label.h PixEdit.o: /usr/X11R6/include/X11/Xaw/Toggle.h PixEdit.o: /usr/X11R6/include/X11/Xaw/MenuButton.h PixEdit.o: /usr/X11R6/include/X11/Xaw/SimpleMenu.h PixEdit.o: /usr/X11R6/include/X11/Shell.h /usr/X11R6/include/X11/SM/SMlib.h PixEdit.o: /usr/X11R6/include/X11/SM/SM.h /usr/X11R6/include/X11/ICE/ICElib.h PixEdit.o: /usr/X11R6/include/X11/ICE/ICE.h PixEdit.o: /usr/X11R6/include/X11/Xaw/SmeLine.h PixEdit.o: /usr/X11R6/include/X11/Xaw/Sme.h PixEdit.o: /usr/X11R6/include/X11/Xaw/SmeBSB.h PixEdit.o: /usr/X11R6/include/X11/bitmaps/xlogo16 PixEdit.o: /usr/X11R6/include/X11/Xaw/Viewport.h PixEdit.o: /usr/X11R6/include/X11/Xaw/Reports.h Pixmap.h PixEdit.o: /net/koala/include/xpm.h Version.h Dialog.h TextOpt.h TextOpt.c PixEdit.o: PortEdit.c ExtEdit.c Pixmap.o: /usr/X11R6/include/X11/IntrinsicP.h Pixmap.o: /usr/X11R6/include/X11/Intrinsic.h /usr/X11R6/include/X11/Xlib.h Pixmap.o: /usr/include/sys/types.h /usr/include/sys/stdtypes.h Pixmap.o: /usr/include/sys/sysmacros.h /usr/X11R6/include/X11/X.h Pixmap.o: ./X11/Xfuncproto.h ./X11/Xosdefs.h /usr/include/stddef.h Pixmap.o: /usr/X11R6/include/X11/Xutil.h /usr/X11R6/include/X11/Xresource.h Pixmap.o: /usr/include/string.h /usr/X11R6/include/X11/Core.h Pixmap.o: /usr/X11R6/include/X11/Composite.h Pixmap.o: /usr/X11R6/include/X11/Constraint.h /usr/X11R6/include/X11/Object.h Pixmap.o: /usr/X11R6/include/X11/RectObj.h /usr/X11R6/include/X11/CoreP.h Pixmap.o: /usr/X11R6/include/X11/CompositeP.h Pixmap.o: /usr/X11R6/include/X11/ConstrainP.h Pixmap.o: /usr/X11R6/include/X11/ObjectP.h /usr/X11R6/include/X11/RectObjP.h Pixmap.o: /usr/X11R6/include/X11/Xmu/Converters.h Pixmap.o: /usr/X11R6/include/X11/StringDefs.h /usr/X11R6/include/X11/Xatom.h Pixmap.o: /usr/X11R6/include/X11/Xos.h /usr/include/fcntl.h Pixmap.o: /usr/include/sys/fcntlcom.h /usr/include/sys/stat.h Pixmap.o: /usr/include/unistd.h /usr/include/sys/time.h Pixmap.o: /usr/include/sys/time.h /usr/X11R6/include/X11/cursorfont.h Pixmap.o: PixmapP.h Pixmap.h /net/koala/include/xpm.h /usr/include/stdio.h Pixmap.o: /usr/include/math.h /usr/include/floatingpoint.h Pixmap.o: /usr/include/sys/ieeefp.h Requests.h Extensions.c Graphics.c Pixmap.o: ReqMach.c X11/Xfuncs.h CutPaste.c Handlers.c Dialog.o: /usr/X11R6/include/X11/Intrinsic.h /usr/X11R6/include/X11/Xlib.h Dialog.o: /usr/include/sys/types.h /usr/include/sys/stdtypes.h Dialog.o: /usr/include/sys/sysmacros.h /usr/X11R6/include/X11/X.h Dialog.o: ./X11/Xfuncproto.h ./X11/Xosdefs.h /usr/include/stddef.h Dialog.o: /usr/X11R6/include/X11/Xutil.h /usr/X11R6/include/X11/Xresource.h Dialog.o: /usr/include/string.h /usr/X11R6/include/X11/Core.h Dialog.o: /usr/X11R6/include/X11/Composite.h Dialog.o: /usr/X11R6/include/X11/Constraint.h /usr/X11R6/include/X11/Object.h Dialog.o: /usr/X11R6/include/X11/RectObj.h Dialog.o: /usr/X11R6/include/X11/StringDefs.h /usr/X11R6/include/X11/Xos.h Dialog.o: /usr/include/fcntl.h /usr/include/sys/fcntlcom.h Dialog.o: /usr/include/sys/stat.h /usr/include/unistd.h Dialog.o: /usr/include/sys/time.h /usr/include/sys/time.h Dialog.o: /usr/include/stdio.h /usr/X11R6/include/X11/Shell.h Dialog.o: /usr/X11R6/include/X11/SM/SMlib.h /usr/X11R6/include/X11/SM/SM.h Dialog.o: /usr/X11R6/include/X11/ICE/ICElib.h Dialog.o: /usr/X11R6/include/X11/ICE/ICE.h Dialog.o: /usr/X11R6/include/X11/Xaw/Dialog.h Dialog.o: /usr/X11R6/include/X11/Xaw/Form.h Dialog.o: /usr/X11R6/include/X11/Xaw/Command.h Dialog.o: /usr/X11R6/include/X11/Xaw/Label.h Dialog.o: /usr/X11R6/include/X11/Xaw/Simple.h Dialog.o: /usr/X11R6/include/X11/Xmu/Converters.h Dialog.h pixmap-2.6pl4.orig/CutPaste.c100440 243 144 15702 5564722377 14724 0ustar joostusers/* * $Id: CutPaste.c,v 1.2.1.5 1994/05/13 14:09:54 mallet Exp $ * * Copyright (c) 1991-1994 Lionel MALLET * * 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 Lionel MALLET 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 Lionel MALLET shall * not be used in advertising or otherwise to promote the sale, use or * other dealings in this Software without prior written authorization * from Lionel MALLET. * * Author: Lionel Mallet, SIMULOG */ /* * $XConsortium: CutAndPaste.c,v 1.1 90/06/09 20:20:17 dmatic Exp $ * * Copyright 1989 Massachusetts Institute of Technology * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, 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 M.I.T. not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. M.I.T. makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. * 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. * * Author: Davor Matic, MIT X Consortium */ #include #include #include #include #include #include "PixmapP.h" #include #include #define XtStrlen(s) ((s) ? strlen(s) : 0) #define abs(x) (((x) > 0) ? (x) : -(x)) #define min(x, y) (((x) < (y)) ? (x) : (y)) #define max(x, y) (((x) > (y)) ? (x) : (y)) /***************************************************************************** * Cut and Paste * *****************************************************************************/ Boolean ConvertSelection(w, selection, target, type, value, length, format) Widget w; Atom *selection, *target, *type; XtPointer *value; unsigned long *length; int *format; { PixmapWidget PW = (PixmapWidget) w; Pixmap *pixmap; XImage *image; Dimension width, height; switch (*target) { /* case XA_TARGETS: *type = XA_ATOM; *value = (XtPointer) pixmapClassRec.pixmap_class.targets; *length = pixmapClassRec.pixmap_class.num_targets; *format = 32; return True; */ case XA_BITMAP: case XA_PIXMAP: if (!PWQueryMarked(w)) return False; width = PW->pixmap.mark.to_x - PW->pixmap.mark.from_x + 1; height = PW->pixmap.mark.to_y - PW->pixmap.mark.from_y + 1; image = CreatePixmapImage(PW, width, height); CopyImageData(PW->pixmap.image, image, PW->pixmap.mark.from_x, PW->pixmap.mark.from_y, PW->pixmap.mark.to_x, PW->pixmap.mark.to_y, 0, 0); pixmap = (Pixmap *) XtMalloc(sizeof(Pixmap)); *pixmap = GetPixmap(PW, image); DestroyPixmapImage(&image); *type = XA_PIXMAP; *value = (XtPointer) pixmap; *length = 1; *format = 32; return True; case XA_STRING: *type = XA_STRING; *value = "Hello world!\n"; *length = XtStrlen(*value); *format = 8; return True; default: return False; } } void LoseSelection(w, selection) Widget w; Atom *selection; { PixmapWidget PW = (PixmapWidget) w; if (_PWDEBUG) fprintf(stderr, "Lost Selection\n"); PW->pixmap.selection.own = False; PWUnmark(w); } void SelectionDone(w, selection, target) Widget w; Atom *selection, *target; { /* PixmapWidget PW = (PixmapWidget) w; if (*target != XA_TARGETS) XtFree(PW->pixmap.value); */ } #if NeedFunctionPrototypes void PWGrabSelection(Widget w, Time time) #else void PWGrabSelection(w, time) Widget w; Time time; #endif { PixmapWidget PW = (PixmapWidget) w; PW->pixmap.selection.own = XtOwnSelection(w, XA_PRIMARY, time, ConvertSelection, LoseSelection, SelectionDone); if (_PWDEBUG && PW->pixmap.selection.own) fprintf(stderr, "Own the selection\n"); } void SelectionCallback(w, client_data, selection, type, value, length, format) Widget w; XtPointer client_data; Atom *selection, *type; XtPointer value; unsigned long *length; int *format; { PixmapWidget PW = (PixmapWidget) w; Pixmap *pixmap; switch (*type) { case XA_BITMAP: case XA_PIXMAP: DestroyPixmapImage(&PW->pixmap.storage); DestroyMaskImage(&PW->pixmap.mask_storage); pixmap = (Pixmap *) value; PW->pixmap.storage = GetImage(PW, *pixmap); PW->pixmap.mask_storage = CreateMaskImage(PW, (Dimension) PW->pixmap.mask_image->width, (Dimension) PW->pixmap.mask_image->height); XFreePixmap(XtDisplay(w), *pixmap); break; case XA_STRING: if (_PWDEBUG) fprintf(stderr, "Received:%s\n", (char *)value); break; default: XtAppWarning(XtWidgetToApplicationContext(w), " selection request failed. PixmapWidget"); break; } PW->pixmap.selection.limbo = FALSE; } #if NeedFunctionPrototypes void PWRequestSelection(Widget w, Time time, Boolean wait) #else void PWRequestSelection(w, time, wait) Widget w; Time time; Boolean wait; #endif { PixmapWidget PW = (PixmapWidget) w; XtGetSelectionValue(w, XA_PRIMARY, XA_PIXMAP, SelectionCallback, NULL, time); PW->pixmap.selection.limbo = TRUE; if (wait) while (PW->pixmap.selection.limbo) { XEvent event; XtAppNextEvent(XtWidgetToApplicationContext(w), &event); XtDispatchEvent(&event); } } /*****************************************************************************/ pixmap-2.6pl4.orig/Dialog.c100440 243 144 44432 6263264165 14366 0ustar joostusers/* * $Id: Dialog.c,v 1.9 1996/08/30 10:22:11 lmallet Exp $ * * Copyright (c) 1991-1994 Lionel MALLET * * 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 Lionel MALLET 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 Lionel MALLET shall * not be used in advertising or otherwise to promote the sale, use or * other dealings in this Software without prior written authorization * from Lionel MALLET. * * Author: Lionel Mallet, SIMULOG */ /* * $XConsortium: Dialog.c,v 1.3 90/06/09 20:20:23 dmatic Exp $ * * Copyright 1989 Massachusetts Institute of Technology * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, 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 M.I.T. not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. M.I.T. makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. * 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. * * Author: Davor Matic, MIT X Consortium */ #include #include #include #ifndef USE_ATHENA #include #include #include #include #include #else /* USE_ATHENA */ #include #include #include #include #endif /* USE_ATHENA */ #include "Dialog.h" #define min(x, y) (((x) < (y)) ? (x) : (y)) #define max(x, y) (((x) > (y)) ? (x) : (y)) /* extern definitions from PixEdit.c */ extern void unsetKillfromWM(); extern XtAppContext pixmap_context; static int selected; static void SetSelected(w, client_data, call_data) Widget w; XtPointer client_data, call_data; { selected = (int)client_data; } #ifdef USE_ATHENA static void SetOkay(w) Widget w; { SetSelected(w, (XtPointer)(Okay | Yes), NULL); } static XtActionsRec actions_table[] = { {"set-okay", SetOkay}, }; #endif /* USE_ATHENA */ Dialog CreateDialog(top_widget, name, options) Widget top_widget; String name; int options; { int i; Dialog popup; Arg wargs[2]; if (popup = (Dialog) XtMalloc(sizeof(_Dialog))) { #ifdef USE_ATHENA XtAppAddActions(pixmap_context, actions_table, XtNumber(actions_table)); #endif /* USE_ATHENA */ popup->top_widget = top_widget; #ifndef USE_ATHENA popup->dialog_widget = XmCreatePromptDialog(top_widget, name, NULL, 0); popup->shell_widget = XtParent(popup->dialog_widget); XtUnmanageChild(XmSelectionBoxGetChild(popup->dialog_widget, XmDIALOG_HELP_BUTTON)); XtUnmanageChild(XmSelectionBoxGetChild(popup->dialog_widget, XmDIALOG_OK_BUTTON)); XtUnmanageChild(XmSelectionBoxGetChild(popup->dialog_widget, XmDIALOG_APPLY_BUTTON)); XtUnmanageChild(XmSelectionBoxGetChild(popup->dialog_widget, XmDIALOG_CANCEL_BUTTON)); for (i = 0; i < XtNumber(dialog_buttons); i++) if (options & dialog_buttons[i].flag) switch (dialog_buttons[i].flag) { XmString xmstr; case Okay: case Yes: case Abort: xmstr = XmStringCreateLtoR(dialog_buttons[i].name, XmSTRING_DEFAULT_CHARSET); XtSetArg(wargs[0], XmNlabelString, xmstr); XtSetValues(XmSelectionBoxGetChild(popup->dialog_widget, XmDIALOG_OK_BUTTON), wargs, 1); XtManageChild(XmSelectionBoxGetChild(popup->dialog_widget, XmDIALOG_OK_BUTTON)); XtRemoveAllCallbacks(XmSelectionBoxGetChild( popup->dialog_widget, XmDIALOG_OK_BUTTON), XmNactivateCallback); XtAddCallback(XmSelectionBoxGetChild(popup->dialog_widget, XmDIALOG_OK_BUTTON), XmNactivateCallback, SetSelected, (XtPointer)dialog_buttons[i].flag); XmStringFree(xmstr); break; case No: xmstr = XmStringCreateLtoR(dialog_buttons[i].name, XmSTRING_DEFAULT_CHARSET); XtSetArg(wargs[0], XmNlabelString, xmstr); XtSetValues(XmSelectionBoxGetChild(popup->dialog_widget, XmDIALOG_APPLY_BUTTON), wargs, 1); XtManageChild(XmSelectionBoxGetChild(popup->dialog_widget, XmDIALOG_APPLY_BUTTON)); XtRemoveAllCallbacks(XmSelectionBoxGetChild( popup->dialog_widget, XmDIALOG_APPLY_BUTTON), XmNactivateCallback); XtAddCallback(XmSelectionBoxGetChild(popup->dialog_widget, XmDIALOG_APPLY_BUTTON), XmNactivateCallback, SetSelected, (XtPointer)dialog_buttons[i].flag); XmStringFree(xmstr); break; case Cancel: case Retry: xmstr = XmStringCreateLtoR(dialog_buttons[i].name, XmSTRING_DEFAULT_CHARSET); XtSetArg(wargs[0], XmNlabelString, xmstr); XtSetValues(XmSelectionBoxGetChild(popup->dialog_widget, XmDIALOG_CANCEL_BUTTON), wargs, 1); XtManageChild(XmSelectionBoxGetChild(popup->dialog_widget, XmDIALOG_CANCEL_BUTTON)); XtRemoveAllCallbacks(XmSelectionBoxGetChild( popup->dialog_widget, XmDIALOG_CANCEL_BUTTON), XmNactivateCallback); XtAddCallback(XmSelectionBoxGetChild(popup->dialog_widget, XmDIALOG_CANCEL_BUTTON), XmNactivateCallback, SetSelected, (XtPointer)dialog_buttons[i].flag); XmStringFree(xmstr); break; } #else /* USE_ATHENA */ popup->shell_widget = XtCreatePopupShell(name, transientShellWidgetClass, top_widget, NULL, 0); popup->dialog_widget = XtCreateManagedWidget("dialog", dialogWidgetClass, popup->shell_widget, NULL, 0); for (i = 0; i < XtNumber(dialog_buttons); i++) if (options & dialog_buttons[i].flag) XawDialogAddButton(popup->dialog_widget, dialog_buttons[i].name, SetSelected, (XtPointer)dialog_buttons[i].flag); #endif /* USE_ATHENA */ popup->options = options; return popup; } else return NULL; } void PopdownDialog(popup, answer) Dialog popup; String *answer; { if (answer) #ifndef USE_ATHENA *answer = XmTextGetString(XmSelectionBoxGetChild(popup->dialog_widget, XmDIALOG_TEXT)); XtUnmanageChild(popup->dialog_widget); #else /* USE_ATHENA */ *answer = XawDialogGetValueString(popup->dialog_widget); XtPopdown(popup->shell_widget); #endif /* USE_ATHENA */ } int PopupDialog(popup, message, suggestion, answer, grab) Dialog popup; String message, suggestion, *answer; XtGrabKind grab; { Position popup_x, popup_y, top_x, top_y; Dimension popup_width, popup_height, top_width, top_height, border_width; int n; Arg wargs[4]; #ifndef USE_ATHENA XmString xmlabel, xmsuggestion; xmlabel = XmStringCreateLtoR(message, XmSTRING_DEFAULT_CHARSET); n = 0; XtSetArg(wargs[n], XmNselectionLabelString, xmlabel); n++; if (suggestion) { xmsuggestion = XmStringCreateLtoR(suggestion, XmSTRING_DEFAULT_CHARSET); XtSetArg(wargs[n], XmNtextString, xmsuggestion); n++; XtManageChild(XmSelectionBoxGetChild(popup->dialog_widget, XmDIALOG_TEXT)); XtRemoveAllCallbacks(XmSelectionBoxGetChild(popup->dialog_widget, XmDIALOG_TEXT), XmNactivateCallback); XtAddCallback(XmSelectionBoxGetChild(popup->dialog_widget,XmDIALOG_TEXT), XmNactivateCallback, SetSelected, (XtPointer)(Okay | Yes)); } else XtUnmanageChild(XmSelectionBoxGetChild(popup->dialog_widget, XmDIALOG_TEXT)); XtSetValues(popup->dialog_widget, wargs, n); XmStringFree(xmlabel); if (suggestion) XmStringFree(xmsuggestion); #else /* USE_ATHENA */ n = 0; XtSetArg(wargs[n], XtNlabel, message); n++; XtSetArg(wargs[n], XtNvalue, suggestion); n++; XtSetValues(popup->dialog_widget, wargs, n); XtRealizeWidget(popup->shell_widget); #endif /* USE_ATHENA */ n = 0; XtSetArg(wargs[n], XtNx, &top_x); n++; XtSetArg(wargs[n], XtNy, &top_y); n++; XtSetArg(wargs[n], XtNwidth, &top_width); n++; XtSetArg(wargs[n], XtNheight, &top_height); n++; XtGetValues(popup->top_widget, wargs, n); n = 0; XtSetArg(wargs[n], XtNwidth, &popup_width); n++; XtSetArg(wargs[n], XtNheight, &popup_height); n++; XtSetArg(wargs[n], XtNborderWidth, &border_width); n++; XtGetValues(popup->shell_widget, wargs, n); popup_x = max(0, min(top_x + ((Position)top_width - (Position)popup_width) / 2, (Position)DisplayWidth(XtDisplay(popup->shell_widget), DefaultScreen(XtDisplay(popup->shell_widget))) - (Position)popup_width - 2 * (Position)border_width)); popup_y = max(0, min(top_y+((Position)top_height - (Position)popup_height) / 2, (Position)DisplayHeight(XtDisplay(popup->shell_widget), DefaultScreen(XtDisplay(popup->shell_widget))) - (Position)popup_height - 2 * (Position)border_width)); n = 0; XtSetArg(wargs[n], XtNx, popup_x); n++; XtSetArg(wargs[n], XtNy, popup_y); n++; XtSetValues(popup->shell_widget, wargs, n); selected = Empty; #ifndef USE_ATHENA XtManageChild(popup->dialog_widget); #else /* USE_ATHENA */ XtPopup(popup->shell_widget, grab); #endif /* USE_ATHENA */ unsetKillfromWM(popup->shell_widget); #ifndef sparc XtSetKeyboardFocus(popup->top_widget, popup->shell_widget); #endif /* sparc */ while ((selected & popup->options) == Empty) { XEvent event; XtAppNextEvent(pixmap_context, &event); XtDispatchEvent(&event); } PopdownDialog(popup, answer); return (selected & popup->options); } Dialog CreateFDialog(top_widget, name, options) Widget top_widget; String name; int options; { Dialog popup; #ifndef USE_ATHENA int i; Arg wargs[2]; XmString xmstr; #endif /* USE_ATHENA */ if ((popup = (Dialog) XtMalloc(sizeof(_Dialog))) != (Dialog) 0) { popup->top_widget = top_widget; popup->options = options; #ifndef USE_ATHENA xmstr = XmStringCreateLtoR("*.xpm", XmSTRING_DEFAULT_CHARSET); XtSetArg(wargs[0], XmNdirMask, xmstr); popup->dialog_widget = XmCreateFileSelectionDialog(top_widget, name, wargs, 1); XmStringFree(xmstr); popup->shell_widget = XtParent(popup->dialog_widget); XtUnmanageChild(XmFileSelectionBoxGetChild(popup->dialog_widget, XmDIALOG_HELP_BUTTON)); XtUnmanageChild(XmFileSelectionBoxGetChild(popup->dialog_widget, XmDIALOG_OK_BUTTON)); XtUnmanageChild(XmFileSelectionBoxGetChild(popup->dialog_widget, XmDIALOG_CANCEL_BUTTON)); for (i = 0; i < XtNumber(dialog_buttons); i++) if (options & dialog_buttons[i].flag) switch (dialog_buttons[i].flag) { case Okay: case Yes: case Abort: XtSetArg(wargs[0], XmNlabelString, XmStringCreateLtoR(dialog_buttons[i].name, XmSTRING_DEFAULT_CHARSET)); XtSetValues(XmFileSelectionBoxGetChild( popup->dialog_widget, XmDIALOG_OK_BUTTON), wargs, 1); XtManageChild(XmFileSelectionBoxGetChild( popup->dialog_widget, XmDIALOG_OK_BUTTON)); XtRemoveAllCallbacks(XmFileSelectionBoxGetChild( popup->dialog_widget, XmDIALOG_OK_BUTTON), XmNactivateCallback); XtAddCallback(XmFileSelectionBoxGetChild( popup->dialog_widget, XmDIALOG_OK_BUTTON), XmNactivateCallback, SetSelected, (XtPointer)dialog_buttons[i].flag); break; case No: XtSetArg(wargs[0], XmNlabelString, XmStringCreateLtoR(dialog_buttons[i].name, XmSTRING_DEFAULT_CHARSET)); XtSetValues(XmFileSelectionBoxGetChild( popup->dialog_widget, XmDIALOG_HELP_BUTTON), wargs, 1); XtManageChild(XmFileSelectionBoxGetChild( popup->dialog_widget, XmDIALOG_HELP_BUTTON)); XtRemoveAllCallbacks(XmFileSelectionBoxGetChild( popup->dialog_widget, XmDIALOG_HELP_BUTTON), XmNactivateCallback); XtAddCallback(XmFileSelectionBoxGetChild( popup->dialog_widget, XmDIALOG_HELP_BUTTON), XmNactivateCallback, SetSelected, (XtPointer)dialog_buttons[i].flag); break; case Cancel: case Retry: XtSetArg(wargs[0], XmNlabelString, XmStringCreateLtoR(dialog_buttons[i].name, XmSTRING_DEFAULT_CHARSET)); XtSetValues(XmFileSelectionBoxGetChild( popup->dialog_widget, XmDIALOG_CANCEL_BUTTON), wargs, 1); XtManageChild(XmFileSelectionBoxGetChild( popup->dialog_widget, XmDIALOG_CANCEL_BUTTON)); XtRemoveAllCallbacks(XmFileSelectionBoxGetChild( popup->dialog_widget, XmDIALOG_CANCEL_BUTTON), XmNactivateCallback); XtAddCallback(XmFileSelectionBoxGetChild( popup->dialog_widget, XmDIALOG_CANCEL_BUTTON), XmNactivateCallback, SetSelected, (XtPointer)dialog_buttons[i].flag); break; } #endif /* USE_ATHENA */ return popup; } else return NULL; } void PopdownFDialog(popup, answer) Dialog popup; String *answer; { #ifndef USE_ATHENA if (answer) *answer = XmTextGetString(XmFileSelectionBoxGetChild( popup->dialog_widget, XmDIALOG_TEXT)); #endif /* USE_ATHENA */ XtUnmanageChild(popup->dialog_widget); } #ifndef USE_ATHENA int PopupFDialog(popup, message, suggestion, answer, grab) Dialog popup; String message, suggestion, *answer; XtGrabKind grab; { Position popup_x, popup_y, top_x, top_y; Dimension popup_width, popup_height, top_width, top_height, border_width; int n; Arg wargs[4]; n = 0; XtSetArg(wargs[n], XmNselectionLabelString, XmStringCreateLtoR(message, XmSTRING_DEFAULT_CHARSET)); n++; if (suggestion) { XtSetArg(wargs[n], XmNtextString, XmStringCreateLtoR(suggestion, XmSTRING_DEFAULT_CHARSET)); n++; XtManageChild(XmFileSelectionBoxGetChild(popup->dialog_widget, XmDIALOG_TEXT)); XtRemoveAllCallbacks(XmFileSelectionBoxGetChild(popup->dialog_widget, XmDIALOG_TEXT), XmNactivateCallback); XtAddCallback(XmFileSelectionBoxGetChild(popup->dialog_widget, XmDIALOG_TEXT), XmNactivateCallback, SetSelected, (XtPointer)(Okay | Yes)); } else XtUnmanageChild(XmFileSelectionBoxGetChild(popup->dialog_widget, XmDIALOG_TEXT)); XtSetValues(popup->dialog_widget, wargs, n); n = 0; XtSetArg(wargs[n], XtNx, &top_x); n++; XtSetArg(wargs[n], XtNy, &top_y); n++; XtSetArg(wargs[n], XtNwidth, &top_width); n++; XtSetArg(wargs[n], XtNheight, &top_height); n++; XtGetValues(popup->top_widget, wargs, n); n = 0; XtSetArg(wargs[n], XtNwidth, &popup_width); n++; XtSetArg(wargs[n], XtNheight, &popup_height); n++; XtSetArg(wargs[n], XtNborderWidth, &border_width); n++; XtGetValues(popup->shell_widget, wargs, n); popup_x = max(0, min(top_x + ((Position)top_width - (Position)popup_width) / 2, (Position)DisplayWidth(XtDisplay(popup->shell_widget), DefaultScreen(XtDisplay(popup->shell_widget))) - (Position)popup_width - 2 * (Position)border_width)); popup_y = max(0, min(top_y+((Position)top_height - (Position)popup_height) / 2, (Position)DisplayHeight(XtDisplay(popup->shell_widget), DefaultScreen(XtDisplay(popup->shell_widget))) - (Position)popup_height - 2 * (Position)border_width)); n = 0; XtSetArg(wargs[n], XtNx, popup_x); n++; XtSetArg(wargs[n], XtNy, popup_y); n++; XtSetValues(popup->shell_widget, wargs, n); selected = Empty; XtManageChild(popup->dialog_widget); unsetKillfromWM(popup->shell_widget); #ifndef sparc XtSetKeyboardFocus(popup->top_widget, popup->shell_widget); #endif /* sparc */ while ((selected & popup->options) == Empty) { XEvent event; XtAppNextEvent( XtDisplayToApplicationContext(XtDisplay(popup->shell_widget)), &event); XtDispatchEvent(&event); } PopdownFDialog(popup, answer); return (selected & popup->options); } #else /* USE_ATHENA */ int PopupFDialog(popup, message, suggestion, answer, mode) Dialog popup; String message, suggestion, *answer; char *mode; { FILE *FileDes; extern FILE *XsraSelFile(); if ((FileDes = XsraSelFile(popup->top_widget, message, "Okay", "Cancel", message, suggestion, mode, NULL, answer)) != NULL) { fclose(FileDes); selected = Okay; } else selected = Cancel; return (selected & popup->options); } #endif /* USE_ATHENA */ pixmap-2.6pl4.orig/Dialog.h100440 243 144 6415 5564722313 14347 0ustar joostusers/* * $Id: Dialog.h,v 1.5 1994/05/13 14:11:35 mallet Exp $ * * Copyright (c) 1991-1994 Lionel MALLET * * 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 Lionel MALLET 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 Lionel MALLET shall * not be used in advertising or otherwise to promote the sale, use or * other dealings in this Software without prior written authorization * from Lionel MALLET. * * Author: Lionel Mallet, SIMULOG */ /* * $XConsortium: Dialog.h,v 1.2 90/04/25 08:30:56 dmatic Exp $ * * Copyright 1989 Massachusetts Institute of Technology * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, 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 M.I.T. not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. M.I.T. makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. * 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. * * Author: Davor Matic, MIT X Consortium */ #define Yes 16 #define No 32 #define Empty 0 #define Okay 1 #define Abort 2 #define Cancel 4 #define Retry 8 typedef struct { Widget top_widget, shell_widget, dialog_widget; int options; } _Dialog, *Dialog; typedef struct { String name; int flag; } DialogButton; static DialogButton dialog_buttons[] = { {"Yes", Yes}, {"No", No}, {"Okay", Okay}, {"Abort", Abort}, {"Cancel", Cancel}, {"Retry", Retry}, }; extern Dialog CreateDialog(); extern int PopupDialog(); extern void PopdownDialog(); extern Dialog CreateFDialog(); extern int PopupFDialog(); extern void PopdownFDialog(); pixmap-2.6pl4.orig/ExtEdit.c100440 243 144 43156 5564722313 14534 0ustar joostusers/* * $Id: ExtEdit.c,v 1.6 1994/05/13 14:11:44 mallet Exp $ * * Copyright (c) 1991-1994 Lionel MALLET * * 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 Lionel MALLET 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 Lionel MALLET shall * not be used in advertising or otherwise to promote the sale, use or * other dealings in this Software without prior written authorization * from Lionel MALLET. * * Author: Tim Wise - Scientific & Engineering Software (SES), Inc. */ /*--------------------------------------------------------------------------*/ /* ExtEditor.c This file contains routines used for the xpm extension editor of pixmap. */ /*--------------------------------------------------------------------------*/ #define NEWLINE '\n' #define min(x, y) (((x) < (y)) ? (x) : (y)) #define max(x, y) (((x) > (y)) ? (x) : (y)) extern void unsetKillfromWM(); /*--------------------------------------------------------------------------*/ /* X p m E x t e n s i o n T o S t r i n g Convert an xpm extension to a string. Lines of the extension are separated by newlines in the string. */ /*--------------------------------------------------------------------------*/ String XpmExtensionToString( ext ) XpmExtension *ext; { String s = NULL; int i, len; if (!ext) return NULL; if (ext->nlines == 0) return ""; for ( i=0, len = 0; i < ext->nlines; i++) len += strlen( ext->lines[i] ) + 1; /* plus one for newline or NULL */ s = XtCalloc( len, sizeof(char) ); for ( i=0; i < ext->nlines - 1; i++ ) { strcat( s, ext->lines[i] ); strcat( s, "\n" ); } strcat( s, ext->lines[i] ); return s; } /*--------------------------------------------------------------------------*/ /* S t r i n g T o X p m E x t e n s i o n Convert to a string to an xpm extension. newlines in the string cause a new line of the extension to be created. */ /*--------------------------------------------------------------------------*/ XpmExtension *StringToXpmExtension( s ) String s; { XpmExtension *ext; String beg, end; int i, len, n; if (!s) return NULL; ext = (XpmExtension *) XtCalloc(1, sizeof(XpmExtension)); /* count nlines (number of newlines + 1) */ n = 0; beg = s; for( end=index(beg, NEWLINE); end; end=index(beg, NEWLINE) ) { n++; beg = end + 1; } n++; /* assert: n > 0 */ ext->nlines = n; ext->lines = (char **) XtCalloc(n, sizeof(char *)); /* do newline terminated lines */ beg = s; for ( i=0; i < n - 1; i++ ) { end = index(beg, NEWLINE); len = end - beg; ext->lines[i] = (char *) XtCalloc(len + 1, sizeof(char)); strncpy( ext->lines[i], beg, len ); beg = end + 1; } /* last line is null terminated */ ext->lines[i] = (char *) XtCalloc(strlen(beg) + 1, sizeof(char)); strcpy( ext->lines[i], beg ); return ext; } /*--------------------------------------------------------------------------*/ /* P o s i t i o n P o p u p Position a popup in the center of its parent. This is the same code as is used in Dialog.c/PopupDialog(). */ /*--------------------------------------------------------------------------*/ void PositionPopup( popup ) Widget popup; /* shell widget to postion */ { Widget parent = XtParent( popup ); Position parentX, parentY; Dimension parentWidth, parentHeight; Position popupX, popupY; Dimension popupWidth, popupHeight, popupBorder; Dimension dpyWidth, dpyHeight; Display *dpy; int n; Arg args[4]; n = 0; XtSetArg( args[n], XtNx, &parentX ); n++; XtSetArg( args[n], XtNy, &parentY ); n++; XtSetArg( args[n], XtNwidth, &parentWidth ); n++; XtSetArg( args[n], XtNheight, &parentHeight ); n++; XtGetValues( parent , args, n ); n = 0; XtSetArg( args[n], XtNwidth, &popupWidth ); n++; XtSetArg( args[n], XtNheight, &popupHeight ); n++; XtSetArg( args[n], XtNborderWidth, &popupBorder ); n++; XtGetValues( popup, args, n ); dpy = XtDisplay(popup); dpyWidth = (Position) DisplayWidth ( dpy, DefaultScreen(dpy) ); dpyHeight = (Position) DisplayHeight( dpy, DefaultScreen(dpy) ); popupX = max( 0, min( parentX + ((Position)parentWidth - (Position)popupWidth) / 2, dpyWidth - (Position)popupWidth - 2 * (Position)popupBorder )); popupY = max( 0, min( parentY + ((Position)parentHeight - (Position)popupHeight) / 2, dpyHeight - (Position)popupHeight - 2 * (Position)popupBorder )); n = 0; XtSetArg( args[n], XtNx, popupX); n++; XtSetArg( args[n], XtNy, popupY); n++; XtSetValues( popup, args, n ); } /*--------------------------------------------------------------------------*/ /* P o p u p Position a shell relative to parent then pop it up. */ /*--------------------------------------------------------------------------*/ static void Popup( popup, grab ) Widget popup; XtGrabKind grab; { /* position shell relative to parent */ PositionPopup( popup ); #ifndef USE_ATHENA XtManageChild(popup); #else XtPopup( popup, grab ); #endif } /*--------------------------------------------------------------------------*/ /* P o p d o w n A callback to popdown a given shell. */ /*--------------------------------------------------------------------------*/ /* ARGSUSED */ static void Popdown( w, client_data, call_data ) Widget w; /* unused */ XtPointer client_data; /* child of shell to popdown */ XtPointer call_data; /* unused */ { #ifndef USE_ATHENA XtUnmanageChild((Widget) client_data); #else XtPopdown( XtParent((Widget) client_data) ); #endif } /*--------------------------------------------------------------------------*/ /* P o p u p E x t e n s i o n E d i t o r Popup the xpm extension editor form using the given name and text. */ /*--------------------------------------------------------------------------*/ static void PopupExtensionEditor( formW, name, text ) Widget formW; String name; String text; { Widget textW = XtNameToWidget( formW, "*text" ); Widget nameW = XtNameToWidget( formW, "name" ); Arg args[1]; #ifndef USE_ATHENA XmString xmstr; XmTextSetString(textW, text); xmstr = XmStringCreateLtoR(name, XmSTRING_DEFAULT_CHARSET); XtSetArg(args[0], XmNlabelString, xmstr); XtSetValues( nameW, args, 1 ); XmStringFree(xmstr); Popup(formW, XtGrabExclusive); #else XtSetArg( args[0], XtNstring, text ); XtSetValues( textW, args, 1 ); XtSetArg( args[0], XtNlabel, name ); XtSetValues( nameW, args, 1 ); Popup( XtParent(formW), XtGrabExclusive ); #endif } /*--------------------------------------------------------------------------*/ /* D o E d i t E x t e n s i o n Given an xpm extension name, get the extension text from the pixmap widget and popup it up in a form for the user to change. */ /*--------------------------------------------------------------------------*/ void DoEditExtension( name ) String name; { if ( name != NULL && strcmp(name, "") != 0 ) { XpmExtension *ext = PWFindExtension( pixmap_widget, name ); String text; if ( ext == NULL || ext->nlines == 0 ) text = ""; else text = XpmExtensionToString( ext ); PopupExtensionEditor( extensionEditor, name, text ); } } /*--------------------------------------------------------------------------*/ /* A d d T o E x t e n s i o n M e n u Add given name to extension menu. */ void AddToExtensionMenu (name) char *name; { void ExtensionMenuCallback(); #ifndef USE_ATHENA Widget item = XmCreatePushButtonGadget(extensionMenu_widget, name, NULL, 0); XtManageChild(item); XtAddCallback(item, XmNactivateCallback, ExtensionMenuCallback, (XtPointer) NULL ); #else Widget item = XtCreateManagedWidget(name, smeBSBObjectClass, extensionMenu_widget, NULL, 0 ); XtAddCallback(item, XtNcallback, ExtensionMenuCallback, (XtPointer) NULL ); #endif } /*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/ /* D o A d d E x t e n s i o n Prompt user for name of new xpm extension then popup the editor for the user to supply the text for the extension. */ /*--------------------------------------------------------------------------*/ void DoAddExtension() { char *name = NULL; if ( PopupDialog( input_dialog, "Add extension name:", "", &name, XtGrabExclusive ) == Okay ) { if ( name != NULL && strcmp( name, "" ) != 0 ) { /* add to menu, if necessary */ if ( ! XtNameToWidget(extensionMenu_widget, name) ) AddToExtensionMenu (name); PWAddExtension( pixmap_widget, name ); /* add, if necessary */ DoEditExtension( name ); } } } /*--------------------------------------------------------------------------*/ /* F i x E x t e n s i o n M e n u The list of extensions in a pixmap widget has been changed. Update the extension menu by destroying the old menu and recreating it from scratch. */ /*--------------------------------------------------------------------------*/ void FixExtensionMenu (w) Widget w; { void ExtensionMenuCallback(); char **PWGetExtensionNames(); char **names; char **name; Widget *children; Cardinal num_children, i; Arg arglist[2]; #ifndef USE_ATHENA XtSetArg(arglist[0], XmNchildren, &children); XtSetArg(arglist[1], XmNnumChildren, &num_children); #else XtSetArg(arglist[0], XtNchildren, &children); XtSetArg(arglist[1], XtNnumChildren, &num_children); #endif XtGetValues(extensionMenu_widget, arglist, 2); /* destroy all children */ for (i = 0; i < num_children; i++) XtDestroyWidget(*(children + i)); /* build again base extension menu */ MakeMenuPanel(extensionMenu_widget, extension_menu, XtNumber(extension_menu), ExtensionMenuCallback); names = PWGetExtensionNames (w); if (names) { for (name = names; name && *name; name++) { AddToExtensionMenu (*name); XtFree (*name); } if (names) XtFree ((char *)names); } } /*--------------------------------------------------------------------------*/ /* D o R e m o v e E x t e n s i o n Callback for extension editor form Remove button. Get the name of the extension from the form then remove the extension from the pixmap widget and from the menu of extension names. */ /*--------------------------------------------------------------------------*/ void DoRemoveExtension( w, client_data, call_data ) Widget w; /* unused */ XtPointer client_data; /* extension editor form */ XtPointer call_data; /* unused */ { Widget formW = (Widget) client_data; Widget nameW = XtNameToWidget( formW, "name" ); String name = NULL; Popdown( NULL, (XtPointer) formW, NULL ); /* get name of extension */ #ifndef USE_ATHENA { XmString name_xms; XtVaGetValues(nameW, XmNlabelString, &name_xms, NULL); XmStringGetLtoR(name_xms, XmSTRING_DEFAULT_CHARSET, &name); } #else XtVaGetValues( nameW, XtNlabel, &name, NULL ); #endif PWRemoveExtension( pixmap_widget, name ); /* remove name from menu */ { Widget item = XtNameToWidget(extensionMenu_widget, name); XtDestroyWidget( item ); } } /*--------------------------------------------------------------------------*/ /* D o S a v e E x t e n s i o n Callback for the Okay button of the extension editor form. Save the text of the extension with the pixmap widget. */ /*--------------------------------------------------------------------------*/ void DoSaveExtension( w, client_data, call_data ) Widget w; /* unused */ XtPointer client_data; /* extension editor form */ XtPointer call_data; /* unused */ { Widget formW = (Widget) client_data; Widget nameW = XtNameToWidget( formW, "name" ); Widget textW = XtNameToWidget( formW, "*text" ); String name = NULL; String text = NULL; Popdown( NULL, (XtPointer) formW, NULL ); #ifndef USE_ATHENA { XmString name_xms; XtVaGetValues(nameW, XmNlabelString, &name_xms, NULL); XmStringGetLtoR(name_xms, XmSTRING_DEFAULT_CHARSET, &name); text = (String) XmTextGetString(textW); } #else XtVaGetValues( textW, XtNstring, &text, NULL ); XtVaGetValues( nameW, XtNlabel, &name, NULL ); #endif /* if ( strcmp(text, "") == 0 ) { PWRemoveExtension( pixmap_widget, name ); } else */ { XpmExtension *ext = StringToXpmExtension( text ); ext->name = XtNewString( name ); PWAddExtension( pixmap_widget, name ); /* add if necessary */ PWUpdateExtension( pixmap_widget, ext ); } } /*--------------------------------------------------------------------------*/ /* D o S h o w C u r r e n t E x t e n s i o n s Print names of xpm extensions in pixmap widget. */ /*--------------------------------------------------------------------------*/ void DoShowCurrentExtensions() { char **extension_names; char **name; extension_names = PWGetExtensionNames( pixmap_widget ); if ( extension_names != NULL ) { fprintf( stderr, "Extension names:\n" ); for ( name = extension_names; *name != NULL; name++ ) fprintf( stderr, "\t%s\n", *name ); } } /*--------------------------------------------------------------------------*/ /* C r e a t e E x t e n s i o n E d i t o r The xpm extension editor is a form with a label for the extension name, and a text box for the extension text. Buttons: - ok : save text. - cancel : ignore any changes made to text. - remove : delete extension from pixmap widget and menu. */ /*--------------------------------------------------------------------------*/ static Widget CreateExtensionEditor( topWidget, editorName ) Widget topWidget; String editorName; { Widget popup, form, name, text, ok, cancel, remove; #ifndef USE_ATHENA popup = XmCreateFormDialog(top_widget, editorName, NULL, 0); form = popup; name = XmCreateLabelGadget(form, "name", NULL, 0); XtManageChild(name); text = (Widget) XmCreateScrolledText(form, "text", NULL, 0); XtManageChild(text); ok = XmCreatePushButtonGadget(form, "ok", NULL, 0); XtManageChild(ok); XtAddCallback(ok, XmNactivateCallback, DoSaveExtension, (XtPointer)form); cancel = XmCreatePushButtonGadget(form, "cancel", NULL, 0); XtManageChild(cancel); XtAddCallback(cancel, XmNactivateCallback, Popdown, (XtPointer)form); remove = XmCreatePushButtonGadget(form, "remove", NULL, 0); XtManageChild(remove); XtAddCallback(remove, XmNactivateCallback, DoRemoveExtension, (XtPointer)form); #else popup = XtCreatePopupShell( "extEditorShell", transientShellWidgetClass, top_widget, NULL, 0 ); form = XtCreateManagedWidget( editorName, formWidgetClass, popup, NULL, 0 ); name = XtCreateManagedWidget( "name", labelWidgetClass, form, NULL, 0 ); text = XtCreateManagedWidget( "text", asciiTextWidgetClass, form, NULL, 0 ); ok = XtCreateManagedWidget( "ok", commandWidgetClass, form, NULL, 0); XtAddCallback( ok, XtNcallback, DoSaveExtension, (XtPointer) form ); cancel = XtCreateManagedWidget( "cancel", commandWidgetClass, form, NULL, 0); XtAddCallback( cancel, XtNcallback, Popdown, (XtPointer) form ); remove = XtCreateManagedWidget( "remove", commandWidgetClass, form, NULL, 0); XtAddCallback( remove, XtNcallback, DoRemoveExtension, (XtPointer) form ); #endif return form; } /*--------------------------------------------------------------------------*/ /* E x t e n s i o n M e n u C a l l b a c k Callback for items on the xpm extension menu. Check for adding new item to menu, otherwise invoke the extension editor for the chosen extension name. */ /*--------------------------------------------------------------------------*/ void ExtensionMenuCallback(w, client_data, call_data) Widget w; XtPointer client_data, call_data; { int *id = (int *)client_data; if (id && *id == AddExtension) DoAddExtension(); /* add then edit */ else DoEditExtension( XtName(w) ); } pixmap-2.6pl4.orig/Extensions.c100440 243 144 24625 5564722314 15326 0ustar joostusers/* * $Id: Extensions.c,v 1.4 1994/05/13 14:12:07 mallet Exp $ * * Copyright (c) 1991-1994 Lionel MALLET * * 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 Lionel MALLET 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 Lionel MALLET shall * not be used in advertising or otherwise to promote the sale, use or * other dealings in this Software without prior written authorization * from Lionel MALLET. * * Author: Tim Wise - Scientific & Engineering Software (SES), Inc. */ #define UNKNOWN -1 /*****************************************************************************/ /* Extension List Routines Routines to deal with array of XpmExtensions. */ /*****************************************************************************/ /*--------------------------------------------------------------------------*/ /* C o p y E x t e n s i o n Copy an xpm extension. */ /*--------------------------------------------------------------------------*/ void CopyExtension( dst, src ) XpmExtension *dst; XpmExtension *src; { int i; if ( dst == NULL ) return; dst->name = XtNewString( src->name ); dst->nlines = src->nlines; dst->lines = (char **) XtCalloc( src->nlines, sizeof(char**) ); for ( i=0; i < src->nlines; i++ ) dst->lines[i] = XtNewString( src->lines[i] ); } /*--------------------------------------------------------------------------*/ /* F r e e E x t e n s i o n Free the name string and the lines of an XpmExtension but don't free the XpmExtension struct itself. */ /*--------------------------------------------------------------------------*/ void FreeExtension( extension ) XpmExtension *extension; { int i; if ( extension == NULL ) return; XtFree( extension->name ); for ( i=0; i < extension->nlines; i++ ) XtFree( extension->lines[i] ); XtFree((char *)extension->lines); } /*--------------------------------------------------------------------------*/ /* F i n d E x t e n s i o n Find an extension given its name. If found, return index of extension; otherwise return UNKNOWN. */ /*--------------------------------------------------------------------------*/ int FindExtension( exts, n, name ) XpmExtension *exts; /* array of extensions */ int n; /* number of extensions in array */ char *name; /* name of extension to find */ { int i; /* index of found element */ if ( exts == NULL ) return UNKNOWN; for (i=0; i < n; i++, exts++) { if (strcmp(exts->name, name) == 0) { return i; } } return UNKNOWN; } /*--------------------------------------------------------------------------*/ /* A d d E x t e n s i o n Add extension with given name to end of list. Return index of new extension. */ /*--------------------------------------------------------------------------*/ int AddExtension( exts, n, name ) XpmExtension **exts; /* array of extensions */ int *n; /* number of extensions in array */ char *name; /* name of new extension */ { XpmExtension *e; int i; /* index of new element */ if ( exts == NULL ) return UNKNOWN; /* allocate new extension array */ i = *n; (*n)++; /* increment count */ if (*exts != NULL) *exts = (XpmExtension *) XtRealloc((char *)*exts, *n * sizeof(XpmExtension) ); else *exts = (XpmExtension *) XtNew( XpmExtension ); /* put new element at end of array and initialize */ e = *exts + i; e->name = XtNewString( name ); e->nlines = 0; e->lines = NULL; return i; } /*--------------------------------------------------------------------------*/ /* R e m o v e E x t e n s i o n Delete extension i from list. Shift elements above i to left. */ /*--------------------------------------------------------------------------*/ void RemoveExtension( exts, n, i ) XpmExtension **exts; /* array of extensions */ int *n; /* number of extensions in array */ int i; /* index to delete */ { XpmExtension *t, *s, *e, *last; int j; if ( exts == NULL || i == UNKNOWN ) return; /* free extension info */ e = *exts + i; XtFree(e->name); for (j = 0; j < e->nlines; j++) if (e->lines[j] != NULL) XtFree(e->lines[j]); if (e->lines != NULL) XtFree((char *)e->lines); last = *exts + *n; /* last element */ (*n)--; /* if other extensions, shift left those after deleted one */ /* Note: we're doing a structure assignment! */ if (*n > 0) for ( t=(*exts)+i, s=(*exts)+i+1; s < last ; *t++ = *s++ ); else { XtFree((char *)*exts); *exts = NULL; } } /*--------------------------------------------------------------------------*/ /* C o p y E x t e n s i o n s Copy an array of extensions. */ /*--------------------------------------------------------------------------*/ void CopyExtensions( dst_e, dst_n, src_e, src_n ) XpmExtension **dst_e; int *dst_n; XpmExtension *src_e; int src_n; { XpmExtension *te, *se; if ( dst_e == NULL ) return; *dst_e = NULL; *dst_n = 0; if (src_e != NULL && src_n > 0) { *dst_n = src_n; *dst_e = (XpmExtension *) XtCalloc( src_n, sizeof(XpmExtension) ); for ( te = *dst_e, se = src_e; se < src_e + src_n; te++, se++ ) CopyExtension( te, se ); } } /*--------------------------------------------------------------------------*/ /* P r i n t E x t e n s i o n s */ /*--------------------------------------------------------------------------*/ void PrintExtensions( exts, n ) XpmExtension *exts; int n; { int i, j; if ( exts != NULL ) { for (i = 0; i < n; i++) { fprintf(stderr, "Xpm extension : %s\n", exts[i].name); for (j = 0; j < exts[i].nlines; j++) { fprintf( stderr, "\t\t%s\n", exts[i].lines[j] ); } } } } /*****************************************************************************/ /* Interface to PW extensions */ /*****************************************************************************/ /*--------------------------------------------------------------------------*/ /* P W G e t E x t e n s i o n N a m e s Return an array of extension names. The list is terminated with a null name; */ /*--------------------------------------------------------------------------*/ char **PWGetExtensionNames( w ) Widget w; { PixmapWidget PW = (PixmapWidget) w; int i; char **names = NULL; names = (char **) XtCalloc( PW->pixmap.nextensions + 1, sizeof(char *) ); names[ PW->pixmap.nextensions ] = NULL; for ( i = 0; i < PW->pixmap.nextensions ; i++ ) names[i] = XtNewString( PW->pixmap.extensions[i].name ); return names; } /*--------------------------------------------------------------------------*/ /* P W F i n d E x t e n s i o n */ /*--------------------------------------------------------------------------*/ XpmExtension *PWFindExtension( w, name ) Widget w; String name; { PixmapWidget PW = (PixmapWidget) w; int i; XpmExtension *extension = NULL; if ( (i=FindExtension(PW->pixmap.extensions, PW->pixmap.nextensions, name)) != UNKNOWN ) { extension = XtNew( XpmExtension ); CopyExtension( extension, PW->pixmap.extensions + i ); } return extension; } /*--------------------------------------------------------------------------*/ /* P W A d d E x t e n s i o n Add an extension if it doesn't already exist. */ /*--------------------------------------------------------------------------*/ void PWAddExtension( w, name ) Widget w; String name; { PixmapWidget PW = (PixmapWidget) w; if ( FindExtension(PW->pixmap.extensions, PW->pixmap.nextensions, name) == UNKNOWN ) { AddExtension( &(PW->pixmap.extensions), &(PW->pixmap.nextensions), name ); } } /*--------------------------------------------------------------------------*/ /* P W R e m o v e E x t e n s i o n */ /*--------------------------------------------------------------------------*/ void PWRemoveExtension( w, name ) Widget w; String name; { PixmapWidget PW = (PixmapWidget) w; int i; if ( (i=FindExtension(PW->pixmap.extensions, PW->pixmap.nextensions, name)) != UNKNOWN ) { RemoveExtension(&(PW->pixmap.extensions), &(PW->pixmap.nextensions), i); } } /*--------------------------------------------------------------------------*/ /* P W U p d a t e E x t e n s i o n */ /*--------------------------------------------------------------------------*/ void PWUpdateExtension( w, new_extension ) Widget w; XpmExtension *new_extension; { PixmapWidget PW = (PixmapWidget) w; int i; if ( (i=FindExtension(PW->pixmap.extensions, PW->pixmap.nextensions, new_extension->name)) != UNKNOWN ){ if ( new_extension->nlines > 0 ) { FreeExtension( PW->pixmap.extensions + i ); CopyExtension( PW->pixmap.extensions + i, new_extension ); } else { RemoveExtension( &(PW->pixmap.extensions), &(PW->pixmap.nextensions), i ); } } } pixmap-2.6pl4.orig/Graphics.c100440 243 144 215376 5567054102 14750 0ustar joostusers/* * Last edited: Dec 19 10:46 1991 (mallet) */ /* * $Id: Graphics.c,v 1.8.2.1 1994/01/25 15:53:26 mallet Exp $ * * Copyright 1991 Lionel Mallet * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appears in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Lionel MALLET not be used in * advertising or publicity pertaining to distribution of the software * without specific, written prior permission. Lionel MALLET makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * Lionel MALLET DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS, IN NO EVENT SHALL Lionel MALLET 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 software is opened and free. Furthermore, everybody is kindly * invited to participate to improve it for the benefit of all. * Improvements can be new features, bugs fixes and porting issues * resolution. * * Author: Lionel Mallet, SIMULOG */ /* * $XConsortium: Graphics.c,v 1.1 90/06/09 20:20:29 dmatic Exp $ * * Copyright 1989 Massachusetts Institute of Technology * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, 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 M.I.T. not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. M.I.T. makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. * 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. * * Author: Davor Matic, MIT X Consortium */ #include #include #include #include #include #include #include "PixmapP.h" #include #include #define XtStrlen(s) ((s) ? strlen(s) : 0) #define abs(x) (((x) > 0) ? (x) : -(x)) #define min(x, y) (((x) < (y)) ? (x) : (y)) #define max(x, y) (((x) > (y)) ? (x) : (y)) #define roundint(x) floor((x) + 0.5) /************************************************************************** * * Utility functions * **************************************************************************/ typedef enum { Lazy, NotLazy} DrawingMode; #define WithinMark(PW, xi, yi) \ ((xi <= max(PW->pixmap.mark.from_x, PW->pixmap.mark.to_x)) &&\ (xi >= min(PW->pixmap.mark.from_x, PW->pixmap.mark.to_x)) &&\ (yi <= max(PW->pixmap.mark.from_y, PW->pixmap.mark.to_y)) &&\ (yi >= min(PW->pixmap.mark.from_y, PW->pixmap.mark.to_y))) #define HotInMark(PW) WithinMark(PW, PW->pixmap.hot.x, PW->pixmap.hot.y) #define IsHotSpot(PW, xi, yi) \ ((xi== PW->pixmap.hot.x) && (yi == PW->pixmap.hot.y)) Pixel GetPxlFromImageAndMask(image, mask_image, x, y) XImage *image, *mask_image; Position x, y; { Pixel pixel; pixel = XGetPixel(image, x, y); if (XGetPixel(mask_image, x, y) == 0) return TRANSPARENT(dpy, screen); else return pixel; } Pixel GetPxl(pw, x, y) PixmapWidget pw; Position x, y; { Pixel pixel; pixel = XGetPixel(pw->pixmap.image, x, y); if ((pixel == pw->pixmap.transparent_pixel) && (XGetPixel(pw->pixmap.mask_image, x, y) == 0)) return TRANSPARENT(dpy, screen); else return pixel; } void SetPxl(pw, x, y, color) PixmapWidget pw; Position x, y; Pixel color; { if (color == TRANSPARENT(dpy, screen)) { XPutPixel(pw->pixmap.image, x, y, pw->pixmap.transparent_pixel); XPutPixel(pw->pixmap.mask_image, x, y, 0); } else { XPutPixel(pw->pixmap.image, x, y, color); XPutPixel(pw->pixmap.mask_image, x, y, 1); } } #define ClearPxl(pw, x, y, white)\ SetPxl(pw, x, y, white) #if NeedFunctionPrototypes Pixel PWGetPxl(Widget w, Position x, Position y) #else Pixel PWGetPxl(w, x, y) Widget w; Position x, y; #endif { PixmapWidget PW = (PixmapWidget) w; if (QueryInPixmap(PW, x, y)) return GetPxl(PW, x, y); else return NotSet; } XPoint *HotSpotShape(PW, x ,y) PixmapWidget PW; Position x, y; { static XPoint points[5]; points[0].x = InWindowX(PW, x); points[0].y = InWindowY(PW, y + 1.0/2); points[1].x = InWindowX(PW, x + 1.0/2); points[1].y = InWindowY(PW, y + 1); points[2].x = InWindowX(PW, x + 1); points[2].y = InWindowY(PW, y + 1.0/2); points[3].x = InWindowX(PW, x + 1.0/2); points[3].y = InWindowY(PW, y); points[4].x = InWindowX(PW, x); points[4].y = InWindowY(PW, y + 1.0/2); return points; } #define DrawHotSpot(PW, x, y)\ XFillPolygon(XtDisplay(PW), XtWindow(PW), PW->pixmap.framing_gc,\ HotSpotShape(PW, x, y), 5, Convex, CoordModeOrigin) #define HighlightHotSpot(PW, x, y)\ XFillPolygon(XtDisplay(PW), XtWindow(PW), PW->pixmap.highlighting_gc,\ HotSpotShape(PW, x, y), 5, Convex, CoordModeOrigin) void HighlightSquare(PW, x, y) PixmapWidget PW; Position x, y; { XFillRectangle(dpy, XtWindow(PW), PW->pixmap.highlighting_gc, InWindowX(PW, x), InWindowY(PW, y), PW->pixmap.squareW, PW->pixmap.squareH); } void RedrawAxesInSquare(); void ClearSquare(PW, x, y) PixmapWidget PW; Position x, y; { XSetForeground(dpy, PW->pixmap.drawing_gc, PW->pixmap.clear_pixel); XFillRectangle(dpy, XtWindow(PW), PW->pixmap.drawing_gc, InWindowX(PW, x), InWindowY(PW, y), PW->pixmap.squareW, PW->pixmap.squareH); } void DrawSquare(PW, x, y, color) PixmapWidget PW; Position x, y; Pixel color; { if (color == PW->pixmap.clear_pixel) ClearSquare(PW, x, y); else if (color == TRANSPARENT(dpy, screen)) { XFillRectangle(dpy, XtWindow(PW), PW->pixmap.transparent_gc, InWindowX(PW, x), InWindowY(PW, y), PW->pixmap.squareW, PW->pixmap.squareH); } else { XSetForeground(dpy, PW->pixmap.drawing_gc, color); XFillRectangle(dpy, XtWindow(PW), PW->pixmap.drawing_gc, InWindowX(PW, x), InWindowY(PW, y), PW->pixmap.squareW, PW->pixmap.squareH); XSetForeground(dpy,PW->pixmap.drawing_gc, PW->pixmap.foreground_pixel); } } #define DrawPoint(PW, x, y, color, mode)\ if ((mode == NotLazy) || (GetPxl(PW, x, y) != color)) {\ DrawSquare(PW, x, y, color); \ SetPxl(PW, x, y, color); \ /* now put back the status of the pixel */ \ PWRedrawGrid((Widget )PW, x, y, x, y); \ RedrawAxesInSquare(PW, x, y); \ if (WithinMark(PW, x, y)) HighlightSquare(PW, x, y); \ if (IsHotSpot(PW, x, y)) PWRedrawHotSpot((Widget)PW);\ if (PW->pixmap.drawPointCallback) \ PW->pixmap.drawPointCallback( (Widget) PW, x, y, Highlight );\ } #define ClearPoint(PW, x, y, mode) \ if ((mode == NotLazy) || \ (GetPxl(PW, x, y) != PW->pixmap.clear_pixel)) {\ ClearSquare(PW, x, y); \ ClearPxl(PW, x, y, PW->pixmap.clear_pixel); \ /* now put back the status of the pixel */ \ PWRedrawGrid((Widget)PW, x, y, x, y); \ RedrawAxesInSquare(PW, x, y); \ if (WithinMark(PW, x, y)) HighlightSquare(PW, x, y); \ if (IsHotSpot(PW, x, y)) PWRedrawHotSpot((Widget)PW);\ if (PW->pixmap.drawPointCallback) \ PW->pixmap.drawPointCallback( (Widget) PW, x, y, Highlight );\ } #define QueryFlood(PW, x, y, value)\ (QueryInPixmap(PW, x, y)\ && (GetPxl(PW, x, y) == value)) #define Flood(PW, x, y, value)\ DrawPoint(PW, x, y, value, NotLazy) void FloodLoop(PW, x, y, value, toflood) PixmapWidget PW; Position x, y; Pixel value, toflood; { Position save_x, save_y, x_left, x_right; if (value == toflood) return; /* nothing to flood in this case */ if (QueryFlood(PW, x, y, toflood)) Flood(PW, x, y, value); save_x = x; save_y = y; x++; while (QueryFlood(PW, x, y, toflood)) { Flood(PW, x, y, value); x++; } x_right = --x; x = save_x; x--; while (QueryFlood(PW, x, y, toflood)) { Flood(PW, x, y, value); x--; } x_left = ++x; x = x_left; y = save_y; y++; while (x <= x_right) { Boolean flag = False; Position x_enter; while (QueryFlood(PW, x, y, toflood) && (x <= x_right)) { flag = True; x++; } if (flag) { if ((x == x_right) && QueryFlood(PW, x, y, toflood)) FloodLoop(PW, x, y, value, toflood); else FloodLoop(PW, x - 1, y, value, toflood); } x_enter = x; while (!QueryFlood(PW, x, y, toflood) && (x < x_right)) x++; if (x == x_enter) x++; } x = x_left; y = save_y; y--; while (x <= x_right) { Boolean flag = False; Position x_enter; while (QueryFlood(PW, x, y, toflood) && (x <= x_right)) { flag = True; x++; } if (flag) { if ((x == x_right) && QueryFlood(PW, x, y, toflood)) FloodLoop(PW, x, y, value, toflood); else FloodLoop(PW, x - 1, y, value, toflood); } x_enter = x; while (!QueryFlood(PW, x, y, toflood) && (x < x_right)) x++; if (x == x_enter) x++; } } void CopyImageData(source, destination, from_x, from_y, to_x, to_y, at_x, at_y) XImage *source, *destination; Position from_x, from_y, to_x, to_y, at_x, at_y; { register Position x, y, delta_x, delta_y; delta_x = to_x - from_x + 1; delta_y = to_y - from_y + 1; for (x = 0; x < delta_x; x++) for (y = 0; y < delta_y; y++) XPutPixel(destination, at_x + x, at_y + y, XGetPixel(source, from_x + x, from_y + y)); } void TransferImageData(source, destination) XImage *source, *destination; { register Position x, y; register Pixel color; for (x = 0; x < min(source->width, destination->width); x++) for (y = 0; y < min(source->height, destination->height); y++) if ((color = XGetPixel(source, x, y)) != XGetPixel(destination, x, y)) XPutPixel(destination, x, y, color); } void DrawImageData(PW, image, mask_image, at_x, at_y, value, mode) PixmapWidget PW; XImage *image, *mask_image; Position at_x, at_y; int value; DrawingMode mode; { Position x, y; Pixel A, B; register Pixel Cl, Fg, val; Cl = PW->pixmap.clear_pixel; Fg = PW->pixmap.foreground_pixel; for (x = 0; x < image->width; x++) for (y = 0; y < image->height; y++) { if (!QueryInPixmap(PW, at_x + x, at_y + y)) break; A = GetPxlFromImageAndMask(image, mask_image, x, y); B = GetPxl(PW, at_x + x, at_y + y); switch (value) { case Clear: if ((mode == NotLazy) || (B != Cl)) val = Cl; else val = NotSet; break; case Set: if ((mode == NotLazy) || (B != A)) val = A; else val = NotSet; break; case Invert: if (((mode == NotLazy) && (A != Cl)) || ((A != Cl) && (B != Cl))) val = Cl; else if (((mode == NotLazy) && (A == Cl)) || ((A == Cl) && (B != Fg))) val = Fg; else val = NotSet; break; case Highlight: if (A != B) PWDrawPoint((Widget)PW, at_x + x, at_y + y, A); break; } if ((val != NotSet) && (val != Highlight)) { DrawPoint(PW, at_x + x, at_y + y, val, mode); } else if (value == Highlight) HighlightSquare(PW, x, y); } } #define PRECISION 0.00001 #define OR(p1, p2) (p1 ? p1 : (p2 ? p2 : NULL)) /* this function checks the intersection of two lines * returns intersection if it exists, first point if two lines are equal, * null otherwise. Space in which result in returned should be free by the * caller */ XPoint *intersect(P1, Q1, P2, Q2) XPoint P1, Q1, P2, Q2; { XPoint *result; int vert1 = 0, vert2 = 0, horiz1 = 0, horiz2 = 0; double alpha1, beta1, alpha2, beta2; double x, y; if (P1.x != Q1.x) /* not vertical */ { alpha1 = (Q1.y*1. - P1.y*1.) / (Q1.x*1. - P1.x*1.); beta1 = P1.y*1. - alpha1 * P1.x*1.; if (Q1.y == P1.y) horiz1 = 1; } else /* vertical */ { vert1 = 1; /* check line1 not point */ if (P1.y == Q1.y) return(NULL); alpha1 = 0.; beta1 = P1.x; } if (P2.x != Q2.x) /* not vertical */ { if (P2.y == Q2.y) horiz2 = 1; if (!vert1) { alpha2 = (Q2.y*1. - P2.y*1.) / (Q2.x*1. - P2.x*1.); beta2 = P2.y*1. - alpha2 * P2.x*1.; } else if (!horiz2) /* and vert1 implicitly */ { alpha2 = (Q2.x*1. - P2.x*1.) / (Q2.y*1. - P2.y*1.); beta2 = P2.x*1. - alpha2 * P2.y*1.; } else /* vert1 and horiz2 */ { alpha2 = 0.; beta2 = P2.y; } } else /* vertical */ { vert2 = 1; /* check line2 not point */ if (P2.y == Q2.y) return(NULL); alpha2 = 0.; beta2 = P2.x; if ((!vert1) && (!horiz1)) { alpha1 = (Q1.x*1. - P1.x*1.) / (Q1.y*1. - P1.y*1.); beta1 = P1.x*1. - alpha1 * P1.y*1.; } } #ifdef DEBUG printf("D1 vert %d horiz %d, D2 vert %d horiz %d\n", vert1, horiz1, vert2, horiz2); printf("alpha1 %lf beta1 %lf, alpha2 %lf beta2 %lf\n", alpha1, beta1, alpha2, beta2); #endif /* DEBUG */ if ((vert1 && vert2) || (horiz1 && horiz2)) { if (!fabs(beta1 - beta2) > PRECISION) return(NULL); x = P1.x; y = P1.y; } else if ((vert1 && horiz2) || (vert2 && horiz1)) { if (vert1) x = P1.x , y = P2.y; else x = P2.x , y = P1.y; } else if ((vert1 && !vert2 && !horiz2) || (vert2 && !vert1 && !horiz1)) { if (vert1) x = P1.x , y = (x - beta2) / alpha2; else x = P2.x , y = (x - beta1) / alpha1; } else if ((horiz1 && !vert2 && !horiz2) || (horiz2 && !vert1 && !horiz1)) { if (horiz1) y = P1.y , x = (y - beta2) / alpha2; else y = P2.y , x = (y - beta1) / alpha1; } else if (!vert1 && !horiz1 && !vert2 && !horiz2) { if (fabs(alpha1 - alpha2) > PRECISION) /* alpha1 != alpha2 */ { x = (beta2 - beta1) / (alpha1 - alpha2); y = alpha1 * x + beta1; } else if (fabs(beta1 - beta2) > PRECISION) /* alpha1 = alpha2 && beta1 != beta2 */ return(NULL); else /* alpha1 = alpha2 && beta1 = beta2 */ x = P1.x , y = P1.y; } /* now check if solution in between P1, Q1 and P2, Q2, else return NULL */ if (((Position)roundint(x) < min(P1.x, Q1.x)) || ((Position)roundint(x) > max(P1.x, Q1.x)) || ((Position)roundint(y) < min(P1.y, Q1.y)) || ((Position)roundint(y) > max(P1.y, Q1.y)) || ((Position)roundint(x) < min(P2.x, Q2.x)) || ((Position)roundint(x) > max(P2.x, Q2.x)) || ((Position)roundint(y) < min(P2.y, Q2.y)) || ((Position)roundint(y) > max(P2.y, Q2.y))) return(NULL); else { result = (XPoint *) XtMalloc(sizeof(XPoint)); result->x = (Position) roundint(x); result->y = (Position) roundint(y); return(result); } } /* the algorithm is : find A1, A2, B1, B2 intersections of the axe to draw * and the borders of the square (t, l, b, r) and then draw line between * (A1 or A2) and (B1 or B2) */ void RedrawAxesInSquare(PW, x, y) PixmapWidget PW; Position x, y; { int w = PW->pixmap.width, h =PW->pixmap.height; XPoint P1, Q1, P2, Q2, *A1, *A2, *B1, *B2, *from, *to; if (PWQueryAxes((Widget)PW)) { /* first diagonal */ P2.x = InWindowX(PW, 0); P2.y = InWindowY(PW, 0); Q2.x = InWindowX(PW, w); Q2.y = InWindowY(PW, h); /* A1: top intersect diagonal */ P1.x = InWindowX(PW, x); P1.y = InWindowY(PW, y); Q1.x = InWindowX(PW, x+1); Q1.y = P1.y; A1 = intersect(P1, Q1, P2, Q2); /* A2: left intersect diagonal */ P1.x = InWindowX(PW, x); P1.y = InWindowY(PW, y); Q1.x = P1.x; Q1.y = InWindowY(PW, y+1); A2 = intersect(P1, Q1, P2, Q2); /* B1: bottom intersect diagonal */ P1.x = InWindowX(PW, x); P1.y = InWindowY(PW, y+1); Q1.x = InWindowX(PW, x+1); Q1.y = P1.y; B1 = intersect(P1, Q1, P2, Q2); /* B2: right intersect diagonal */ P1.x = InWindowX(PW, x+1); P1.y = InWindowY(PW, y); Q1.x = P1.x; Q1.y = InWindowY(PW, y+1); B2 = intersect(P1, Q1, P2, Q2); /* line to draw from=OR(a1, a2) to=OR(b1, b2) */ from = OR(A1, A2); to = OR(B1, B2); if (from && to) XDrawLine(dpy, XtWindow(PW), PW->pixmap.framing_gc, from->x, from->y, to->x, to->y); XtFree((char *)A1); XtFree((char *)A2); XtFree((char *)B1); XtFree((char *)B2); /* second diagonal */ P2.x = InWindowX(PW, 0); P2.y = InWindowY(PW, h); Q2.x = InWindowX(PW, w); Q2.y = InWindowY(PW, 0); /* A1: top intersect diagonal */ P1.x = InWindowX(PW, x); P1.y = InWindowY(PW, y); Q1.x = InWindowX(PW, x+1); Q1.y = P1.y; A1 = intersect(P1, Q1, P2, Q2); /* A2: right intersect diagonal */ P1.x = InWindowX(PW, x+1); P1.y = InWindowY(PW, y); Q1.x = P1.x; Q1.y = InWindowY(PW, y+1); A2 = intersect(P1, Q1, P2, Q2); /* B1: bottom intersect diagonal */ P1.x = InWindowX(PW, x); P1.y = InWindowY(PW, y+1); Q1.x = InWindowX(PW, x+1); Q1.y = P1.y; B1 = intersect(P1, Q1, P2, Q2); /* B2: left intersect diagonal */ P1.x = InWindowX(PW, x); P1.y = InWindowY(PW, y); Q1.x = P1.x; Q1.y = InWindowY(PW, y+1); B2 = intersect(P1, Q1, P2, Q2); /* line to draw from=OR(a1, a2) to=OR(b1, b2) */ from = OR(A1, A2); to = OR(B1, B2); if (from && to) XDrawLine(dpy, XtWindow(PW), PW->pixmap.framing_gc, from->x, from->y, to->x, to->y); XtFree((char *)A1); XtFree((char *)A2); XtFree((char *)B1); XtFree((char *)B2); /* horizontal */ if (((h % 2) != 0) || (!PWQueryGrid((Widget)PW))) /* height is even or grid is off */ { Position y0; y0 = InWindowY(PW, 0) + roundint((InWindowY(PW, h) - InWindowY(PW, 0)) / 2.); if ((y0 > InWindowY(PW, y)) && (y0 < InWindowY(PW, y+1))) XDrawLine(dpy, XtWindow(PW), PW->pixmap.framing_gc, InWindowX(PW, x), y0, InWindowX(PW, x+1), y0); } /* vertical */ if (((w % 2) != 0) || (!PWQueryGrid((Widget)PW))) /* width is even or grid is off */ { Position x0; x0 = InWindowX(PW, 0) + roundint((InWindowX(PW, w) - InWindowX(PW, 0)) / 2.); if ((x0 > InWindowX(PW, x)) && (x0 < InWindowX(PW, x+1))) XDrawLine(dpy, XtWindow(PW), PW->pixmap.framing_gc, x0, InWindowY(PW, y), x0, InWindowY(PW, y+1)); } } } typedef struct { Position *x, *y; Dimension *width, *height; } Table; XImage *ScalePixmapImage(PW, src, scale_x, scale_y) PixmapWidget PW; XImage *src; double scale_x, scale_y; { XImage *dst; Table table; Position x, y; Dimension width, height, w, h; Pixel pixel; width = max(roundint(scale_x * src->width), 1); height = max(roundint(scale_y * src->height), 1); dst = CreatePixmapImage(PW, width, height); /* * It would be nice to check if width or height < 1.0 and * average the skipped pixels. But, it is slow as it is now. */ if (scale_x == 1.0 && scale_y == 1.0) CopyImageData(src, dst, 0, 0, width-1 , height-1, 0, 0); else { table.x = (Position *) XtMalloc(sizeof(Position) * src->width); table.y = (Position *) XtMalloc(sizeof(Position) * src->height); table.width = (Dimension *) XtMalloc(sizeof(Dimension) * src->width); table.height = (Dimension *) XtMalloc(sizeof(Dimension) * src->height); for (x = 0; x < src->width; x++) { table.x[x] = roundint(scale_x * x); table.width[x] = roundint(scale_x * (x + 1)) - roundint(scale_x * x); } for (y = 0; y < src->height; y++) { table.y[y] = roundint(scale_y * y); table.height[y] = roundint(scale_y * (y + 1)) - roundint(scale_y * y); } for (x = 0; x < src->width; x++) for (y = 0; y < src->height; y++) { pixel = XGetPixel(src, x, y); for (w = 0; w < table.width[x]; w++) for (h = 0; h < table.height[y]; h++) if (pixel != PW->pixmap.clear_pixel) XPutPixel(dst, table.x[x] + w, table.y[y] + h, pixel); } XtFree((char *)table.x); XtFree((char *)table.y); XtFree((char *)table.width); XtFree((char *)table.height); } return (dst); } XImage *ScaleMaskImage(PW, src, scale_x, scale_y) PixmapWidget PW; XImage *src; double scale_x, scale_y; { XImage *dst; Table table; Position x, y; Dimension width, height, w, h; Pixel pixel; width = max(roundint(scale_x * src->width), 1); height = max(roundint(scale_y * src->height), 1); dst = CreateMaskImage(PW, width, height); /* * It would be nice to check if width or height < 1.0 and * average the skipped pixels. But, it is slow as it is now. */ if (scale_x == 1.0 && scale_y == 1.0) CopyImageData(src, dst, 0, 0, width-1 , height-1, 0, 0); else { table.x = (Position *) XtMalloc(sizeof(Position) * src->width); table.y = (Position *) XtMalloc(sizeof(Position) * src->height); table.width = (Dimension *) XtMalloc(sizeof(Dimension) * src->width); table.height = (Dimension *) XtMalloc(sizeof(Dimension) * src->height); for (x = 0; x < src->width; x++) { table.x[x] = roundint(scale_x * x); table.width[x] = roundint(scale_x * (x + 1)) - roundint(scale_x * x); } for (y = 0; y < src->height; y++) { table.y[y] = roundint(scale_y * y); table.height[y] = roundint(scale_y * (y + 1)) - roundint(scale_y * y); } for (x = 0; x < src->width; x++) for (y = 0; y < src->height; y++) { pixel = XGetPixel(src, x, y); for (w = 0; w < table.width[x]; w++) for (h = 0; h < table.height[y]; h++) if (pixel == 0) XPutPixel(dst, table.x[x] + w, table.y[y] + h, pixel); } XtFree((char *)table.x); XtFree((char *)table.y); XtFree((char *)table.width); XtFree((char *)table.height); } return (dst); } /************************************************************************* * * Interface functions * *************************************************************************/ /* high level procedures */ #if NeedFunctionPrototypes GC PWHighlightingGC(Widget w) #else GC PWHighlightingGC(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; return PW->pixmap.highlighting_gc; } #if NeedFunctionPrototypes GC PWFramingGC(Widget w) #else GC PWFramingGC(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; return PW->pixmap.framing_gc; } #if NeedFunctionPrototypes GC PWDrawingGC(Widget w) #else GC PWDrawingGC(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; return PW->pixmap.drawing_gc; } #if NeedFunctionPrototypes Position PWInWindowX(Widget w, float x) #else Position PWInWindowX(w,x) Widget w; float x; #endif { return InWindowX( ((PixmapWidget) w), x ); } #if NeedFunctionPrototypes Position PWInWindowY(Widget w, float y) #else Position PWInWindowY(w,y) Widget w; float y; #endif { return InWindowY( ((PixmapWidget) w), y ); } #if NeedFunctionPrototypes void PWRedrawHotSpot(Widget w) #else void PWRedrawHotSpot(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; if (QuerySet(PW->pixmap.hot.x, PW->pixmap.hot.y)) DrawHotSpot(PW, PW->pixmap.hot.x, PW->pixmap.hot.y); } #if NeedFunctionPrototypes void PWClearHotSpot(Widget w) #else void PWClearHotSpot(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; DrawHotSpot(PW, PW->pixmap.hot.x, PW->pixmap.hot.y); PW->pixmap.hot.x = PW->pixmap.hot.y = NotSet; } #if NeedFunctionPrototypes void PWDrawHotSpot(Widget w, Position x, Position y, int value) #else void PWDrawHotSpot(w, x, y, value) Widget w; Position x, y; int value; #endif { PixmapWidget PW = (PixmapWidget) w; if (QueryInPixmap(PW, x, y)) { if (QuerySet(PW->pixmap.hot.x, PW->pixmap.hot.y) && ((PW->pixmap.hot.x == x) && (PW->pixmap.hot.y == y))) { if ((value == Clear) || (value == Invert)) { PWClearHotSpot(w); } } else if ((value == Set) || (value == Invert)) { PWClearHotSpot(w); DrawHotSpot(PW, x, y); PW->pixmap.hot.x = x; PW->pixmap.hot.y = y; } if (value == Highlight) HighlightHotSpot(PW, x, y); } } #if NeedFunctionPrototypes void PWSetHotSpot(Widget w, Position x, Position y) #else void PWSetHotSpot(w, x, y) Widget w; Position x, y; #endif { if (QuerySet(x, y)) PWDrawHotSpot(w, x, y, Set); else PWClearHotSpot(w); } #if NeedFunctionPrototypes void PWDrawPoint(Widget w, Position x, Position y, int value) #else void PWDrawPoint(w, x, y, value) Widget w; Position x, y; int value; #endif { PixmapWidget PW = (PixmapWidget) w; if (QueryInPixmap(PW, x, y)) { if (value == Highlight) HighlightSquare(PW, x, y); else if ((value == Clear) || ((value == Invert) && (GetPxl(PW, x, y) != PW->pixmap.clear_pixel))) { ClearPoint(PW, x, y, Lazy); } else /* value == Set || (value == Invert && Pxl == clear_pixel) */ { DrawPoint(PW, x, y, PW->pixmap.foreground_pixel, Lazy); } } } #if NeedFunctionPrototypes void PWRedrawSquares(Widget w, Position from_x, Position from_y, Position to_x, Position to_y) #else void PWRedrawSquares(w, from_x, from_y, to_x, to_y) Widget w; Position from_x, from_y, to_x, to_y; #endif { PixmapWidget PW = (PixmapWidget) w; register int x, y; QuerySwap(from_x, to_x); QuerySwap(from_y, to_y); from_x = max(0, from_x); from_y = max(0, from_y); to_x = min(PW->pixmap.image->width - 1, to_x); to_y = min(PW->pixmap.image->height - 1, to_y); for (x = from_x; x <= to_x; x++) for (y = from_y; y <= to_y; y++) DrawSquare(PW, x, y, GetPxl(PW, x, y)); } #if NeedFunctionPrototypes void PWRedrawPoints(Widget w, Position from_x, Position from_y, Position to_x, Position to_y) #else void PWRedrawPoints(w, from_x, from_y, to_x, to_y) Widget w; Position from_x, from_y, to_x, to_y; #endif { PixmapWidget PW = (PixmapWidget) w; register int x, y; QuerySwap(from_x, to_x); QuerySwap(from_y, to_y); from_x = max(0, from_x); from_y = max(0, from_y); to_x = min(PW->pixmap.image->width - 1, to_x); to_y = min(PW->pixmap.image->height - 1, to_y); for (x = from_x; x <= to_x; x++) for (y = from_y; y <= to_y; y++) DrawPoint(PW, x, y, GetPxl(PW, x, y), NotLazy); } #if NeedFunctionPrototypes void PWDrawGrid(Widget w, Position from_x, Position from_y, Position to_x, Position to_y) #else void PWDrawGrid(w, from_x, from_y, to_x, to_y) Widget w; Position from_x, from_y, to_x, to_y; #endif { PixmapWidget PW = (PixmapWidget) w; int i; QuerySwap(from_x, to_x); QuerySwap(from_y, to_y); from_x = max(0, from_x); from_y = max(0, from_y); to_x = min(PW->pixmap.image->width - 1, to_x); to_y = min(PW->pixmap.image->height - 1, to_y); for(i = from_x + (from_x == 0); i <= to_x; i++) XDrawLine(dpy, XtWindow(PW), PW->pixmap.framing_gc, InWindowX(PW, i), InWindowY(PW, from_y), InWindowX(PW, i), InWindowY(PW, to_y + 1)); for(i = from_y + (from_y == 0); i <= to_y; i++) XDrawLine(dpy, XtWindow(PW), PW->pixmap.framing_gc, InWindowX(PW, from_x), InWindowY(PW, i), InWindowX(PW, to_x + 1), InWindowY(PW, i)); } #if NeedFunctionPrototypes void PWRedrawGrid(Widget w, Position from_x, Position from_y, Position to_x, Position to_y) #else void PWRedrawGrid(w, from_x, from_y, to_x, to_y) Widget w; Position from_x, from_y, to_x, to_y; #endif { PixmapWidget PW = (PixmapWidget) w; if (PW->pixmap.grid) PWDrawGrid(w, from_x, from_y, to_x, to_y); } #if NeedFunctionPrototypes void PWDrawLine(Widget w, Position from_x, Position from_y, Position to_x, Position to_y, int value) #else void PWDrawLine(w, from_x, from_y, to_x, to_y, value) Widget w; Position from_x, from_y, to_x, to_y; int value; #endif { Position i; register double x, y; double dx, dy, delta; dx = to_x - from_x; dy = to_y - from_y; x = from_x + 0.5; y = from_y + 0.5; delta = max(abs(dx), abs(dy)); if (delta > 0) { dx /= delta; dy /= delta; for(i = 0; i <= delta; i++) { PWDrawPoint(w, (Position) x, (Position) y, value); x += dx; y += dy; } } else PWDrawPoint(w, from_x, from_y, value); } #if NeedFunctionPrototypes void PWBlindLine(Widget w, Position from_x, Position from_y, Position to_x, Position to_y, int value) #else void PWBlindLine(w, from_x, from_y, to_x, to_y, value) Widget w; Position from_x, from_y, to_x, to_y; int value; #endif { Position i; register double x, y; double dx, dy, delta; dx = to_x - from_x; dy = to_y - from_y; x = from_x + 0.5; y = from_y + 0.5; delta = max(abs(dx), abs(dy)); if (delta > 0) { dx /= delta; dy /= delta; x += dx; y += dy; for(i = 1; i <= delta; i++) { PWDrawPoint(w, (Position) x, (Position) y, value); x += dx; y += dy; } } else PWDrawPoint(w, from_x, from_y, value); } #if NeedFunctionPrototypes void PWDrawRectangle(Widget w, Position from_x, Position from_y, Position to_x, Position to_y, int value) #else void PWDrawRectangle(w, from_x, from_y, to_x, to_y, value) Widget w; Position from_x, from_y, to_x, to_y; int value; #endif { register Position i; Dimension delta, width, height; QuerySwap(from_x, to_x); QuerySwap(from_y, to_y); width = to_x - from_x; height = to_y - from_y; delta = max(width, height); if (!QueryZero(width, height)) { for (i = 0; i < (Position)delta; i++) { if (i < (Position)width) { PWDrawPoint(w, from_x + i, from_y, value); PWDrawPoint(w, to_x - i, to_y, value); } if (i < (Position)height) { PWDrawPoint(w, from_x, to_y - i, value); PWDrawPoint(w, to_x, from_y + i, value); } } } else PWDrawLine(w, from_x, from_y, to_x, to_y, value); } #if NeedFunctionPrototypes void PWDrawFilledRectangle(Widget w, Position from_x, Position from_y, Position to_x, Position to_y, int value) #else void PWDrawFilledRectangle(w, from_x, from_y, to_x, to_y, value) Widget w; Position from_x, from_y, to_x, to_y; int value; #endif { register Position x, y; QuerySwap(from_x, to_x); QuerySwap(from_y, to_y); for (x = from_x; x <= to_x; x++) for (y = from_y; y <= to_y; y++) PWDrawPoint(w, x, y, value); } #if NeedFunctionPrototypes void PWDrawCircle(Widget w, Position origin_x, Position origin_y, Position point_x, Position point_y, int value) #else void PWDrawCircle(w, origin_x, origin_y, point_x, point_y, value) Widget w; Position origin_x, origin_y, point_x, point_y; int value; #endif { register Position i, delta; Dimension dx, dy, half; double radius; dx = abs(point_x - origin_x); dy = abs(point_y - origin_y); radius = sqrt((double) (dx * dx + dy * dy)); if (radius < 1.0) { PWDrawPoint(w, origin_x, origin_y, value); } else { PWDrawPoint(w, origin_x - (Position) floor(radius), origin_y, value); PWDrawPoint(w, origin_x + (Position) floor(radius), origin_y, value); PWDrawPoint(w, origin_x, origin_y - (Position) floor(radius), value); PWDrawPoint(w, origin_x, origin_y + (Position) floor(radius), value); } half = radius / sqrt(2.0); for(i = 1; i <= (Position)half; i++) { delta = sqrt(radius * radius - i * i); PWDrawPoint(w, origin_x - delta, origin_y - i, value); PWDrawPoint(w, origin_x - delta, origin_y + i, value); PWDrawPoint(w, origin_x + delta, origin_y - i, value); PWDrawPoint(w, origin_x + delta, origin_y + i, value); if (i != delta) { PWDrawPoint(w, origin_x - i, origin_y - delta, value); PWDrawPoint(w, origin_x - i, origin_y + delta, value); PWDrawPoint(w, origin_x + i, origin_y - delta, value); PWDrawPoint(w, origin_x + i, origin_y + delta, value); } } } #if NeedFunctionPrototypes void PWDrawFilledCircle(Widget w, Position origin_x, Position origin_y, Position point_x, Position point_y, int value) #else void PWDrawFilledCircle(w, origin_x, origin_y, point_x, point_y, value) Widget w; Position origin_x, origin_y, point_x, point_y; int value; #endif { register Position i, j, delta; Dimension dx, dy; double radius; dx = abs(point_x - origin_x); dy = abs(point_y - origin_y); radius = sqrt((double) (dx * dx + dy * dy)); for(j = origin_x - (Position) floor(radius); j <= origin_x + (Position) floor(radius); j++) PWDrawPoint(w, j, origin_y, value); for(i = 1; i <= (Position) floor(radius); i++) { delta = sqrt(radius * radius - i * i); for(j = origin_x - delta; j <= origin_x + delta; j++) { PWDrawPoint(w, j, origin_y - i, value); PWDrawPoint(w, j, origin_y + i, value); } } } #if NeedFunctionPrototypes void PWFloodFill(Widget w, Position x, Position y, int value) #else void PWFloodFill(w, x, y, value) Widget w; Position x, y; int value; #endif { PixmapWidget PW = (PixmapWidget) w; Pixel pixel, foreground = PW->pixmap.foreground_pixel; Pixel clear = PW->pixmap.clear_pixel; pixel = GetPxl(PW, x, y); if (value == Invert) FloodLoop(PW, x, y, ((pixel != clear) ? clear : foreground), pixel); else if (value == Clear) FloodLoop(PW, x, y, clear, pixel); else FloodLoop(PW, x, y, foreground, pixel); } #if NeedFunctionPrototypes void PWUp(Widget w) #else void PWUp(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; register Position x, y; Pixel first, up, down; Position from_x, from_y, to_x, to_y; if (PWQueryMarked(w)) { from_x = PW->pixmap.mark.from_x; from_y = PW->pixmap.mark.from_y; to_x = PW->pixmap.mark.to_x; to_y = PW->pixmap.mark.to_y; } else { from_x = 0; from_y = 0; to_x = PW->pixmap.width - 1; to_y = PW->pixmap.height - 1; } if ((to_y - from_y) == 0) return; for(x = from_x; x <= to_x; x++) { first = up = GetPxl(PW, x, to_y); for(y = to_y - 1; y >= from_y; y--) { down = GetPxl(PW, x, y); if (up != down) { DrawPoint(PW, x, y, up, Lazy); } up = down; } if (first != down) { DrawPoint(PW, x, to_y, down, Lazy); } } if (!PWQueryMarked(w)) { if (QuerySet(PW->pixmap.hot.x, PW->pixmap.hot.y)) { PWSetHotSpot(w, PW->pixmap.hot.x, (PW->pixmap.hot.y - 1 + PW->pixmap.image->height) % PW->pixmap.image->height); } if (PW->pixmap.translateCallback) PW->pixmap.translateCallback( w, 0, -1 ); } } #if NeedFunctionPrototypes void PWDown(Widget w) #else void PWDown(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; register Position x, y; Pixel first, down, up; Position from_x, from_y, to_x, to_y; if (PWQueryMarked(w)) { from_x = PW->pixmap.mark.from_x; from_y = PW->pixmap.mark.from_y; to_x = PW->pixmap.mark.to_x; to_y = PW->pixmap.mark.to_y; } else { from_x = 0; from_y = 0; to_x = PW->pixmap.width - 1; to_y = PW->pixmap.height - 1; } if ((to_y - from_y) == 0) return; for(x = from_x; x <= to_x; x++) { first = down = GetPxl(PW, x, from_y); for(y = from_y + 1; y <= to_y; y++) { up = GetPxl(PW, x, y); if (down != up) { DrawPoint(PW, x, y, down, Lazy); } down = up; } if(first != up) { DrawPoint(PW, x, from_y, up, Lazy); } } if (!PWQueryMarked(w)) { if (QuerySet(PW->pixmap.hot.x, PW->pixmap.hot.y)) { PWSetHotSpot(w, PW->pixmap.hot.x, (PW->pixmap.hot.y + 1) % PW->pixmap.image->height); } if (PW->pixmap.translateCallback) PW->pixmap.translateCallback( w, 0, 1 ); } } #if NeedFunctionPrototypes void PWLeft(Widget w) #else void PWLeft(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; register Position x, y; Pixel first, left, right; Position from_x, from_y, to_x, to_y; if (PWQueryMarked(w)) { from_x = PW->pixmap.mark.from_x; from_y = PW->pixmap.mark.from_y; to_x = PW->pixmap.mark.to_x; to_y = PW->pixmap.mark.to_y; } else { from_x = 0; from_y = 0; to_x = PW->pixmap.width - 1; to_y = PW->pixmap.height - 1; } if ((to_x - from_x) == 0) return; for(y = from_y; y <= to_y; y++) { first = left = GetPxl(PW, to_x, y); for(x = to_x - 1; x >= from_x; x--) { right = GetPxl(PW, x, y); if (left != right) { DrawPoint(PW, x, y, left, Lazy); } left = right; } if(first != right) { DrawPoint(PW, to_x, y, right, Lazy); } } if (!PWQueryMarked(w)) { if (QuerySet(PW->pixmap.hot.x, PW->pixmap.hot.y)) { PWSetHotSpot(w, (PW->pixmap.hot.x - 1 + PW->pixmap.image->width) % PW->pixmap.image->width, PW->pixmap.hot.y); } if (PW->pixmap.translateCallback) PW->pixmap.translateCallback( w, -1, 0 ); } } #if NeedFunctionPrototypes void PWRight(Widget w) #else void PWRight(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; register Position x, y; Pixel first, right, left; Position from_x, from_y, to_x, to_y; if (PWQueryMarked(w)) { from_x = PW->pixmap.mark.from_x; from_y = PW->pixmap.mark.from_y; to_x = PW->pixmap.mark.to_x; to_y = PW->pixmap.mark.to_y; } else { from_x = 0; from_y = 0; to_x = PW->pixmap.width - 1; to_y = PW->pixmap.height - 1; } if ((to_x - from_x) == 0) return; for(y = from_y; y <= to_y; y++) { first = right = GetPxl(PW, from_x, y); for(x = from_x + 1; x <= to_x; x++) { left = GetPxl(PW, x, y); if (right != left) { DrawPoint(PW, x, y, right, Lazy); } right = left; } if(first != left) { DrawPoint(PW, from_x, y, left, Lazy); } } if (!PWQueryMarked(w)) { if (QuerySet(PW->pixmap.hot.x, PW->pixmap.hot.y)) { PWSetHotSpot(w, (PW->pixmap.hot.x + 1) % PW->pixmap.image->width, PW->pixmap.hot.y); } if (PW->pixmap.translateCallback) PW->pixmap.translateCallback( w, 1, 0 ); } } #if NeedFunctionPrototypes void PWRedrawMark(Widget w) #else void PWRedrawMark(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; if (QuerySet(PW->pixmap.mark.from_x, PW->pixmap.mark.from_y)) XFillRectangle(dpy, XtWindow(PW), PW->pixmap.highlighting_gc, InWindowX(PW, PW->pixmap.mark.from_x), InWindowY(PW, PW->pixmap.mark.from_y), InWindowX(PW, PW->pixmap.mark.to_x + 1) - InWindowX(PW, PW->pixmap.mark.from_x), InWindowY(PW, PW->pixmap.mark.to_y + 1) - InWindowY(PW, PW->pixmap.mark.from_y)); } #if NeedFunctionPrototypes void PWFold(Widget w) #else void PWFold(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; Position x, y, new_x, new_y; Dimension horiz, vert; XImage *storage, *mask_storage; Pixel color; storage = CreatePixmapImage(PW, (Dimension) PW->pixmap.image->width, (Dimension) PW->pixmap.image->height); mask_storage = CreateMaskImage(PW, (Dimension) PW->pixmap.mask_image->width, (Dimension) PW->pixmap.mask_image->height); TransferImageData(PW->pixmap.image, storage); TransferImageData(PW->pixmap.mask_image, mask_storage); PW->pixmap.fold ^= True; horiz = (PW->pixmap.image->width + PW->pixmap.fold) / 2; vert = (PW->pixmap.image->height + PW->pixmap.fold) / 2; for (x = 0; x < PW->pixmap.image->width; x++) for (y = 0; y < PW->pixmap.image->height; y++) { new_x = (x + horiz) % PW->pixmap.image->width; new_y = (y + vert) % PW->pixmap.image->height; if(GetPxl(PW, new_x, new_y) != (color = GetPxlFromImageAndMask(storage, mask_storage, x, y))) { DrawPoint(PW, new_x, new_y, color, Lazy); } } DestroyPixmapImage(&storage); DestroyMaskImage(&mask_storage); if (QuerySet(PW->pixmap.hot.x, PW->pixmap.hot.y)) PWSetHotSpot(w, (Position) ((PW->pixmap.hot.x + horiz) % PW->pixmap.image->width), (Position) ((PW->pixmap.hot.y + vert) % PW->pixmap.image->height)); if (PW->pixmap.translateCallback) PW->pixmap.translateCallback( w, horiz, vert ); } #if NeedFunctionPrototypes void PWClear(Widget w) #else void PWClear(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; register Position x, y; register Position from_x, from_y, to_x, to_y; if (PWQueryMarked(w)) { from_x = PW->pixmap.mark.from_x; from_y = PW->pixmap.mark.from_y; to_x = PW->pixmap.mark.to_x; to_y = PW->pixmap.mark.to_y; } else { from_x = 0; from_y = 0; to_x = PW->pixmap.image->width - 1; to_y = PW->pixmap.image->height - 1; } for (x = from_x; x <= to_x; x++) for (y = from_y; y <= to_y; y++) ClearPoint(PW, x, y, Lazy); /* This way is too flashy ClearPxl(PW->pixmap.image, x, y, PW->pixmap.clear_pixel); XClearArea(dpy, XtWindow(PW), 0, 0, PW->core.width, PW->core.height, True);*/ } #if NeedFunctionPrototypes void PWSet(Widget w) #else void PWSet(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; register Position x, y; register Position from_x, from_y, to_x, to_y; if (PWQueryMarked(w)) { from_x = PW->pixmap.mark.from_x; from_y = PW->pixmap.mark.from_y; to_x = PW->pixmap.mark.to_x; to_y = PW->pixmap.mark.to_y; } else { from_x = 0; from_y = 0; to_x = PW->pixmap.image->width - 1; to_y = PW->pixmap.image->height - 1; } for (x = from_x; x <= to_x; x++) for (y = from_y; y <= to_y; y++) { DrawPoint(PW, x, y, PW->pixmap.foreground_pixel, Lazy); } } #if NeedFunctionPrototypes void PWRedraw(Widget w) #else void PWRedraw(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; XClearArea(dpy, XtWindow(PW), 0, 0, PW->core.width, PW->core.height, True); } /*--------------------------------------------------------------------------*/ /* P W T r a n s l a t e P o i n t Translate a point by dx, dy wrapping around if the point goes off the pixmap */ /*--------------------------------------------------------------------------*/ void PWTranslatePoint( w, x, y, dx, dy ) Widget w; Position *x; Position *y; Position dx; Position dy; { PixmapWidget PW = (PixmapWidget) w; /* printf("PWTranslatePoint : %d,%d by %d,%d\n", *x, *y, dx, dy); */ *x = (*x + dx + PW->pixmap.image->width) % PW->pixmap.image->width; *y = (*y + dy + PW->pixmap.image->height) % PW->pixmap.image->height; } /*--------------------------------------------------------------------------*/ /* P W F l i p P o i n t Flip a given point guaranteeing that the flipped point will be in the pixmap. */ /*--------------------------------------------------------------------------*/ void PWFlipPoint( w, x, y, axis ) Widget w; Position *x; Position *y; enum FlipAxis axis; { PixmapWidget PW = (PixmapWidget) w; if ( axis == Vertical ) *x = PW->pixmap.image->width - 1 - *x; else *y = PW->pixmap.image->height - 1 - *y; } /*--------------------------------------------------------------------------*/ /* R o t a t e P o i n t Rotate a single point left or right 90 degrees. Guarantee that result is in pixmap. */ /*--------------------------------------------------------------------------*/ void PWRotatePoint( w, x, y, direction ) Widget w; Position *x; Position *y; enum RotateDirection direction; { PixmapWidget PW = (PixmapWidget) w; Position from_x, from_y, to_x, to_y; Position half_width, half_height, shift; Position tmp; if (PWQueryMarked(w)) { from_x = PW->pixmap.mark.from_x; from_y = PW->pixmap.mark.from_y; to_x = PW->pixmap.mark.to_x; to_y = PW->pixmap.mark.to_y; } else { from_x = 0; from_y = 0; to_x = PW->pixmap.width - 1; to_y = PW->pixmap.height - 1; } half_width = floor((to_x - from_x) / 2.0 + 0.5); half_height= floor((to_y - from_y ) / 2.0 + 0.5); shift = min((Position)(to_x - from_x), (Position)(to_y - from_y )) % 2; *x -= half_width; *y -= half_height; if (*x >= 0) *x += shift; if (*y >= 0) *y += shift; tmp = *x; if (direction == Right) { *x = - *y; *y = tmp; } else { *x = *y; *y = - tmp; } if (*x > 0) *x -= shift; if (*y > 0) *y -= shift; *x += half_width; *y += half_height; } #if NeedFunctionPrototypes void PWFlipHoriz(Widget w) #else void PWFlipHoriz(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; register Position x, y; Position from_x, from_y, to_x, to_y; XPoint hot; float half; Pixel color1, color2; if (PWQueryMarked(w)) { from_x = PW->pixmap.mark.from_x; from_y = PW->pixmap.mark.from_y; to_x = PW->pixmap.mark.to_x; to_y = PW->pixmap.mark.to_y; } else { from_x = 0; from_y = 0; to_x = PW->pixmap.width - 1; to_y = PW->pixmap.height - 1; } half = (float) (to_y - from_y) / 2.0 + 0.5; if (half == 0.0) return; for (x = from_x; x <= to_x; x++) for (y = 0; y < half; y++) if ((color1 = GetPxl(PW, x, from_y + y)) != (color2 = GetPxl(PW, x, to_y - y))) { DrawPoint(PW, x, from_y + y, color2, Lazy); DrawPoint(PW, x, to_y - y, color1, Lazy); } if (!PWQueryMarked(w)) { if (QuerySet(PW->pixmap.hot.x, PW->pixmap.hot.y)) { hot.x = PW->pixmap.hot.x; hot.y = PW->pixmap.hot.y; PWFlipPoint( w, &hot.x, &hot.y, Horizontal ); PWSetHotSpot(w, hot.x, hot.y ); } /* flip extensions */ if (PW->pixmap.flipCallback) PW->pixmap.flipCallback( w, Horizontal ); } } #if NeedFunctionPrototypes void PWFlipVert(Widget w) #else void PWFlipVert(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; register Position x, y; Position from_x, from_y, to_x, to_y; XPoint hot; float half; Pixel color1, color2; if (PWQueryMarked(w)) { from_x = PW->pixmap.mark.from_x; from_y = PW->pixmap.mark.from_y; to_x = PW->pixmap.mark.to_x; to_y = PW->pixmap.mark.to_y; } else { from_x = 0; from_y = 0; to_x = PW->pixmap.width - 1; to_y = PW->pixmap.height - 1; } half = (float) (to_x - from_x) / 2.0 + 0.5; if (half == 0) return; for (y = from_y; y <= to_y; y++) for (x = 0; x < half; x++) if ((color1 = GetPxl(PW, from_x + x, y)) != (color2 = GetPxl(PW, to_x - x, y))) { DrawPoint(PW, from_x + x, y, color2, Lazy); DrawPoint(PW, to_x - x, y, color1, Lazy); } if (!PWQueryMarked(w)) { if (QuerySet(PW->pixmap.hot.x, PW->pixmap.hot.y)) { hot.x = PW->pixmap.hot.x; hot.y = PW->pixmap.hot.y; PWFlipPoint( w, &hot.x, &hot.y, Vertical ); PWSetHotSpot(w, hot.x, hot.y ); } /* flip extensions */ if (PW->pixmap.flipCallback) PW->pixmap.flipCallback( w, Vertical ); } } #if NeedFunctionPrototypes void PWRotateRight(Widget w) #else void PWRotateRight(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; Position x, y, delta, shift; Position half_width, half_height; XPoint hot; Pixel quad1, quad2, quad3, quad4; Position from_x, from_y, to_x, to_y; if (PWQueryMarked(w)) { from_x = PW->pixmap.mark.from_x; from_y = PW->pixmap.mark.from_y; to_x = PW->pixmap.mark.to_x; to_y = PW->pixmap.mark.to_y; } else { from_x = 0; from_y = 0; to_x = PW->pixmap.width - 1; to_y = PW->pixmap.height - 1; } half_width = floor((to_x - from_x) / 2.0 + 0.5); half_height = floor((to_y - from_y ) / 2.0 + 0.5); shift = min((Position)(to_x - from_x), (Position)(to_y - from_y )) % 2; delta = min((Position) half_width, (Position) half_height) - shift; for (x = 0; x <= delta; x++) { for (y = 1 - shift; y <= delta; y++) { quad1 = GetPxl(PW, from_x + (Position)half_width + x, from_y + (Position)half_height + y); quad2 = GetPxl(PW, from_x + (Position)half_width + y, from_y + (Position)half_height - shift - x); quad3 = GetPxl(PW, from_x + (Position)half_width - shift - x, from_y + (Position)half_height - shift - y); quad4 = GetPxl(PW, from_x + (Position)half_width - shift - y, from_y + (Position)half_height + x); if (quad1 != quad2) { DrawPoint(PW, from_x + (Position)half_width + x, from_y + (Position)half_height + y, quad2, Lazy); } if (quad2 != quad3) { DrawPoint(PW, from_x + (Position)half_width + y, from_y + (Position)half_height - shift - x, quad3, Lazy); } if (quad3 != quad4) { DrawPoint(PW, from_x + (Position)half_width - shift - x, from_y + (Position)half_height - shift - y, quad4, Lazy); } if (quad4 != quad1) { DrawPoint(PW, from_x + (Position)half_width - shift - y, from_y + (Position)half_height + x, quad1, Lazy); } } } if (!PWQueryMarked(w)) { if (QuerySet(PW->pixmap.hot.x, PW->pixmap.hot.y)) { hot.x = PW->pixmap.hot.x; hot.y = PW->pixmap.hot.y; PWRotatePoint( w, &hot.x, &hot.y, Right ); if (QueryInPixmap(PW, hot.x, hot.y)) PWSetHotSpot(w, hot.x, hot.y); } /* rotate extensions */ if (PW->pixmap.rotateCallback) PW->pixmap.rotateCallback( w, Right ); } } #if NeedFunctionPrototypes void PWRotateLeft(Widget w) #else void PWRotateLeft(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; Position x, y,delta, shift; Position half_width, half_height; XPoint hot; Pixel quad1, quad2, quad3, quad4; Position from_x, from_y, to_x, to_y; if (PWQueryMarked(w)) { from_x = PW->pixmap.mark.from_x; from_y = PW->pixmap.mark.from_y; to_x = PW->pixmap.mark.to_x; to_y = PW->pixmap.mark.to_y; } else { from_x = 0; from_y = 0; to_x = PW->pixmap.width - 1; to_y = PW->pixmap.height - 1; } half_width = floor((to_x - from_x) / 2.0 + 0.5); half_height = floor((to_y - from_y ) / 2.0 + 0.5); shift = min((Position)(to_x - from_x), (Position)(to_y - from_y )) % 2; delta = min((Position) half_width, (Position) half_height) - shift; for (x = 0; x <= delta; x++) { for (y = 1 - shift; y <= delta; y++) { quad1 = GetPxl(PW, from_x + (Position)half_width + x, from_y + (Position)half_height + y); quad2 = GetPxl(PW, from_x + (Position)half_width + y, from_y + (Position)half_height - shift - x); quad3 = GetPxl(PW, from_x + (Position)half_width - shift - x, from_y + (Position)half_height - shift - y); quad4 = GetPxl(PW, from_x + (Position)half_width - shift - y, from_y + (Position)half_height + x); if (quad1 != quad4) { DrawPoint(PW, from_x + (Position)half_width + x, from_y + (Position)half_height + y, quad4, Lazy); } if (quad2 != quad1) { DrawPoint(PW, from_x + (Position)half_width + y, from_y + (Position)half_height - shift - x, quad1, Lazy); } if (quad3 != quad2) { DrawPoint(PW, from_x + (Position)half_width - shift - x, from_y + (Position)half_height - shift - y, quad2, Lazy); } if (quad4 != quad3) { DrawPoint(PW, from_x + (Position)half_width - shift - y, from_y + (Position)half_height + x, quad3, Lazy); } } } if (!PWQueryMarked(w)) { if (QuerySet(PW->pixmap.hot.x, PW->pixmap.hot.y)) { hot.x = PW->pixmap.hot.x; hot.y = PW->pixmap.hot.y; PWRotatePoint( w, &hot.x, &hot.y, Left ); if (QueryInPixmap(PW, hot.x, hot.y)) PWSetHotSpot(w, hot.x, hot.y); } /* rotate extensions */ if (PW->pixmap.rotateCallback) PW->pixmap.rotateCallback( w, Left ); } } #if NeedFunctionPrototypes void PWStore(Widget w) #else void PWStore(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; Dimension width, height; if (QuerySet(PW->pixmap.mark.from_x, PW->pixmap.mark.from_y)) { DestroyPixmapImage(&PW->pixmap.storage); DestroyMaskImage(&PW->pixmap.mask_storage); width = PW->pixmap.mark.to_x - PW->pixmap.mark.from_x + 1; height = PW->pixmap.mark.to_y - PW->pixmap.mark.from_y + 1; PW->pixmap.storage = CreatePixmapImage(PW, width, height); PW->pixmap.mask_storage = CreateMaskImage(PW, width, height); CopyImageData(PW->pixmap.image, PW->pixmap.storage, PW->pixmap.mark.from_x, PW->pixmap.mark.from_y, PW->pixmap.mark.to_x, PW->pixmap.mark.to_y, 0, 0); CopyImageData(PW->pixmap.mask_image, PW->pixmap.mask_storage, PW->pixmap.mark.from_x, PW->pixmap.mark.from_y, PW->pixmap.mark.to_x, PW->pixmap.mark.to_y, 0, 0); } } #if NeedFunctionPrototypes void PWClearMarked(Widget w) #else void PWClearMarked(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; if (QuerySet(PW->pixmap.mark.from_x, PW->pixmap.mark.from_y)) { Position from_x = PW->pixmap.mark.from_x, from_y = PW->pixmap.mark.from_y, to_x = PW->pixmap.mark.to_x, to_y = PW->pixmap.mark.to_y; Position x, y; QuerySwap(from_x, to_x); QuerySwap(from_y, to_y); for (x = from_x; x <= to_x; x++) for (y = from_y; y <= to_y; y++) { ClearPoint(PW, x, y, Lazy); } } } #if NeedFunctionPrototypes void PWDragMarked(Widget w, Position at_x, Position at_y) #else void PWDragMarked(w, at_x, at_y) Widget w; Position at_x, at_y; #endif { PixmapWidget PW = (PixmapWidget) w; if (QuerySet(PW->pixmap.mark.from_x, PW->pixmap.mark.from_y)) PWDrawRectangle(w, at_x, at_y, at_x + PW->pixmap.mark.to_x - PW->pixmap.mark.from_x, at_y + PW->pixmap.mark.to_y - PW->pixmap.mark.from_y, Highlight); } #if NeedFunctionPrototypes void PWDragStored(Widget w, Position at_x, Position at_y) #else void PWDragStored(w, at_x, at_y) Widget w; Position at_x, at_y; #endif { PixmapWidget PW = (PixmapWidget) w; if (PW->pixmap.storage) PWDrawRectangle(w, at_x, at_y, at_x + PW->pixmap.storage->width - 1, at_y + PW->pixmap.storage->height - 1, Highlight); } #if NeedFunctionPrototypes void PWRestore(Widget w, Position at_x, Position at_y, int value) #else void PWRestore(w, at_x, at_y, value) Widget w; Position at_x, at_y; int value; #endif { PixmapWidget PW = (PixmapWidget) w; if (PW->pixmap.storage) DrawImageData(PW, PW->pixmap.storage, PW->pixmap.mask_storage, at_x, at_y, value, Lazy); } #if NeedFunctionPrototypes void PWCopy(Widget w, Position at_x, Position at_y, int value) #else void PWCopy(w, at_x, at_y, value) Widget w; Position at_x, at_y; int value; #endif { PixmapWidget PW = (PixmapWidget) w; XImage *storage, *mask_storage; Dimension width, height; if (QuerySet(PW->pixmap.mark.from_x, PW->pixmap.mark.from_y)) { width = PW->pixmap.mark.to_x - PW->pixmap.mark.from_x + 1; height = PW->pixmap.mark.to_y - PW->pixmap.mark.from_y + 1; storage = CreatePixmapImage(PW, width, height); mask_storage = CreateMaskImage(PW, width, height); CopyImageData(PW->pixmap.image, storage, PW->pixmap.mark.from_x, PW->pixmap.mark.from_y, PW->pixmap.mark.to_x, PW->pixmap.mark.to_y, 0, 0); CopyImageData(PW->pixmap.mask_image, mask_storage, PW->pixmap.mark.from_x, PW->pixmap.mark.from_y, PW->pixmap.mark.to_x, PW->pixmap.mark.to_y, 0, 0); DrawImageData(PW, storage, mask_storage, at_x, at_y, value, NotLazy); PWMark(w, at_x, at_y, at_x + PW->pixmap.mark.to_x - PW->pixmap.mark.from_x, at_y + PW->pixmap.mark.to_y - PW->pixmap.mark.from_y); DestroyPixmapImage(&storage); DestroyMaskImage(&mask_storage); } } #if NeedFunctionPrototypes void PWMove(Widget w, Position at_x, Position at_y, int value) #else void PWMove(w, at_x, at_y, value) Widget w; Position at_x, at_y; int value; #endif { PixmapWidget PW = (PixmapWidget) w; XImage *storage, *mask_storage; Dimension width, height; if (QuerySet(PW->pixmap.mark.from_x, PW->pixmap.mark.from_y)) { width = PW->pixmap.mark.to_x - PW->pixmap.mark.from_x + 1; height = PW->pixmap.mark.to_y - PW->pixmap.mark.from_y + 1; storage = CreatePixmapImage(PW, width, height); mask_storage = CreateMaskImage(PW, width, height); CopyImageData(PW->pixmap.image, storage, PW->pixmap.mark.from_x, PW->pixmap.mark.from_y, PW->pixmap.mark.to_x, PW->pixmap.mark.to_y, 0, 0); CopyImageData(PW->pixmap.mask_image, mask_storage, PW->pixmap.mark.from_x, PW->pixmap.mark.from_y, PW->pixmap.mark.to_x, PW->pixmap.mark.to_y, 0, 0); PWClearMarked(w); DrawImageData(PW, storage, mask_storage, at_x, at_y, value, NotLazy); PWMark(w, at_x, at_y, at_x + PW->pixmap.mark.to_x - PW->pixmap.mark.from_x, at_y + PW->pixmap.mark.to_y - PW->pixmap.mark.from_y); DestroyPixmapImage(&storage); DestroyMaskImage(&mask_storage); } } #if NeedFunctionPrototypes void PWStoreToBuffer(Widget w) #else void PWStoreToBuffer(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; /* first check available space and resize if necessary */ if ((PW->pixmap.image->width != PW->pixmap.buffer->width) || (PW->pixmap.image->height != PW->pixmap.buffer->height)) { XImage *buffer = CreatePixmapImage(PW, PW->pixmap.image->width, PW->pixmap.image->height); XImage *mask_buffer = CreateMaskImage(PW, PW->pixmap.mask_image->width, PW->pixmap.mask_image->height); DestroyPixmapImage(&PW->pixmap.buffer); DestroyMaskImage(&PW->pixmap.mask_buffer); PW->pixmap.buffer = buffer; PW->pixmap.mask_buffer = mask_buffer; } CopyImageData(PW->pixmap.image, PW->pixmap.buffer, 0, 0, PW->pixmap.image->width-1, PW->pixmap.image->height-1, 0, 0); CopyImageData(PW->pixmap.mask_image, PW->pixmap.mask_buffer, 0, 0, PW->pixmap.mask_image->width-1, PW->pixmap.mask_image->height-1, 0, 0); PW->pixmap.buffer_hot = PW->pixmap.hot; PW->pixmap.buffer_mark = PW->pixmap.mark; /* save extensions to undo buffer */ XpmFreeExtensions( PW->pixmap.buffer_extensions, PW->pixmap.buffer_nextensions ); CopyExtensions( &PW->pixmap.buffer_extensions, &PW->pixmap.buffer_nextensions, PW->pixmap.extensions, PW->pixmap.nextensions ); } #if NeedFunctionPrototypes void PWUnmark(Widget w) #else void PWUnmark(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; PW->pixmap.buffer_mark = PW->pixmap.mark; if (QuerySet(PW->pixmap.mark.from_x, PW->pixmap.mark.from_y)) { XFillRectangle(dpy, XtWindow(PW), PW->pixmap.highlighting_gc, InWindowX(PW, PW->pixmap.mark.from_x), InWindowY(PW, PW->pixmap.mark.from_y), InWindowX(PW, PW->pixmap.mark.to_x + 1) - InWindowX(PW, PW->pixmap.mark.from_x), InWindowY(PW, PW->pixmap.mark.to_y + 1) - InWindowY(PW, PW->pixmap.mark.from_y)); PW->pixmap.mark.from_x = PW->pixmap.mark.from_y = NotSet; PW->pixmap.mark.to_x = PW->pixmap.mark.to_y = NotSet; } } #if NeedFunctionPrototypes void PWMark(Widget w, Position from_x, Position from_y, Position to_x, Position to_y) #else void PWMark(w, from_x, from_y, to_x, to_y) Widget w; Position from_x, from_y, to_x, to_y; #endif { PixmapWidget PW = (PixmapWidget) w; PWUnmark(w); if (QuerySet(from_x, from_y)) { if ((from_x == to_x) && (from_y == to_y)) { /* PW->pixmap.mark.from_x = 0; PW->pixmap.mark.from_y = 0; PW->pixmap.mark.to_x = PW->pixmap.image->width - 1; PW->pixmap.mark.to_y = PW->pixmap.image->height - 1; */ return; } else { QuerySwap(from_x, to_x); QuerySwap(from_y, to_y); from_x = max(0, from_x); from_y = max(0, from_y); to_x = min(PW->pixmap.image->width - 1, to_x); to_y = min(PW->pixmap.image->height - 1, to_y); PW->pixmap.mark.from_x = from_x; PW->pixmap.mark.from_y = from_y; PW->pixmap.mark.to_x = to_x; PW->pixmap.mark.to_y = to_y; } XFillRectangle(dpy, XtWindow(PW), PW->pixmap.highlighting_gc, InWindowX(PW, PW->pixmap.mark.from_x), InWindowY(PW, PW->pixmap.mark.from_y), InWindowX(PW, PW->pixmap.mark.to_x + 1) - InWindowX(PW, PW->pixmap.mark.from_x), InWindowY(PW, PW->pixmap.mark.to_y +1) - InWindowY(PW, PW->pixmap.mark.from_y)); } } #if NeedFunctionPrototypes void PWUndo(Widget w) #else void PWUndo(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; Position x, y; int tmp_nextensions; XpmExtension *tmp_extensions; XPoint tmp_hot; XImage *tmp_image, *mask_tmp_image; PWArea tmp_mark; Pixel color; tmp_image = PW->pixmap.image; mask_tmp_image = PW->pixmap.mask_image; PW->pixmap.image = PW->pixmap.buffer; PW->pixmap.mask_image = PW->pixmap.mask_buffer; PW->pixmap.buffer = tmp_image; PW->pixmap.mask_buffer = mask_tmp_image; tmp_hot = PW->pixmap.hot; tmp_mark = PW->pixmap.mark; PW->pixmap.mark = PW->pixmap.buffer_mark; PW->pixmap.buffer_mark= tmp_mark; /* erase extensions then save */ /* This part is commented now cause it seems to be useless */ /* if (PW->pixmap.redrawCallback) PW->pixmap.redrawCallback( w, Clear ); */ tmp_nextensions = PW->pixmap.nextensions; tmp_extensions = PW->pixmap.extensions; PW->pixmap.nextensions = PW->pixmap.buffer_nextensions; PW->pixmap.extensions = PW->pixmap.buffer_extensions; PW->pixmap.buffer_nextensions = tmp_nextensions; PW->pixmap.buffer_extensions = tmp_extensions; if ((PW->pixmap.image->width != PW->pixmap.buffer->width) || (PW->pixmap.image->height != PW->pixmap.buffer->height)) { PW->pixmap.width = PW->pixmap.image->width; PW->pixmap.height = PW->pixmap.image->height; InternalResize(PW); } else { for (x = 0; x < PW->pixmap.image->width; x++) for (y = 0; y < PW->pixmap.image->height; y++) if (GetPxlFromImageAndMask(PW->pixmap.buffer, PW->pixmap.mask_buffer, x, y) != (color = GetPxl(PW, x, y))) { DrawPoint(PW, x, y, color, NotLazy); } /* Now treating Undo copy seperatly : when mark is set and is different from buffer one, redraw them */ if ((QuerySet(PW->pixmap.mark.from_x, PW->pixmap.mark.from_y)) && (QuerySet(PW->pixmap.buffer_mark.from_x, PW->pixmap.buffer_mark.from_y)) && ((PW->pixmap.mark.from_x != PW->pixmap.buffer_mark.from_x) || (PW->pixmap.mark.from_y != PW->pixmap.buffer_mark.from_y) || (PW->pixmap.mark.to_x != PW->pixmap.buffer_mark.to_x) || (PW->pixmap.mark.to_y != PW->pixmap.buffer_mark.to_y))) { PWRedrawPoints((Widget) PW, PW->pixmap.mark.from_x, PW->pixmap.mark.from_y, PW->pixmap.mark.to_x, PW->pixmap.mark.to_y); PWRedrawPoints((Widget) PW, PW->pixmap.buffer_mark.from_x, PW->pixmap.buffer_mark.from_y, PW->pixmap.buffer_mark.to_x, PW->pixmap.buffer_mark.to_y); } } PWSetHotSpot(w, PW->pixmap.buffer_hot.x, PW->pixmap.buffer_hot.y); PW->pixmap.buffer_hot = tmp_hot; /* This part is commented now cause it seems to be useless */ /* if (PW->pixmap.redrawCallback) PW->pixmap.redrawCallback( w, Set );*/ } #if NeedFunctionPrototypes void PWRotateBufferAndImage(Widget w) #else void PWRotateBufferAndImage(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; XPoint tmp_hot; XImage *tmp_image, *mask_tmp_image; Boolean SetHotSpot = False; if (QuerySet(PW->pixmap.mark.from_x, PW->pixmap.mark.from_y)) { /* Rotate Image and marked area */ Dimension width, height; XImage *storage, *mask_storage; width = PW->pixmap.mark.to_x - PW->pixmap.mark.from_x + 1; height = PW->pixmap.mark.to_y - PW->pixmap.mark.from_y + 1; storage = CreatePixmapImage(PW, width, height); mask_storage = CreateMaskImage(PW, width, height); CopyImageData(PW->pixmap.image, storage, PW->pixmap.mark.from_x, PW->pixmap.mark.from_y, PW->pixmap.mark.to_x, PW->pixmap.mark.to_y, 0, 0); CopyImageData(PW->pixmap.mask_image, mask_storage, PW->pixmap.mark.from_x, PW->pixmap.mark.from_y, PW->pixmap.mark.to_x, PW->pixmap.mark.to_y, 0, 0); tmp_image = PW->pixmap.image; mask_tmp_image = PW->pixmap.mask_image; tmp_hot = PW->pixmap.hot; PW->pixmap.image = storage; PW->pixmap.mask_image = mask_storage; /* reset all marked area as there are problems with undo */ PW->pixmap.mark.from_x = PW->pixmap.mark.to_x = NotSet; PW->pixmap.mark.from_y = PW->pixmap.mark.to_y = NotSet; PW->pixmap.buffer_mark.from_x = PW->pixmap.buffer_mark.to_x = NotSet; PW->pixmap.buffer_mark.from_y = PW->pixmap.buffer_mark.to_y = NotSet; } else { /* Rotate Image and Cut/Insert buffer */ SetHotSpot = True; tmp_image = PW->pixmap.image; mask_tmp_image = PW->pixmap.mask_image; tmp_hot = PW->pixmap.hot; PW->pixmap.image = PW->pixmap.storage; PW->pixmap.mask_image = PW->pixmap.mask_storage; PW->pixmap.storage = tmp_image; PW->pixmap.mask_storage = mask_tmp_image; } if ((PW->pixmap.image->width != tmp_image->width) || (PW->pixmap.image->height != tmp_image->height)) { PW->pixmap.width = PW->pixmap.image->width; PW->pixmap.height = PW->pixmap.image->height; InternalResize(PW); } else PWRedraw(w); if (SetHotSpot) /* if storage taken from buffer */ PWSetHotSpot(w, PW->pixmap.storage_hot.x, PW->pixmap.storage_hot.y); else { DestroyPixmapImage(&tmp_image); DestroyMaskImage(&mask_tmp_image); } PW->pixmap.storage_hot = tmp_hot; } #if NeedFunctionPrototypes void PWHighlightAxes(Widget w) #else void PWHighlightAxes(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; XDrawLine(dpy, XtWindow(PW), PW->pixmap.framing_gc, InWindowX(PW, 0), InWindowY(PW, 0), InWindowX(PW, PW->pixmap.width), InWindowY(PW, PW->pixmap.height)); XDrawLine(dpy, XtWindow(PW), PW->pixmap.framing_gc, InWindowX(PW, PW->pixmap.width), InWindowY(PW, 0), InWindowX(PW, 0), InWindowY(PW, PW->pixmap.height)); if (PWQueryGrid((Widget)PW)) { if ((((int)(PW->pixmap.height / 2.0)) * 2) != PW->pixmap.height) XDrawLine(dpy, XtWindow(PW), PW->pixmap.framing_gc, InWindowX(PW, 0), InWindowY(PW, PW->pixmap.height / 2.0), InWindowX(PW, PW->pixmap.width), InWindowY(PW, PW->pixmap.height / 2.0)); if ((((int)(PW->pixmap.width / 2.0)) * 2) != PW->pixmap.width) XDrawLine(dpy, XtWindow(PW), PW->pixmap.framing_gc, InWindowX(PW, PW->pixmap.width / 2.0), InWindowY(PW, 0), InWindowX(PW, PW->pixmap.width / 2.0), InWindowY(PW, PW->pixmap.height)); } } #if NeedFunctionPrototypes void PWSetForeground(Widget w, Pixel color) #else void PWSetForeground(w,color) Widget w; Pixel color; #endif { PixmapWidget PW = (PixmapWidget) w; XSetForeground(dpy,PW->pixmap.drawing_gc, color); PW->pixmap.foreground_pixel = color; } /* drag a rectangle representing the extent of the text */ #if NeedFunctionPrototypes void PWDragText(Widget w, Position at_x, Position at_y, int value) #else void PWDragText(w, at_x, at_y, value) Widget w; Position at_x, at_y; /* text origin */ int value; /* unused */ #endif { /* PixmapWidget PW = (PixmapWidget) w; calculate text extent translate from text origin to upper left of text extent draw rectangle from upper left to lower right of text extent Dimension width = PW->pixmap.text_rbearing - PW->pixmap.text_lbearing; Dimension height = PW->pixmap.text_ascent + PW->pixmap.text_descent; Position x = at_x + PW->pixmap.text_lbearing; Position y = at_y - PW->pixmap.text_ascent + 1; PWDrawRectangle(w, x, y, x + width, y + height, value); */ PWDrawText(w, at_x, at_y, value); } #if NeedFunctionPrototypes void PWDrawText(Widget w, Position at_x, Position at_y, int value) #else void PWDrawText(w, at_x, at_y, value) Widget w; Position at_x, at_y; /* text origin */ int value; #endif { PixmapWidget PW = (PixmapWidget) w; Pixmap pixmap; XImage *image; GC gc; XGCValues gcv; Position x, y, i, j; Dimension width, height; if ( ! PW->pixmap.text_string || ! PW->pixmap.font_struct || strlen(PW->pixmap.text_string) == 0 ) return; /* To draw text: put text in tmp pixmap of depth 1 then get image foreach pixel in image, if set draw into pixmapwidget */ /* text extent, add 1 pixel pad because fonts vary is how ascent is defined */ width = PW->pixmap.text_rbearing - PW->pixmap.text_lbearing + 2; height = PW->pixmap.text_ascent + PW->pixmap.text_descent + 2; /* create white pixmap size of text extent with depth one */ pixmap = XCreatePixmap( dpy, XtWindow(PW), width, height, 1 ); gcv.font = PW->pixmap.font_struct->fid; gcv.function = GXcopy; gcv.foreground = WhitePixel( dpy, screen ); gcv.background = WhitePixel( dpy, screen ); gc = XCreateGC( dpy, pixmap, GCFunction | GCFont | GCForeground | GCBackground, &gcv ); XFillRectangle( dpy, pixmap, gc, 0, 0, width, height ); /* clear */ /* draw text in pixmap */ x = (PW->pixmap.text_lbearing < 0) ? - PW->pixmap.text_lbearing : 0; y = PW->pixmap.text_ascent /* - 1 */; /* include pad */ XSetForeground( dpy, gc, BlackPixel(dpy, screen) ); XDrawString( dpy, pixmap, gc, x, y, PW->pixmap.text_string, strlen(PW->pixmap.text_string) ); /* get image of text */ image = XGetImage(dpy, pixmap, 0, 0, width, height, -1/*allplanes*/,ZPixmap); /* translate (at_x,at_y) from text origin to upper left of text extent */ x = at_x; y = at_y; x += PW->pixmap.text_lbearing; y -= PW->pixmap.text_ascent - 1; /* foreach set pixel in image, draw into pixmapwidget */ for (i = 0; i < (Position)width; i++) { for (j = 0; j < (Position)height; j++) { if (!QueryInPixmap(PW, x + i, y + j)) continue; if ( XGetPixel(image, i, j) == BlackPixel(dpy, screen) ) { PWDrawPoint( (Widget) PW, x + i, y + j, value ); } } } /* clean up */ XFreePixmap( dpy, pixmap ); XFreeGC( dpy, gc ); XDestroyImage( image ); } pixmap-2.6pl4.orig/Handlers.c100440 243 144 50344 5564722316 14726 0ustar joostusers/* * $Id: Handlers.c,v 1.5 1994/05/13 14:12:28 mallet Exp $ * * Copyright (c) 1991-1994 Lionel MALLET * * 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 Lionel MALLET 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 Lionel MALLET shall * not be used in advertising or otherwise to promote the sale, use or * other dealings in this Software without prior written authorization * from Lionel MALLET. * * Author: Lionel Mallet, SIMULOG */ /* * $XConsortium: Handlers.c,v 1.1 90/06/09 20:20:35 dmatic Exp $ * * Copyright 1989 Massachusetts Institute of Technology * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, 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 M.I.T. not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. M.I.T. makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. * 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. * * Author: Davor Matic, MIT X Consortium */ #include #include #include #include #include #include "PixmapP.h" #include #include #define XtStrlen(s) ((s) ? strlen(s) : 0) #define abs(x) (((x) > 0) ? (x) : -(x)) #define min(x, y) (((x) < (y)) ? (x) : (y)) #define max(x, y) (((x) > (y)) ? (x) : (y)) /***************************************************************************** * Handlers * *****************************************************************************/ #define QueryInSquare(PW, x, y, square_x, square_y)\ ((InPixmapX(PW, x) == (square_x)) &&\ (InPixmapY(PW, y) == (square_y))) void DragOnePointHandler(w, status, event) Widget w; PWStatus *status; XEvent *event; { PixmapWidget PW = (PixmapWidget) w; if (_PWDEBUG) fprintf(stderr, "D1PH "); switch (event->type) { case ButtonPress: if (event->xbutton.state != status->state) return; if (!QuerySet(status->at_x, status->at_y)) { PWStoreToBuffer(w); status->value = Value(PW, event->xbutton.button); status->time = event->xbutton.time; status->at_x = InPixmapX(PW, event->xbutton.x); status->at_y = InPixmapY(PW, event->xbutton.y); status->success = (status->draw != NULL); if (status->draw) (*status->draw)(w, status->at_x, status->at_y, status->value); } break; case ButtonRelease: if (QuerySet(status->at_x, status->at_y)) { status->value = Value(PW, event->xbutton.button); status->time = event->xbutton.time; status->at_x = InPixmapX(PW, event->xbutton.x); status->at_y = InPixmapY(PW, event->xbutton.y); status->success = (status->draw != NULL); PWTerminateRequest(w, TRUE); } break; case MotionNotify: if (QuerySet(status->at_x, status->at_y)) { if (!QueryInSquare(PW, event->xmotion.x, event->xmotion.y, status->at_x, status->at_y)) { status->at_x = InPixmapX(PW, event->xmotion.x); status->at_y = InPixmapY(PW, event->xmotion.y); if (status->draw) (*status->draw)(w, status->at_x, status->at_y, status->value); } } break; } } void DragOnePointEngage(w, status, draw, state) Widget w; PWStatus *status; void (*draw)(); int *state; { status->at_x = NotSet; status->at_y = NotSet; status->draw = draw; status->success = False; status->state = *state; XtAddEventHandler(w, ButtonPressMask | ButtonReleaseMask | PointerMotionMask, FALSE, (XtEventHandler)DragOnePointHandler, status); } void DragOnePointTerminate(w, status, client_data, call_data) Widget w; PWStatus *status; XtPointer client_data, call_data; { if (status->success) { PWChangeNotify(w, NULL, NULL); PWSetChanged(w); } XtRemoveEventHandler(w, ButtonPressMask | ButtonReleaseMask | PointerMotionMask, FALSE, (XtEventHandler)DragOnePointHandler, status); } void OnePointHandler(w, status, event) Widget w; PWStatus *status; XEvent *event; { PixmapWidget PW = (PixmapWidget) w; if (_PWDEBUG) fprintf(stderr, "1PH "); switch (event->type) { case Expose: if (QuerySet(status->at_x, status->at_y)) { PWClip(w, InPixmapX(PW, event->xexpose.x), InPixmapY(PW, event->xexpose.y), InPixmapX(PW, event->xexpose.x + event->xexpose.width), InPixmapY(PW, event->xexpose.y + event->xexpose.height)); if (status->draw) (*status->draw)(w, status->at_x, status->at_y, Highlight); PWUnclip(w); } break; case ButtonPress: if (event->xbutton.state != status->state) return; if (!QuerySet(status->at_x, status->at_y)) { status->value = Value(PW, event->xbutton.button); status->time = event->xbutton.time; status->at_x = InPixmapX(PW, event->xbutton.x); status->at_y = InPixmapY(PW, event->xbutton.y); if (status->draw) (*status->draw)(w, status->at_x, status->at_y, Highlight); } break; case ButtonRelease: if (QuerySet(status->at_x, status->at_y)) { if (status->draw) (*status->draw)(w, status->at_x, status->at_y, Highlight); /* the following 3 lines is a small fix to Ctrl ops */ if (event->xbutton.state&ControlMask) status->value = Set; else status->value = Value(PW, event->xbutton.button); status->time = event->xbutton.time; status->at_x = InPixmapX(PW, event->xbutton.x); status->at_y = InPixmapY(PW, event->xbutton.y); status->success = True; PWTerminateRequest(w, TRUE); } break; case MotionNotify: if (QuerySet(status->at_x, status->at_y)) { if (!QueryInSquare(PW, event->xmotion.x, event->xmotion.y, status->at_x, status->at_y)) { if (status->draw) (*status->draw)(w, status->at_x, status->at_y, Highlight); status->at_x = InPixmapX(PW, event->xmotion.x); status->at_y = InPixmapY(PW, event->xmotion.y); if (status->draw) (*status->draw)(w, status->at_x, status->at_y, Highlight); } } break; } } void OnePointEngage(w, status, draw, state) Widget w; PWStatus *status; void (*draw)(); int *state; { status->at_x = NotSet; status->at_y = NotSet; status->draw = draw; status->success = False; status->state = *state; XtAddEventHandler(w, ButtonPressMask | ButtonReleaseMask | ExposureMask | PointerMotionMask, FALSE, (XtEventHandler)OnePointHandler, status); } void OnePointImmediateEngage(w, status, draw, state) Widget w; PWStatus *status; void (*draw)(); int *state; { status->at_x = 0; status->at_y = 0; status->draw = draw; status->success = False; status->state = *state; if (status->draw) (*status->draw)(w, status->at_x, status->at_y, Highlight); XtAddEventHandler(w, ButtonPressMask | ButtonReleaseMask | ExposureMask | PointerMotionMask, FALSE, (XtEventHandler)OnePointHandler, status); } void OnePointTerminate(w, status, draw) Widget w; PWStatus *status; void (*draw)(); { if (status->success && draw) { PWStoreToBuffer(w); (*draw)(w, status->at_x, status->at_y, status->value); PWChangeNotify(w, NULL, NULL); PWSetChanged(w); } else if (QuerySet(status->at_x, status->at_y)) if (status->draw) (*status->draw)(w, status->at_x, status->at_y, Highlight); XtRemoveEventHandler(w, ButtonPressMask | ButtonReleaseMask | ExposureMask | PointerMotionMask, FALSE, (XtEventHandler)OnePointHandler, status); } void OnePointTerminateTransparent(w, status, draw) Widget w; PWStatus *status; void (*draw)(); { if (status->success && draw) (*draw)(w, status->at_x, status->at_y, status->value); else if (QuerySet(status->at_x, status->at_y)) if (status->draw) (*status->draw)(w, status->at_x, status->at_y, Highlight); XtRemoveEventHandler(w, ButtonPressMask | ButtonReleaseMask | ExposureMask | PointerMotionMask, FALSE, (XtEventHandler)OnePointHandler, status); } void TwoPointsHandler(w, status, event) Widget w; PWStatus *status; XEvent *event; { PixmapWidget PW = (PixmapWidget) w; if (_PWDEBUG) fprintf(stderr, "2PH "); switch (event->type) { case Expose: if (QuerySet(status->from_x, status->from_y) && QuerySet(status->to_x, status->to_y)) { PWClip(w, InPixmapX(PW, event->xexpose.x), InPixmapY(PW, event->xexpose.y), InPixmapX(PW, event->xexpose.x + event->xexpose.width), InPixmapY(PW, event->xexpose.y + event->xexpose.height)); if (status->draw) (*status->draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, Highlight); PWUnclip(w); } break; case ButtonPress: if (event->xbutton.state != status->state) return; if (!QuerySet(status->from_x, status->from_y)) { status->value = Value(PW, event->xbutton.button); status->time = event->xbutton.time; status->from_x = InPixmapX(PW, event->xbutton.x); status->from_y = InPixmapY(PW, event->xbutton.y); status->to_x = InPixmapX(PW, event->xbutton.x); status->to_y = InPixmapY(PW, event->xbutton.y); if (status->draw) (*status->draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, Highlight); } break; case ButtonRelease: if (QuerySet(status->from_x, status->from_y)) { if (status->draw) (*status->draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, Highlight); status->value = Value(PW, event->xbutton.button); status->time = event->xbutton.time; status->to_x = InPixmapX(PW, event->xbutton.x); status->to_y = InPixmapY(PW, event->xbutton.y); status->success = True; PWTerminateRequest(w, TRUE); } break; case MotionNotify: if (QuerySet(status->from_x, status->from_y)) { if (QuerySet(status->to_x, status->to_y)) { if (!QueryInSquare(PW, event->xmotion.x, event->xmotion.y, status->to_x, status->to_y)) { if (status->draw) (*status->draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, Highlight); status->to_x = InPixmapX(PW, event->xmotion.x); status->to_y = InPixmapY(PW, event->xmotion.y); if (status->draw) (*status->draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, Highlight); } } else { status->to_x = InPixmapX(PW, event->xmotion.x); status->to_y = InPixmapY(PW, event->xmotion.y); if (status->draw) (*status->draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, Highlight); } } break; } } void TwoPointsEngage(w, status, draw, state) Widget w; PWStatus *status; void (*draw)(); int *state; { status->from_x = NotSet; status->from_y = NotSet; status->to_x = NotSet; status->to_y = NotSet; status->draw = draw; status->success = False; status->state = *state; XtAddEventHandler(w, ButtonPressMask | ButtonReleaseMask | ExposureMask | PointerMotionMask, FALSE, (XtEventHandler)TwoPointsHandler, status); } void TwoPointsTerminate(w, status, draw) Widget w; PWStatus *status; void (*draw)(); { if (status->success && draw) { PWStoreToBuffer(w); (*draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, status->value); PWChangeNotify(w, NULL, NULL); PWSetChanged(w); } else if (QuerySet(status->from_x, status->from_y) && QuerySet(status->to_x, status->to_y)) if (status->draw) (*status->draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, Highlight); XtRemoveEventHandler(w, ButtonPressMask | ButtonReleaseMask | ExposureMask | PointerMotionMask, FALSE, (XtEventHandler)TwoPointsHandler, status); } void TwoPointsTerminateTransparent(w, status, draw) Widget w; PWStatus *status; void (*draw)(); { if (status->success && draw) (*draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, status->value); else if (QuerySet(status->from_x, status->from_y) && QuerySet(status->to_x, status->to_y)) if (status->draw) (*status->draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, Highlight); XtRemoveEventHandler(w, ButtonPressMask | ButtonReleaseMask | ExposureMask | PointerMotionMask, FALSE, (XtEventHandler)TwoPointsHandler, status); } void TwoPointsTerminateTimed(w, status, draw) Widget w; PWStatus *status; void (*draw)(); { if (status->success && draw) (*draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, status->time); else if (QuerySet(status->from_x, status->from_y) && QuerySet(status->to_x, status->to_y)) if (status->draw) (*status->draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, Highlight); XtRemoveEventHandler(w, ButtonPressMask | ButtonReleaseMask | ExposureMask | PointerMotionMask, FALSE, (XtEventHandler)TwoPointsHandler, status); } void Interface(w, status, action) Widget w; XtPointer status; void (*action)(); { (*action)(w); } void Paste(w, at_x, at_y, value) Widget w; Position at_x, at_y; int value; { PixmapWidget PW = (PixmapWidget) w; PWStatus *my_status; PWRequest request; my_status = (PWStatus *) PW->pixmap.request_stack[PW->pixmap.current].status; my_status->draw = NULL; request = (PWRequest) PW->pixmap.request_stack[PW->pixmap.current].request->terminate_client_data; PWTerminateRequest(w, FALSE); if ((at_x == max(PW->pixmap.mark.from_x, min(at_x, PW->pixmap.mark.to_x))) && (at_y == max(PW->pixmap.mark.from_y, min(at_y, PW->pixmap.mark.to_y)))) { PWStatus *status; if (_PWDEBUG) fprintf(stderr, "Prepaste request: %s\n", request); PWEngageRequest(w, request, False, (XtPointer)&(my_status->state), (Cardinal)sizeof(int)); status = (PWStatus *) PW->pixmap.request_stack[PW->pixmap.current].status; status->at_x = at_x; status->at_y = at_y; status->value = value; (*status->draw) (w, at_x, at_y, Highlight); } else { PWStatus *status; PWEngageRequest(w, MarkRequest, False, (XtPointer)&(my_status->state), (Cardinal)sizeof(int)); status = (PWStatus *) PW->pixmap.request_stack[PW->pixmap.current].status; status->from_x = status->to_x = at_x; status->from_y = status->to_y = at_y; status->value = value; (*status->draw) (w, at_x, at_y, at_x, at_y, Highlight); } } void DragTwoPointsHandler(w, status, event) Widget w; PWStatus *status; XEvent *event; { PixmapWidget PW = (PixmapWidget) w; if (_PWDEBUG) fprintf(stderr, "D2PH "); switch (event->type) { case ButtonPress: if (event->xbutton.state != status->state) return; if (!QuerySet(status->from_x, status->from_y)) { PWStoreToBuffer(w); status->value = Value(PW, event->xbutton.button); status->time = event->xbutton.time; status->from_x = InPixmapX(PW, event->xbutton.x); status->from_y = InPixmapY(PW, event->xbutton.y); status->to_x = InPixmapX(PW, event->xbutton.x); status->to_y = InPixmapY(PW, event->xbutton.y); status->success = (status->draw != NULL); if (status->draw) (*status->draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, status->value); } break; case ButtonRelease: if (QuerySet(status->from_x, status->from_y)) { status->value = Value(PW, event->xbutton.button); status->time = event->xbutton.time; status->from_x = status->to_x; status->from_y = status->to_y; status->to_x = InPixmapX(PW, event->xbutton.x); status->to_y = InPixmapY(PW, event->xbutton.y); status->success = True; PWTerminateRequest(w, TRUE); } break; case MotionNotify: if (QuerySet(status->from_x, status->from_y)) { if (QuerySet(status->to_x, status->to_y)) { if (!QueryInSquare(PW, event->xmotion.x, event->xmotion.y, status->to_x, status->to_y)) { status->from_x = status->to_x; status->from_y = status->to_y; status->to_x = InPixmapX(PW, event->xmotion.x); status->to_y = InPixmapY(PW, event->xmotion.y); if (status->draw) (*status->draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, status->value); } } } break; } } void DragTwoPointsEngage(w, status, draw, state) Widget w; PWStatus *status; void (*draw)(); int *state; { status->from_x = NotSet; status->from_y = NotSet; status->to_x = NotSet; status->to_y = NotSet; status->draw = draw; status->success = False; status->state = *state; XtAddEventHandler(w, ButtonPressMask | ButtonReleaseMask | PointerMotionMask, FALSE, (XtEventHandler)DragTwoPointsHandler, status); } void DragTwoPointsTerminate(w, status, draw) Widget w; PWStatus *status; void (*draw)(); { if (status->success && draw) { if ((status->from_x != status->to_x) || (status->from_y != status->to_y)) (*draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, status->value); PWChangeNotify(w, NULL, NULL); PWSetChanged(w); } XtRemoveEventHandler(w, ButtonPressMask | ButtonReleaseMask | PointerMotionMask, FALSE, (XtEventHandler)DragTwoPointsHandler, status); } void PWTPaste(w, event) Widget w; XEvent *event; { PixmapWidget PW = (PixmapWidget) w; if (!PW->pixmap.selection.own) PWRequestSelection(w, event->xbutton.time, TRUE); else PWStore(w); if (!PWQueryStored(w)) return; PWEngageRequest(w, RestoreRequest, False, (XtPointer)&(event->xbutton.state), (Cardinal)sizeof(int)); OnePointHandler(w, (PWStatus*) PW->pixmap.request_stack[PW->pixmap.current].status, event); } void PWTMark(w, event) Widget w; XEvent *event; { PixmapWidget PW = (PixmapWidget) w; PWEngageRequest(w, MarkRequest, False, (XtPointer)&(event->xbutton.state), (Cardinal)sizeof(int)); TwoPointsHandler(w, (PWStatus*) PW->pixmap.request_stack[PW->pixmap.current].status, event); } void PWTUnmark(w) Widget w; { PWUnmark(w); } /*****************************************************************************/ pixmap-2.6pl4.orig/PixEdit.c100440 243 144 162163 6263264165 14557 0ustar joostusers/* * $Id: PixEdit.c,v 1.20 1996/09/02 16:50:33 lmallet Exp $ * * Copyright (c) 1991-1994 Lionel MALLET * * 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 Lionel MALLET 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 Lionel MALLET shall * not be used in advertising or otherwise to promote the sale, use or * other dealings in this Software without prior written authorization * from Lionel MALLET. * * Author: Lionel Mallet, SIMULOG */ /* * $XConsortium: BitEdit.c,v 1.7 90/06/09 20:19:19 dmatic Exp $ * * Copyright 1989 Massachusetts Institute of Technology * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, 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 M.I.T. not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. M.I.T. makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. * 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. * * Author: Davor Matic, MIT X Consortium */ static char rcsid[] = "$Id: PixEdit.c,v 1.20 1996/09/02 16:50:33 lmallet Exp $"; #include #include #include #include #include #include #ifndef USE_ATHENA #include #include #include #include #include #include #include #include #include #ifndef NO_EDITRES #include #endif /* NO_EDITRES */ #define CHARSET XmSTRING_DEFAULT_CHARSET #if XmVersion > 1001 /* Motif 1.2 or > */ #include #endif #else /* USE_ATHENA */ #include #include #include #include #include #include #include #include #include #include #include #include #endif /* USE_ATHENA */ #include "Pixmap.h" #include "Version.h" #include "patchlevel.h" static char *info_str = NULL; #define TOGGLE True #define BUTTON False static char *usage = "[-options ...]\n\ \n\ where options include:\n\ -size WIDTHxHEIGHT\n\ -squares dimension\n\ -grid, +grid\n\ -stippled\n\ -stipple pixmap\n\ -axes, +axes\n\ -proportional, +proportional\n\ -hl color\n\ -fr color\n\ -tr color\n\ -fn/-font fontname\n\ -filename filename\n\ -f filename\n\ -in filename\n\ -colormap\n\ -pc\n\ \n\ The default WIDTHxHEIGHT is 32x32.\n"; static XrmOptionDescRec options[] = { { "-squares", "*pixmap.squareSize", XrmoptionSepArg, NULL}, { "-grid", "*pixmap.grid", XrmoptionNoArg, "False"}, { "+grid", "*pixmap.grid", XrmoptionNoArg, "True"}, { "-stippled", "*pixmap.stippled", XrmoptionNoArg, "False"}, { "-stipple", "*pixmap.pixmap*stipple", XrmoptionSepArg, NULL}, { "-axes", "*pixmap.axes", XrmoptionNoArg, "False"}, { "+axes", "*pixmap.axes", XrmoptionNoArg, "True"}, { "-proportional", "*pixmap.proportional", XrmoptionNoArg, "False"}, { "+proportional", "*pixmap.proportional", XrmoptionNoArg, "True"}, { "-hl", "*pixmap.highlight", XrmoptionSepArg, NULL}, { "-fr", "*pixmap.framing", XrmoptionSepArg, NULL}, { "-tr", "*pixmap.transparent", XrmoptionSepArg, NULL}, { "-fn", "*font", XrmoptionSepArg, "fixed"}, { "-font", "*font", XrmoptionSepArg, "fixed"}, { "-filename", "*pixmap.filename", XrmoptionSepArg, NULL}, { "-f", "*pixmap.filename", XrmoptionSepArg, NULL}, { "-in", "*pixmap.filename", XrmoptionSepArg, NULL}, { "-colormap", "*privateColormap", XrmoptionNoArg, "True"}, { "-pc", "*privateColormap", XrmoptionNoArg, "True"}, }; typedef struct { Boolean privateColormap; } Resources, *ResourcesPtr; static XtResource appResources[] = { #define offset(field) XtOffset(ResourcesPtr, field) {"privateColormap", "PrivateColormap", XtRBoolean, sizeof(Boolean), offset(privateColormap), XtRImmediate, (caddr_t)False}, #undef offset }; /* Color is the maximal id usable for menu entries different from color */ #define Color 200 #define Color_offset Color typedef struct { int id; String name; Boolean trap; Widget widget; } ButtonRec; static ButtonRec file_menu[] = { #define Load 26 {Load, "load", BUTTON}, #define Insert 101 {Insert, "insert", BUTTON}, #define Save 27 {Save, "save", BUTTON}, #define SaveAs 28 {SaveAs, "saveAs", BUTTON}, #define Dummy -1 {Dummy, "line", False}, #define Resize 24 {Resize, "resize", BUTTON}, #define Rescale 79 {Rescale, "rescale", BUTTON}, #define Filename 74 {Filename, "filename", BUTTON}, #define Hints 106 {Hints, "hintsCmt", BUTTON}, #define Colors 107 {Colors, "colorsCmt", BUTTON}, #define Pixels 108 {Pixels, "pixelsCmt", BUTTON}, {Dummy, "line", False}, #define Quit 75 {Quit, "quit", BUTTON}, }; static ButtonRec edit_menu[] = { #define Image 77 {Image, "image", TOGGLE}, {Dummy, "line", False}, #define Grid 23 {Grid, "grid", TOGGLE}, #define Axes 34 {Axes, "axes", TOGGLE}, #define Proportional 97 {Proportional, "proportional", TOGGLE}, #define Zoom 100 {Zoom, "zoom", TOGGLE}, #define ZoomIn 115 {ZoomIn, "zoomIn", BUTTON}, #define ZoomOut 116 {ZoomOut, "zoomOut", BUTTON}, #define ZoomFactor 117 {ZoomFactor, "zoomFactor", BUTTON}, /* Dummy */ {Dummy, "line", False}, #define Cut 30 {Cut, "cut", BUTTON}, #define Copy 31 {Copy, "copy", BUTTON}, #define Paste 4 {Paste, "paste", BUTTON}, #define Crop 118 {Crop, "crop", BUTTON}, }; static ButtonRec color_menu[] = { #define ColorPixel 109 {ColorPixel, "addColor", BUTTON}, #define ColorSname 110 {ColorSname, "symbolicName", BUTTON}, #define ColorMname 111 {ColorMname, "monochromeName", BUTTON}, #define ColorG4name 112 {ColorG4name, "g4Name", BUTTON}, #define ColorGname 113 {ColorGname, "gName", BUTTON}, #define ColorCname 114 {ColorCname, "cName", BUTTON}, }; static ButtonRec extension_menu[] = { #define AddExtension 119 /* id, name, trap, widget */ { AddExtension, "addExtension", BUTTON, NULL }, { Dummy, "line", False, NULL }, }; static ButtonRec buttons[] = { #define Undo 25 {Undo, "undo", BUTTON}, /*#define Clear 1*/ {Clear, "clear", BUTTON}, /*#define Set 2*/ {Set, "set", BUTTON}, #define Redraw 5 {Redraw, "redraw", BUTTON}, #define CopyImm 102 {CopyImm, "copy", TOGGLE}, #define MoveImm 103 {MoveImm, "move", TOGGLE}, #define MarkImm 104 {MarkImm, "mark", TOGGLE}, #define UnmarkImm 105 {UnmarkImm, "unmark", BUTTON}, #define FlipHoriz 11 {FlipHoriz, "flipHoriz", BUTTON}, #define Up 7 {Up, "up", BUTTON}, #define FlipVert 12 {FlipVert, "flipVert", BUTTON}, #define Left 9 {Left, "left", BUTTON}, #define Fold 99 {Fold, "fold", BUTTON}, #define Right 10 {Right, "right", BUTTON}, #define RotateLeft 33 {RotateLeft, "rotateLeft", BUTTON}, #define Down 8 {Down, "down", BUTTON}, #define RotateRight 13 {RotateRight, "rotateRight", BUTTON}, #define Point 14 {Point, "point", TOGGLE}, #define Curve 41 {Curve, "curve", TOGGLE}, #define Line 15 {Line, "line", TOGGLE}, #define Rectangle 16 {Rectangle, "rectangle", TOGGLE}, #define FilledRectangle 17 {FilledRectangle, "filledRectangle", TOGGLE}, #define Circle 18 {Circle, "circle", TOGGLE}, #define FilledCircle 19 {FilledCircle, "filledCircle", TOGGLE}, #define FloodFill 20 {FloodFill, "floodFill", TOGGLE}, #define Text 29 {Text, "text", TOGGLE}, #define SetHotSpot 21 {SetHotSpot, "setHotSpot", TOGGLE}, #define ClearHotSpot 22 {ClearHotSpot, "clearHotSpot", BUTTON}, }; #include "Dialog.h" XtAppContext pixmap_context; Widget top_widget, parent_widget, formy_widget, infoButton_widget, fileButton_widget, fileMenu_widget, editButton_widget, editMenu_widget, colorButton_widget, colorMenu_widget, extensionMenu_widget, extensionEditor, status_widget, statusb_widget, pane_widget, color_pane_widget, form_widget, pixmap_widget, image_shell, image_widget; #include "TextOpt.h" TextOptions *textOptions; #include "TextOpt.c" Display *dpy; int screen; int ncolors; Pixel current_color; Colormap cmap; Pixel black, white; char *hints_cmt, *colors_cmt, *pixels_cmt; PWColorInfo **colorTable; Boolean image_visible = False; Pixmap check_mark; Dialog info_dialog, input_dialog, error_dialog, qsave_dialog, file_dialog; String filename = NULL, format = ""; char message[80]; void FixMenu(), SwitchImage(), SwitchGrid(), SwitchAxes(), SwitchProportional(), SwitchZoom(), DoLoad(), DoInsert(), DoSave(), DoSaveAs(), DoResize(), DoRescale(), DoFilename(), DoHintsCmt(), DoColorsCmt(), DoPixelsCmt(), DoQuit(), DoAddColor(), DoSymbolicName(), DoMonochromeName(), DoGrey4Name(), DoGreyName(), DoColorName(), DoCut(), DoCopy(), DoPaste(), DoCrop(), DoZoomIn(), DoZoomOut(), DoZoomFactor(); void TheCallback(); void MakeMenuPanel(); static XtActionsRec actions_table[] = { {"fix-menu", FixMenu}, {"switch-image", SwitchImage}, {"switch-grid", SwitchGrid}, {"switch-axes", SwitchAxes}, {"switch-proportional", SwitchProportional}, {"switch-zoom", SwitchZoom}, {"zoom-in", DoZoomIn}, {"zoom-out", DoZoomOut}, {"zoom-factor", DoZoomFactor}, {"do-load", DoLoad}, {"do-insert", DoInsert}, {"do-save", DoSave}, {"do-save-as", DoSaveAs}, {"do-resize", DoResize}, {"do-rescale", DoRescale}, {"do-filename", DoFilename}, {"do-hintscmt", DoHintsCmt}, {"do-colorscmt", DoColorsCmt}, {"do-pixelscmt", DoPixelsCmt}, {"do-quit", DoQuit}, {"do-addcolor", DoAddColor}, {"do-symbname", DoSymbolicName}, {"do-mononame", DoMonochromeName}, {"do-grey4name", DoGrey4Name}, {"do-greyname", DoGreyName}, {"do-colorname", DoColorName}, {"do-cut", DoCut}, {"do-copy", DoCopy}, {"do-paste", DoPaste}, {"do-crop", DoCrop} }; static Atom protocols[2]; void client_message(w, tag, event, b) Widget w; XtPointer tag; XEvent *event; Boolean *b; { if (event->xclient.message_type == protocols[1] && event->xclient.data.l[0] == protocols[0]) /* the widget got a kill signal */ { if (w == image_shell) SwitchImage(); } } void unsetKillfromWM(w) Widget w; { /* set WM property to receive a window deletion and avoid getting killed */ protocols[0] = XInternAtom(dpy, "WM_DELETE_WINDOW", True); protocols[1] = XInternAtom(dpy, "WM_PROTOCOLS", True); XSetWMProtocols(dpy, XtWindow(w), protocols, 1); /* add handler to get WM's client message */ XtAddEventHandler(w, ClientMessage, True, (XtEventHandler)client_message, NULL); } void FixColorMenuLabel(old_name, name) char *old_name; char *name; { Widget colorButton; Arg wargs[1]; #ifndef USE_ATHENA XmString xmstr; xmstr = XmStringCreateLtoR(name, CHARSET); XtSetArg(wargs[0], XmNlabelString, xmstr); #else /* USE_ATHENA */ XtSetArg(wargs[0], XtNlabel, name); #endif /* USE_ATHENA */ colorButton = XtNameToWidget( formy_widget, "colorButton" ); XtSetValues( colorButton, wargs, 1 ); #ifndef USE_ATHENA XmStringFree(xmstr); #endif /* USE_ATHENA */ } void colorToAdd(w, pixel, name) Widget w; Pixel pixel; char *name; { Widget wi; int max_colors = 1<= max_colors)) printf( "Warning: Color pixel %d out of bounds for display (pixel range [0->%d]\n", pixel, max_colors-1); else { int *id = (int *)XtMalloc(sizeof(int)); Arg wargs[1]; *id = pixel + Color_offset; /* Two kinds of colors: not transparent and transparent */ if (pixel != TRANSPARENT(dpy, screen)) { #ifndef USE_ATHENA XtSetArg(wargs[0], XmNbackground, pixel); #else /* USE_ATHENA */ XtSetArg(wargs[0], XtNbackground, pixel); #endif /* USE_ATHENA */ #ifdef DEBUG printf("Adding color %d %s to menu\n", pixel, name); #endif /* DEBUG */ #ifndef USE_ATHENA wi = (Widget)XmCreatePushButton(color_pane_widget, name, wargs, 1); XtAddCallback(wi, XmNactivateCallback, TheCallback, id); XtManageChild(wi); #else /* USE_ATHENA */ wi = XtCreateManagedWidget(name, commandWidgetClass, color_pane_widget, wargs, 1); XtAddCallback(wi, XtNcallback, TheCallback, id); #endif /* USE_ATHENA */ } else if (pixel == TRANSPARENT(dpy, screen)) { #ifndef USE_ATHENA XtSetArg(wargs[0], XmNbackground, PWGetTransparentPixel(w)); wi = (Widget)XmCreatePushButton(color_pane_widget, name, wargs, 1); XtAddCallback(wi, XmNactivateCallback, TheCallback, id); XtManageChild(wi); #else /* USE_ATHENA */ XtSetArg(wargs[0], XtNbackground, PWGetTransparentPixel(w)); wi = XtCreateManagedWidget(name, commandWidgetClass, color_pane_widget, wargs, 1); XtAddCallback(wi, XtNcallback, TheCallback, id); #endif /* USE_ATHENA */ } } } void FixImage(w, client_data, call_data) Widget w; XtPointer client_data, call_data; { Pixmap image, image_mask; Window root; unsigned int width, height, border_width, depth; int x, y; if (!image_visible) { #ifndef USE_ATHENA XmToggleButtonGadgetSetState(edit_menu[0].widget, False, False); #endif /* USE_ATHENA */ return; } #ifndef USE_ATHENA else XmToggleButtonGadgetSetState(edit_menu[0].widget, True, False); #endif /* USE_ATHENA */ PWGetUnzoomedPixmap(pixmap_widget, &image, &image_mask); XGetGeometry(XtDisplay(image_widget), image, &root, &x, &y, &width, &height, &border_width, &depth); XResizeWindow(XtDisplay(image_widget), XtWindow(image_shell), width, height); XSetWindowBackgroundPixmap(XtDisplay(pixmap_widget), XtWindow(image_widget), image); if (image_mask) { XShapeCombineMask(XtDisplay(image_widget), XtWindow(image_widget), ShapeBounding, 0, 0, image_mask, ShapeSet); XShapeCombineMask(XtDisplay(pixmap_widget), XtWindow(image_shell), ShapeBounding, 0, 0, image_mask, ShapeSet); } else { XShapeCombineMask(XtDisplay(image_widget), XtWindow(image_widget), ShapeBounding, 0, 0, None, ShapeSet); XShapeCombineMask(XtDisplay(pixmap_widget), XtWindow(image_shell), ShapeBounding, 0, 0, None, ShapeSet); } XClearWindow(XtDisplay(pixmap_widget), XtWindow(image_widget)); XFreePixmap(XtDisplay(pixmap_widget), image); if (image_mask) XFreePixmap(XtDisplay(image_widget), image_mask); } void FixEntry(w, id) Widget w; int *id; { int n; Arg wargs[2]; n = 0; switch (*id) { case Image: #ifndef USE_ATHENA XtSetArg(wargs[n], XmNset, image_visible); n++; #else /* USE_ATHENA */ XtSetArg(wargs[n], XtNleftBitmap, image_visible ? check_mark : None); n++; #endif /* USE_ATHENA */ break; case Grid: #ifndef USE_ATHENA XtSetArg(wargs[n], XmNset, PWQueryGrid(pixmap_widget)); n++; #else /* USE_ATHENA */ XtSetArg(wargs[n], XtNleftBitmap, PWQueryGrid(pixmap_widget) ? check_mark : None); n++; #endif /* USE_ATHENA */ break; case Axes: #ifndef USE_ATHENA XtSetArg(wargs[n], XmNset, PWQueryAxes(pixmap_widget)); n++; #else /* USE_ATHENA */ XtSetArg(wargs[n], XtNleftBitmap, PWQueryAxes(pixmap_widget) ? check_mark : None); n++; #endif /* USE_ATHENA */ break; case Proportional: #ifndef USE_ATHENA XtSetArg(wargs[n], XmNset, PWQueryProportional(pixmap_widget)); n++; #else /* USE_ATHENA */ XtSetArg(wargs[n], XtNleftBitmap, PWQueryProportional(pixmap_widget) ? check_mark : None); n++; #endif /* USE_ATHENA */ break; case Zoom: #ifndef USE_ATHENA XtSetArg(wargs[n], XmNset, PWQueryZooming(pixmap_widget)); n++; #else /* USE_ATHENA */ XtSetArg(wargs[n], XtNleftBitmap, PWQueryZooming(pixmap_widget) ? check_mark : None); n++; #endif /* USE_ATHENA */ break; case Copy: case Cut: #ifndef USE_ATHENA XtSetArg(wargs[n], XmNsensitive, PWQueryMarked(pixmap_widget)); n++; #else /* USE_ATHENA */ XtSetArg(wargs[n], XtNsensitive, PWQueryMarked(pixmap_widget)); n++; #endif /* USE_ATHENA */ break; case Paste: #ifndef USE_ATHENA XtSetArg(wargs[n], XmNsensitive, PWQueryStored(pixmap_widget)); n++; #else /* USE_ATHENA */ XtSetArg(wargs[n], XtNsensitive, PWQueryStored(pixmap_widget)); n++; #endif /* USE_ATHENA */ break; case Crop: #ifndef USE_ATHENA XtSetArg(wargs[n], XmNsensitive, PWQueryMarked(pixmap_widget) || PWQueryStored(pixmap_widget)); n++; #else /* USE_ATHENA */ XtSetArg(wargs[n], XtNsensitive, PWQueryMarked(pixmap_widget) || PWQueryStored(pixmap_widget)); n++; #endif /* USE_ATHENA */ break; default: return; } XtSetValues(w, wargs, n); } void FixMenu(w, event) Widget w; XEvent *event; { int i; for (i = 0; i < XtNumber(edit_menu); i++) FixEntry(edit_menu[i].widget, &edit_menu[i].id); } #ifndef USE_ATHENA void FixMenuCB(w, client_data, call_data) Widget w; XtPointer client_data, call_data; { FixMenu(w, NULL); } #endif /* USE_ATHENA */ void FixStatus() { int n; Arg wargs[2]; String str; #ifndef USE_ATHENA char *fn; XmString xmstr; #endif /* USE_ATHENA */ str = PWUnparseStatus(pixmap_widget); n = 0; #ifndef USE_ATHENA fn = str; while ((*str != ' ') || (*(str-1) == ':')) str++; *str = 0; xmstr = XmStringCreateLtoR(fn, XmSTRING_DEFAULT_CHARSET); XtSetArg(wargs[n], XmNlabelString, xmstr); n++; XtSetValues(status_widget, wargs, n); XmStringFree(xmstr); *str++ = ' '; n = 0; xmstr = XmStringCreateLtoR(str, XmSTRING_DEFAULT_CHARSET); XtSetArg(wargs[n], XmNlabelString, xmstr); n++; XtSetValues(statusb_widget, wargs, n); XmStringFree(xmstr); #else /* USE_ATHENA */ XtSetArg(wargs[n], XtNlabel, str); n++; XtSetValues(status_widget, wargs, n); #endif /* USE_ATHENA */ } void FixColor(w, current) Widget w; Pixel current; { Widget colorButton; Arg wargs[1]; PWColorInfo *color; #ifndef USE_ATHENA XmString xmstr; #endif /* USE_ATHENA */ current_color = current; color = PWGetColor(w, current); #ifndef USE_ATHENA xmstr = XmStringCreateLtoR(color->c_name, CHARSET); XtSetArg(wargs[0], XmNlabelString, xmstr); #else /* USE_ATHENA */ XtSetArg(wargs[0], XtNlabel, color->c_name); #endif /* USE_ATHENA */ colorButton = XtNameToWidget( formy_widget, "colorButton" ); XtSetValues( colorButton, wargs, 1 ); #ifndef USE_ATHENA XmStringFree(xmstr); #endif /* USE_ATHENA */ } static int zero = 0; #define Plain (XtPointer)&zero,(Cardinal)sizeof(int) void TheCallback(w, client_data, call_data) Widget w; XtPointer client_data, call_data; { int *id = (int *)client_data; switch (*id) { case Load: DoLoad(); break; case Insert: DoInsert(); break; case Save: DoSave(); break; case SaveAs: DoSaveAs(); break; case Filename: DoFilename(); break; case Hints: DoHintsCmt(); break; case Colors: DoColorsCmt(); break; case Pixels: DoPixelsCmt(); break; case Quit: DoQuit(); break; case ColorPixel: DoAddColor(); break; case ColorSname: DoSymbolicName(); break; case ColorMname: DoMonochromeName(); break; case ColorG4name: DoGrey4Name(); break; case ColorGname: DoGreyName(); break; case ColorCname: DoColorName(); break; case Image: SwitchImage(); break; case Grid: SwitchGrid(); break; case Axes: SwitchAxes(); break; case Proportional: SwitchProportional(); break; case Zoom: SwitchZoom(); break; case ZoomIn: DoZoomIn(); break; case ZoomOut: DoZoomOut(); break; case ZoomFactor: DoZoomFactor(); break; case Resize: DoResize(); break; case Rescale: DoRescale(); break; case Copy: DoCopy(); break; case Cut: DoCut(); break; case Paste: DoPaste(); break; case Crop: DoCrop(); break; case Clear: PWStoreToBuffer(pixmap_widget); PWClear(pixmap_widget); PWChangeNotify(pixmap_widget, NULL, NULL); PWSetChanged(pixmap_widget); break; case Set: PWStoreToBuffer(pixmap_widget); PWSet(pixmap_widget); PWChangeNotify(pixmap_widget, NULL, NULL); PWSetChanged(pixmap_widget); break; case Redraw: PWRedraw(pixmap_widget); FixImage(pixmap_widget, NULL, NULL); break; case CopyImm: PWRemoveAllRequests(pixmap_widget); if (PWQueryMarked(pixmap_widget)) { PWAddRequest(pixmap_widget, MarkRequest, False, Plain); PWEngageRequest(pixmap_widget, CopyRequest, True, Plain); } else { PWEngageRequest(pixmap_widget, MarkRequest, False, Plain); PWAddRequest(pixmap_widget, CopyRequest, True, Plain); } break; case MoveImm: PWRemoveAllRequests(pixmap_widget); if (PWQueryMarked(pixmap_widget)) { PWAddRequest(pixmap_widget, MarkRequest, False, Plain); PWEngageRequest(pixmap_widget, MoveRequest, True, Plain); } else { PWEngageRequest(pixmap_widget, MarkRequest, False, Plain); PWAddRequest(pixmap_widget, MoveRequest, True, Plain); } break; case MarkImm: PWRemoveAllRequests(pixmap_widget); PWEngageRequest(pixmap_widget, MarkRequest, True, Plain); break; case UnmarkImm: PWUnmark((Widget)pixmap_widget); break; case Up: PWStoreToBuffer(pixmap_widget); PWUp(pixmap_widget); PWChangeNotify(pixmap_widget, NULL, NULL); PWSetChanged(pixmap_widget); break; case Down: PWStoreToBuffer(pixmap_widget); PWDown(pixmap_widget); PWChangeNotify(pixmap_widget, NULL, NULL); PWSetChanged(pixmap_widget); break; case Left: PWStoreToBuffer(pixmap_widget); PWLeft(pixmap_widget); PWChangeNotify(pixmap_widget, NULL, NULL); PWSetChanged(pixmap_widget); break; case Right: PWStoreToBuffer(pixmap_widget); PWRight(pixmap_widget); PWChangeNotify(pixmap_widget, NULL, NULL); PWSetChanged(pixmap_widget); break; case Fold: PWStoreToBuffer(pixmap_widget); PWFold(pixmap_widget); PWChangeNotify(pixmap_widget, NULL, NULL); PWSetChanged(pixmap_widget); break; case FlipHoriz: PWStoreToBuffer(pixmap_widget); PWFlipHoriz(pixmap_widget); PWChangeNotify(pixmap_widget, NULL, NULL); PWSetChanged(pixmap_widget); break; case FlipVert: PWStoreToBuffer(pixmap_widget); PWFlipVert(pixmap_widget); PWChangeNotify(pixmap_widget, NULL, NULL); PWSetChanged(pixmap_widget); break; case RotateRight: PWStoreToBuffer(pixmap_widget); PWRotateRight(pixmap_widget); PWChangeNotify(pixmap_widget, NULL, NULL); PWSetChanged(pixmap_widget); break; case RotateLeft: PWStoreToBuffer(pixmap_widget); PWRotateLeft(pixmap_widget); PWChangeNotify(pixmap_widget, NULL, NULL); PWSetChanged(pixmap_widget); break; case Point: PWRemoveAllRequests(pixmap_widget); PWEngageRequest(pixmap_widget, PointRequest, True, Plain); break; case Curve: PWRemoveAllRequests(pixmap_widget); PWEngageRequest(pixmap_widget, CurveRequest, True, Plain); break; case Line: PWRemoveAllRequests(pixmap_widget); PWEngageRequest(pixmap_widget, LineRequest, True, Plain); break; case Rectangle: PWRemoveAllRequests(pixmap_widget); PWEngageRequest(pixmap_widget, RectangleRequest, True, Plain); break; case FilledRectangle: PWRemoveAllRequests(pixmap_widget); PWEngageRequest(pixmap_widget, FilledRectangleRequest, True, Plain); break; case Circle: PWRemoveAllRequests(pixmap_widget); PWEngageRequest(pixmap_widget, CircleRequest, True, Plain); break; case FilledCircle: PWRemoveAllRequests(pixmap_widget); PWEngageRequest(pixmap_widget, FilledCircleRequest, True, Plain); break; case FloodFill: PWRemoveAllRequests(pixmap_widget); PWEngageRequest(pixmap_widget, FloodFillRequest, True, Plain); break; case Text: PopupTextOptions( w, textOptions ); PWRemoveAllRequests(pixmap_widget); PWEngageRequest(pixmap_widget, TextRequest, True, Plain); break; case SetHotSpot: PWRemoveAllRequests(pixmap_widget); PWEngageRequest(pixmap_widget, HotSpotRequest, True, Plain); break; case ClearHotSpot: PWStoreToBuffer(pixmap_widget); PWClearHotSpot(pixmap_widget); PWChangeNotify(pixmap_widget, NULL, NULL); PWSetChanged(pixmap_widget); break; case Undo: PWUndo(pixmap_widget); #ifdef USE_ATHENA PWRedraw(pixmap_widget); #endif /* USE_ATHENA */ PWChangeNotify(pixmap_widget, NULL, NULL); PWSetChanged(pixmap_widget); FixStatus(); break; case Color: /* Start of colors management */ default: /* Don't change this default section: color management */ PWSetForeground(pixmap_widget,(*id - Color_offset)); FixColor(pixmap_widget, *id - Color_offset); break; } } void DoLoad() { int status; if (PWQueryChanged(pixmap_widget)) { PWGetFilename(pixmap_widget, &filename); RetryLoadSave: switch (PopupDialog(qsave_dialog, "Save file before loading?", filename, &filename, XtGrabExclusive)) { case Yes: status = PWWriteFile(pixmap_widget, filename); if (status != XpmSuccess) { sprintf(message, "Can't write file: %s - %s", filename, XpmGetErrorString(status)); if (PopupDialog(error_dialog, message, NULL, NULL, XtGrabExclusive) == Retry) goto RetryLoadSave; } break; case Cancel: return; } } PWGetFilepath(pixmap_widget, &filename); RetryLoad: if (PopupFDialog(file_dialog, "Load file:", #ifndef USE_ATHENA filename, &filename, XtGrabExclusive) == Okay) { #else /* USE_ATHENA */ filename, &filename, "r") == Okay) { #endif /* USE_ATHENA */ status = PWReadFile(pixmap_widget, filename); if (status != XpmSuccess) { sprintf(message, "Can't read file: %s - %s", filename, XpmGetErrorString(status)); if (PopupDialog(error_dialog, message, NULL, NULL, XtGrabExclusive) == Retry) goto RetryLoad; } else { PWChangeNotify(pixmap_widget, NULL, NULL); PWClearChanged(pixmap_widget); FixStatus(); } } } void DoInsert() { PWGetFilepath(pixmap_widget, &filename); RetryInsert: #ifndef USE_ATHENA if (PopupFDialog(file_dialog, "Insert file:", filename, &filename, XtGrabExclusive) == Okay) { #else /* USE_ATHENA */ if (PopupFDialog(file_dialog, "Insert file:", filename, &filename, "r") == Okay) { #endif /* USE_ATHENA */ if (PWStoreFile(pixmap_widget, filename) != XpmSuccess) { sprintf(message, "Can't read file: %s", filename); if (PopupDialog(error_dialog, message, NULL, NULL, XtGrabExclusive) == Retry) goto RetryInsert; } else { PWEngageRequest(pixmap_widget, RestoreRequest, False, Plain); } } } void DoSave() { PWGetFilename(pixmap_widget, &filename); if (PWWriteFile(pixmap_widget, filename) != XpmSuccess) { sprintf(message, "Can't write file: %s", filename); if (PopupDialog(error_dialog, message, NULL, NULL, XtGrabExclusive) == Retry) DoSaveAs(); } else { PWClearChanged(pixmap_widget); } } void DoSaveAs() { PWGetFilename(pixmap_widget, &filename); RetrySave: #ifndef USE_ATHENA if (PopupFDialog(file_dialog, "Save file:", filename, &filename, XtGrabExclusive) == Okay) { #else /* USE_ATHENA */ if (PopupFDialog(file_dialog, "Save file:", filename, &filename, "w") == Okay) { #endif /* USE_ATHENA */ if (PWWriteFile(pixmap_widget, filename) != XpmSuccess) { sprintf(message, "Can't write file: %s", filename); if (PopupDialog(error_dialog, message, NULL, NULL, XtGrabExclusive) == Retry) goto RetrySave; } else { PWClearChanged(pixmap_widget); FixStatus(); } } } void DoFilename() { PWGetFilename(pixmap_widget, &filename); #ifndef USE_ATHENA if (PopupFDialog(file_dialog, "Change filename:", filename, &filename, XtGrabExclusive) == Okay) { #else /* USE_ATHENA */ if (PopupFDialog(file_dialog, "Change filename:", filename, &filename, "w") == Okay) { #endif /* USE_ATHENA */ PWChangeFilename(pixmap_widget, filename); FixStatus(); } } void DoHintsCmt() { PWComments(pixmap_widget, &hints_cmt, &colors_cmt, &pixels_cmt); if (PopupDialog(input_dialog, "Pixmap hints comment:", (hints_cmt ? hints_cmt : ""), &hints_cmt, XtGrabExclusive) == Okay) PWComments(pixmap_widget, &hints_cmt, &colors_cmt, &pixels_cmt); #ifndef USE_ATHENA /* R6 Athena also frees memory */ if (hints_cmt) XtFree(hints_cmt); #endif /* USE_ATHENA */ if (colors_cmt) XtFree(colors_cmt); if (pixels_cmt) XtFree(pixels_cmt); hints_cmt = 0; colors_cmt = 0; pixels_cmt = 0; } void DoColorsCmt() { PWComments(pixmap_widget, &hints_cmt, &colors_cmt, &pixels_cmt); if (PopupDialog(input_dialog, "Pixmap colors comment:", (colors_cmt ? colors_cmt : ""), &colors_cmt, XtGrabExclusive) == Okay) PWComments(pixmap_widget, &hints_cmt, &colors_cmt, &pixels_cmt); if (hints_cmt) XtFree(hints_cmt); #ifndef USE_ATHENA /* R6 Athena also frees memory */ if (colors_cmt) XtFree(colors_cmt); #endif /* USE_ATHENA */ if (pixels_cmt) XtFree(pixels_cmt); hints_cmt = 0; colors_cmt = 0; pixels_cmt = 0; } void DoPixelsCmt() { PWComments(pixmap_widget, &hints_cmt, &colors_cmt, &pixels_cmt); if (PopupDialog(input_dialog, "Pixmap pixels comment:", (pixels_cmt ? pixels_cmt : ""), &pixels_cmt, XtGrabExclusive) == Okay) PWComments(pixmap_widget, &hints_cmt, &colors_cmt, &pixels_cmt); if (hints_cmt) XtFree(hints_cmt); if (colors_cmt) XtFree(colors_cmt); #ifndef USE_ATHENA /* R6 Athena also frees memory */ if (pixels_cmt) XtFree(pixels_cmt); #endif /* USE_ATHENA */ hints_cmt = 0; colors_cmt = 0; pixels_cmt = 0; } void DoQuit() { if (PWQueryChanged(pixmap_widget)) { PWGetFilename(pixmap_widget, &filename); RetryQuit: switch (PopupDialog(qsave_dialog, "Save file before quitting?", filename, &filename, XtGrabExclusive)) { case Yes: if (PWWriteFile(pixmap_widget, filename) != XpmSuccess) { sprintf(message, "Can't write file: %s", filename); if (PopupDialog(error_dialog, message, NULL, NULL, XtGrabExclusive) == Retry) goto RetryQuit; else return; } break; case Cancel: return; } } exit(0); } void DoAddColor() { char *cname; if (PopupDialog(input_dialog, "Color name (name or #rgb) to add:", "", &cname, XtGrabExclusive) == Okay) { XColor xcolor; if ((!XParseColor(dpy, cmap, cname, &xcolor)) || (!XAllocColor(dpy, cmap, &xcolor))) { fprintf(stderr, "Warning: color %s could not be parsed/allocated!", cname); } else if (PWGetColor(pixmap_widget, xcolor.pixel) == NULL) { PWUseColorInTable(pixmap_widget, xcolor.pixel, NULL, NULL, NULL, NULL, NULL, cname); } } } void DoSymbolicName() { char *s_name; char message[80]; PWColorInfo *color = PWGetColor(pixmap_widget, current_color); sprintf(message, "Color `%s' [%d] symbolic name:", color->c_name, current_color); if (PopupDialog(input_dialog, message, (color->s_name ? color->s_name : ""), &s_name, XtGrabExclusive) == Okay) PWUpdateColorInTable(pixmap_widget, current_color, color->symbol, s_name, color->m_name, color->g4_name, color->g_name, color->c_name); } void DoMonochromeName() { char *m_name; char message[80]; PWColorInfo *color = PWGetColor(pixmap_widget, current_color); sprintf(message, "Color `%s' [%d] monochrome display name:", color->c_name, current_color); if (PopupDialog(input_dialog, message, (color->m_name ? color->m_name : ""), &m_name, XtGrabExclusive) == Okay) { XColor xcolor; if (!XParseColor(dpy, cmap, m_name, &xcolor)) { fprintf(stderr, "Warning: color %s could not be parsed!\n", m_name); } else PWUpdateColorInTable(pixmap_widget, current_color, color->symbol, color->s_name, m_name, color->g4_name, color->g_name, color->c_name); } } void DoGrey4Name() { char *g4_name; char message[80]; PWColorInfo *color = PWGetColor(pixmap_widget, current_color); sprintf(message, "Color `%s' [%d] grey scale 4 display name:", color->c_name, current_color); if (PopupDialog(input_dialog, message, (color->g4_name ? color->g4_name : ""), &g4_name, XtGrabExclusive) == Okay) { XColor xcolor; if (!XParseColor(dpy, cmap, g4_name, &xcolor)) { fprintf(stderr, "Warning: color %s could not be parsed!\n", g4_name); } else PWUpdateColorInTable(pixmap_widget, current_color, color->symbol, color->s_name, color->m_name, g4_name, color->g_name, color->c_name); } } void DoGreyName() { char *g_name; char message[80]; PWColorInfo *color = PWGetColor(pixmap_widget, current_color); sprintf(message, "Color `%s' [%d] grey scale display name:", color->c_name, current_color); if (PopupDialog(input_dialog, message, (color->g_name ? color->g_name : ""), &g_name, XtGrabExclusive) == Okay) { XColor xcolor; if (!XParseColor(dpy, cmap, g_name, &xcolor)) { fprintf(stderr, "Warning: color %s could not be parsed!\n", g_name); } else PWUpdateColorInTable(pixmap_widget, current_color, color->symbol, color->s_name, color->m_name, color->g4_name, g_name, color->c_name); } } void DoColorName() { char *c_name; char message[80]; PWColorInfo *color = PWGetColor(pixmap_widget, current_color); sprintf(message, "Color `%s' [%d] color display name:", color->c_name, current_color); /* RetryColorCname: */ if ((PopupDialog(input_dialog, message, (color->c_name ? color->c_name : ""), &c_name, XtGrabExclusive) == Okay) && (c_name)) { XColor xcolor; /* if (strcasecmp(c_name, NoColorName) == 0) { if (PopupDialog(error_dialog, "Can't rename color to None", NULL, NULL, XtGrabExclusive) == Retry) goto RetryColorCname; } else*/ if ((strcasecmp(c_name, NoColorName) != 0) && (!XParseColor(dpy, cmap, c_name, &xcolor))) { fprintf(stderr, "Warning: color %s could not be parsed!\n", c_name); } else { FixColorMenuLabel(color->c_name, c_name); PWUpdateColorInTable(pixmap_widget, current_color, color->symbol, color->s_name, color->m_name, color->g4_name, color->g_name, c_name); } } } void SwitchImage() { if (image_visible) { XtPopdown(image_shell); image_visible = False; } else { Position image_x, image_y; int n; Arg wargs[3]; XtTranslateCoords(XtParent(pixmap_widget), 10, 10, &image_x, &image_y); n = 0; XtSetArg(wargs[n], XtNx, image_x); n++; XtSetArg(wargs[n], XtNy, image_y); n++; XtSetValues(image_shell, wargs, n); image_visible = True; XtPopup(image_shell, XtGrabNone); unsetKillfromWM(image_shell); FixImage(pixmap_widget, NULL, NULL); } } void SwitchGrid() { PWSwitchGrid(pixmap_widget); } void SwitchAxes() { PWSwitchAxes(pixmap_widget); } void SwitchProportional() { PWSwitchProportional(pixmap_widget); } void SwitchZoom() { if (PWQueryZooming(pixmap_widget)) { PWZoomOut(pixmap_widget); PWChangeNotify(pixmap_widget, NULL, NULL); } else { if (PWQueryMarked(pixmap_widget)) { PWStoreToBuffer(pixmap_widget); PWZoomMarked(pixmap_widget); PWChangeNotify(pixmap_widget, NULL, NULL); } else { PWEngageRequest(pixmap_widget, ZoomInRequest, False, Plain); } } } void DoZoomIn() { Dimension square_size, inc = 2; Arg args[2]; XtSetArg(args[0], XtNsquareSize, &square_size); XtGetValues(pixmap_widget, args, 1); square_size += inc; XtSetArg(args[0], XtNsquareSize, square_size); XtSetValues(pixmap_widget, args, 1); #ifdef USE_ATHENA PWRedraw(pixmap_widget); #endif /* USE_ATHENA */ } void DoZoomOut() { Dimension square_size, inc = 2; Arg args[2]; XtSetArg(args[0], XtNsquareSize, &square_size); XtGetValues(pixmap_widget, args, 1); square_size -= inc; if (square_size > 0) { XtSetArg(args[0], XtNsquareSize, square_size); XtSetValues(pixmap_widget, args, 1); #ifdef USE_ATHENA PWRedraw(pixmap_widget); #endif /* USE_ATHENA */ } } void DoZoomFactor() { Dimension square_size; Arg args[2]; char message[80], buffer[80], *returned; XtSetArg(args[0], XtNsquareSize, &square_size); XtGetValues(pixmap_widget, args, 1); sprintf(buffer, "%d", square_size); strcpy(message, "Set Zoom Factor:"); if ((PopupDialog(input_dialog, message, buffer, &returned, XtGrabExclusive) == Okay) && (returned)) { if ((square_size = atoi(returned)) > 0) { XtSetArg(args[0], XtNsquareSize, square_size); XtSetValues(pixmap_widget, args, 1); #ifdef USE_ATHENA PWRedraw(pixmap_widget); #endif /* USE_ATHENA */ } } } void DoResize() { char x; int width, height; format = ""; RetryResize: if (PopupDialog(input_dialog, "Resize to WIDTHxHEIGHT:", format, &format, XtGrabExclusive) == Okay) { sscanf(format, "%d%c%d", &width, &x, &height); if ((width >0) && (height > 0) && (x == 'x')) { PWStoreToBuffer(pixmap_widget); PWResize(pixmap_widget, (Dimension)width, (Dimension)height); PWChangeNotify(pixmap_widget, NULL, NULL); PWSetChanged(pixmap_widget); FixStatus(); } else { sprintf(message, "Wrong format: %s", format); if (PopupDialog(error_dialog, message, NULL, NULL, XtGrabExclusive) == Retry) goto RetryResize; } } } void DoRescale() { char x; int width, height; format = ""; RetryRescale: if (PopupDialog(input_dialog, "Rescale to WIDTHxHEIGHT:", format, &format, XtGrabExclusive) == Okay) { sscanf(format, "%d%c%d", &width, &x, &height); if ((width >0) && (height > 0) && (x == 'x')) { PWStoreToBuffer(pixmap_widget); PWRescale(pixmap_widget, (Dimension)width, (Dimension)height); PWChangeNotify(pixmap_widget, NULL, NULL); PWSetChanged(pixmap_widget); FixStatus(); } else { sprintf(message, "Wrong format: %s", format); if (PopupDialog(error_dialog, message, NULL, NULL, XtGrabExclusive) == Retry) goto RetryRescale; } } } void DoCut() { PWStore(pixmap_widget); PWStoreToBuffer(pixmap_widget); PWClearMarked(pixmap_widget); PWUnmark(pixmap_widget); PWChangeNotify(pixmap_widget, NULL, NULL); } void DoCopy() { PWStore(pixmap_widget); PWUnmark(pixmap_widget); } void DoPaste() { PWEngageRequest(pixmap_widget, RestoreRequest, False, Plain); } void DoCrop() { if (!PWQueryMarked(pixmap_widget) && !PWQueryStored(pixmap_widget)) return; PWStoreToBuffer(pixmap_widget); PWRotateBufferAndImage(pixmap_widget); #ifdef USE_ATHENA PWRedraw(pixmap_widget); #endif /* USE_ATHENA */ } void InfoCallback() { if (info_str == NULL) { info_str = XtMalloc((strlen(info) + 1) * sizeof(char)); sprintf(info_str, info, PATCHLEVEL); } PopupDialog(info_dialog, info_str, NULL, NULL, XtGrabExclusive); } #include "PortEdit.c" #include "ExtEdit.c" /* PixmapWidget callback for drawing a point */ #if NeedFunctionPrototypes void DrawPointExtensions(Widget w, Position x, Position y, int value ) #else void DrawPointExtensions( w, x, y, value ) Widget w; Position x; Position y; int value; #endif { DrawIfPort( w, x, y, value ); } /* PixmapWidget callback for redrawing/refreshing everything */ #if NeedFunctionPrototypes void DrawExtensions(Widget w, int value ) #else void DrawExtensions( w, value ) Widget w; int value; #endif { RedrawPorts( w, value ); } /* PixmapWidget callback for translating by dx, dy */ #if NeedFunctionPrototypes void TranslateExtensions(Widget w, Position dx, Position dy ) #else void TranslateExtensions( w, dx, dy ) Widget w; Position dx; Position dy; #endif { TranslatePorts( w, dx, dy ); } /* PixmapWidget callback for rotating right/left */ #if NeedFunctionPrototypes void RotateExtensions(Widget w, enum RotateDirection direction ) #else void RotateExtensions( w, direction ) Widget w; enum RotateDirection direction; #endif { RotatePorts( w, direction ); } /* PixmapWidget callback for flipping horizontal/vertical */ #if NeedFunctionPrototypes void FlipExtensions(Widget w, enum FlipAxis axis ) #else void FlipExtensions( w, axis ) Widget w; enum FlipAxis axis; #endif { FlipPorts( w, axis ); } /* loading pixmap editors colors */ void loadPixEditColors() { FILE *colorfile; static char *fname = ".pixmap"; char filename[256]; /* first try to open in local dir */ if (!(colorfile = fopen(fname, "r"))) { /* try in homedir */ sprintf(filename, "%s/%s", getenv("HOME"), fname); if (!(colorfile = fopen(filename, "r"))) { /* try in X11 lib dir */ sprintf(filename, "%s/%s", APPDEFDIR , fname); colorfile = fopen(filename, "r"); } } if (colorfile) { /* parse it, i.e., read name, try to alloc in cmap, add menu entry */ char cname[512]; int status; XColor xcolor; while ((status = fscanf(colorfile,"%[^\n]\n", cname)) && (status != EOF)) { if (!XParseColor(dpy, cmap, cname, &xcolor)) continue; if (!XAllocColor(dpy, cmap, &xcolor)) { fprintf(stderr, "Warning: color %s could not be allocated!\n", cname); continue; } else { PWUseColorInTable(pixmap_widget, xcolor.pixel, NULL, NULL, NULL, NULL, NULL, cname); } } fclose(colorfile); } else { /* allocate black in colormap */ PWUseColorInTable(pixmap_widget, black, NULL, NULL, NULL, NULL, NULL, "black"); } } void MakeMenuPanel(father, menu, num, callback) Widget father; ButtonRec menu[]; Cardinal num; XtCallbackProc callback; { Widget bw; int i; for (i = 0; i < num; i++) { #ifndef USE_ATHENA if (menu[i].id == Dummy) bw = XmCreateSeparatorGadget(father, menu[i].name, NULL, 0); else if (menu[i].trap == TOGGLE) { bw = XmCreateToggleButtonGadget(father, menu[i].name, NULL, 0); XtAddCallback(bw, XmNvalueChangedCallback, callback, (XtPointer)&menu[i].id); } else { bw = XmCreatePushButtonGadget(father, menu[i].name, NULL, 0); XtAddCallback(bw, XmNactivateCallback, callback, (XtPointer)&menu[i].id); } menu[i].widget = bw; XtManageChild(bw); #else /* USE_ATHENA */ bw = XtCreateManagedWidget( menu[i].name, ((menu[i].id != Dummy) ? smeBSBObjectClass : smeLineObjectClass), father, NULL, 0); XtAddCallback( bw, XtNcallback, callback, (XtPointer) &menu[i].id ); menu[i].widget = bw; #endif /* USE_ATHENA */ } } static Widget MakeMenu( menubar, menuName, buttonName, menu, num, callback ) Widget menubar; String menuName; String buttonName; ButtonRec menu[]; Cardinal num; XtCallbackProc callback; { Widget mw; Widget bw; #ifndef USE_ATHENA Arg wargs[1]; mw = XmCreatePulldownMenu(menubar, menuName, NULL, 0); XtSetArg(wargs[0], XmNsubMenuId, mw); bw = XmCreateCascadeButtonGadget(menubar, buttonName, wargs, 1); XtManageChild(bw); if (menu == edit_menu) XtAddCallback(bw, XmNcascadingCallback, FixMenuCB, NULL); #else /* USE_ATHENA */ mw = XtCreatePopupShell( menuName, simpleMenuWidgetClass, menubar, NULL, 0 ); bw = XtCreateManagedWidget( buttonName, menuButtonWidgetClass, menubar, NULL, 0 ); #endif /* USE_ATHENA */ MakeMenuPanel(mw, menu, num, callback); return mw; } void main(argc, argv) int argc; char *argv[]; { int i, n; Arg wargs[5]; Widget w, pview_widget, cview_widget, vpane_widget; #ifndef USE_ATHENA Widget formh; static int Resize_id = Resize, Filename_id = Filename; #else /* USE_ATHENA */ Widget radio_group; XtPointer radio_data; #endif /* USE_ATHENA */ int x, y; unsigned int width = 0, height = 0; Resources resources; top_widget = XtAppInitialize(&pixmap_context, "Pixmap", options, XtNumber(options), &argc, argv, NULL, NULL, 0); XtGetApplicationResources(top_widget, &resources, appResources, XtNumber(appResources), NULL, 0); #ifndef USE_ATHENA #ifndef NO_EDITRES XtAddEventHandler(top_widget, 0, True, _XEditResCheckMessages, NULL); #endif #endif /* USE_ATHENA */ if (argc > 1) { if ((argc ==3) && (strcmp(argv[1], "-size") == 0)) XParseGeometry(argv[2], &x, &y, &width, &height); else { fprintf(stderr, "%s %s", argv[0], usage); exit (-1); } } /* some intializations */ dpy = XtDisplay(top_widget); screen = DefaultScreen(dpy); ncolors = 1< 1001 /* Motif 1.2 or > */ /* Disable Motif 1.2 drag and drop */ XtVaSetValues(XmGetXmDisplay(dpy), XmNdragInitiatorProtocolStyle, XmDRAG_NONE, NULL); #endif #endif /* USE_ATHENA */ XtAppAddActions(pixmap_context, actions_table, XtNumber(actions_table)); #ifndef USE_ATHENA parent_widget = XtCreateWidget("parent", xmFormWidgetClass, top_widget, NULL, 0); formy_widget = XmCreateMenuBar(parent_widget, "formy", NULL, 0); #else /* USE_ATHENA */ parent_widget = XtCreateWidget("parent", panedWidgetClass, top_widget, NULL, 0); formy_widget = XtCreateWidget("formy", formWidgetClass, parent_widget, NULL, 0); #endif /* USE_ATHENA */ MakeMenu(formy_widget, "fileMenu", "fileButton", file_menu, XtNumber(file_menu), TheCallback); MakeMenu(formy_widget, "editMenu", "editButton", edit_menu, XtNumber(edit_menu), TheCallback ); MakeMenu(formy_widget, "colorMenu", "colorButton", color_menu, XtNumber(color_menu), TheCallback ); extensionMenu_widget = MakeMenu(formy_widget, "extensionMenu", "extensionButton", extension_menu, XtNumber(extension_menu), ExtensionMenuCallback); #ifndef USE_ATHENA status_widget = XmCreateCascadeButtonGadget(formy_widget, "status", NULL, 0); XtManageChild(status_widget); XtAddCallback(status_widget, XmNactivateCallback, TheCallback, &Filename_id); statusb_widget = XmCreateCascadeButtonGadget(formy_widget, "statusb", NULL, 0); XtManageChild(statusb_widget); XtAddCallback(statusb_widget, XmNactivateCallback, TheCallback, &Resize_id); infoButton_widget = XmCreateCascadeButtonGadget(formy_widget, "infoButton", NULL, 0); XtManageChild(infoButton_widget); XtVaSetValues(formy_widget, XmNmenuHelpWidget, infoButton_widget, NULL, NULL); XtAddCallback(infoButton_widget, XmNactivateCallback, (XtCallbackProc)InfoCallback, NULL); n = 0; XtSetArg(wargs[n], XmNtopAttachment, XmATTACH_WIDGET); n++; XtSetArg(wargs[n], XmNtopWidget, formy_widget); n++; pane_widget = XmCreateForm(parent_widget, "pane", wargs, n); form_widget = XmCreateRadioBox(pane_widget, "form", NULL, 0); XtSetArg(wargs[0], XmNisHomogeneous, False); XtSetValues(form_widget, wargs, 1); for (i = 0; i < XtNumber(buttons); i++) { if (buttons[i].trap == TOGGLE) { w = XmCreateToggleButtonGadget(form_widget, buttons[i].name, NULL, 0); XtAddCallback(w, XmNvalueChangedCallback, TheCallback, &buttons[i].id); } else { if ((!strcmp(buttons[i].name, "flipHoriz")) || (!strcmp(buttons[i].name, "left")) || (!strcmp(buttons[i].name, "rotateLeft"))) { formh = form_widget; form_widget = XmCreateRowColumn(formh, "formh", NULL, 0); XtManageChild(form_widget); } w = XmCreatePushButtonGadget(form_widget, buttons[i].name, NULL, 0); XtAddCallback(w, XmNactivateCallback, TheCallback, &buttons[i].id); if ((!strcmp(buttons[i].name, "flipVert")) || (!strcmp(buttons[i].name, "right")) || (!strcmp(buttons[i].name, "rotateRight"))) form_widget = formh; } buttons[i].widget = w; XtManageChild(w); if (buttons[i].id == Point) XmToggleButtonGadgetSetState(buttons[i].widget, True, False); } n = 0; XtSetArg(wargs[n], XmNleftAttachment, XmATTACH_WIDGET); n++; XtSetArg(wargs[n], XmNleftWidget, form_widget); n++; vpane_widget = (Widget) XmCreatePanedWindow(pane_widget, "vPane", wargs, n); /* the color pane should be created before the pixmap widget as the creation of the pixmap widget will ``add'' a new color in the pane */ n = 0; cview_widget = (Widget)XmCreateScrolledWindow(vpane_widget, "colorView", wargs, n); n = 0; color_pane_widget = XmCreateRowColumn(cview_widget, "colorPane", wargs, n); XmScrolledWindowSetAreas(cview_widget, XmCreateScrollBar(cview_widget, "cviewHS", NULL, 0), XmCreateScrollBar(cview_widget, "cviewVS", NULL, 0), color_pane_widget); n = 0; pview_widget = (Widget)XmCreateScrolledWindow(vpane_widget, "pixmapView", wargs, n); #else /* USE_ATHENA */ infoButton_widget = XtCreateManagedWidget("infoButton", commandWidgetClass, formy_widget, NULL, 0); status_widget = XtCreateManagedWidget("status", labelWidgetClass, formy_widget, NULL, 0); XtAddCallback(infoButton_widget, XtNcallback, InfoCallback, NULL); pane_widget = XtCreateWidget("pane", panedWidgetClass, parent_widget, NULL, 0); form_widget = XtCreateWidget("form", formWidgetClass, pane_widget, NULL, 0); for (i = 0; i < XtNumber(buttons); i++) { w = XtCreateManagedWidget(buttons[i].name, ((buttons[i].trap == TOGGLE) ? toggleWidgetClass : commandWidgetClass), form_widget, NULL, 0); XtAddCallback(w, XtNcallback, TheCallback, &buttons[i].id); buttons[i].widget = w; if (buttons[i].id == Point) { radio_group = buttons[i].widget; radio_data = buttons[i].name; } } vpane_widget = XtCreateWidget("vPane", panedWidgetClass, pane_widget, NULL, 0); /* the color pane should be created before the pixmap widget as the creation of the pixmap widget will ``add'' a new color in the pane */ cview_widget = XtCreateWidget("colorView", viewportWidgetClass, vpane_widget, NULL, 0); color_pane_widget = XtCreateWidget("colorPane", boxWidgetClass, cview_widget, NULL, 0); pview_widget = XtCreateWidget("pixmapView", viewportWidgetClass, vpane_widget, NULL, 0); #endif /* USE_ATHENA */ /* foreach extension editor, create and manage editor buttons */ CreatePortEditorButtons(form_widget, #ifndef USE_ATHENA NULL); #else /* USE_ATHENA */ radio_group); #endif /* USE_ATHENA */ ManagePortEditorButtons(True); n = 0; XtSetArg(wargs[n], XtNaddColorNtfyProc, (AddColorNotifyProc)colorToAdd); n++; XtSetArg(wargs[n], XtNextensionNtfyProc, (ExtensionNotifyProc)FixExtensionMenu); n++; if (width) XtSetArg(wargs[n], XtNpixmapWidth, width), n++; if (height) XtSetArg(wargs[n], XtNpixmapHeight, height), n++; pixmap_widget = XtCreateManagedWidget("pixmap", pixmapWidgetClass, pview_widget, wargs, n); /* register extension callbacks with pixmap widget */ PWSetDrawPointProc(pixmap_widget, DrawPointExtensions); PWSetRedrawProc( pixmap_widget, DrawExtensions); PWSetTranslateProc(pixmap_widget, TranslateExtensions); PWSetRotateProc( pixmap_widget, RotateExtensions); PWSetFlipProc( pixmap_widget, FlipExtensions); #ifndef USE_ATHENA XmScrolledWindowSetAreas(pview_widget, XmCreateScrollBar(pview_widget, "pviewHS", NULL, 0), XmCreateScrollBar(pview_widget, "pviewVS", NULL, 0), pixmap_widget); #endif /* USE_ATHENA */ XtManageChild(formy_widget); XtManageChild(form_widget); XtManageChild(color_pane_widget); XtManageChild(pview_widget); XtManageChild(cview_widget); XtManageChild(vpane_widget); XtManageChild(pane_widget); XtManageChild(parent_widget); XtSetKeyboardFocus(top_widget, pixmap_widget); PWSetForeground(pixmap_widget, black); current_color = black; loadPixEditColors(); image_shell = XtCreatePopupShell("image", transientShellWidgetClass, top_widget, NULL, 0); #ifndef USE_ATHENA XtSetArg(wargs[0], XmNlabelString, XmStringCreateLtoR("", XmSTRING_DEFAULT_CHARSET)); image_widget = XmCreateLabel(image_shell, "label", wargs, 1); XtManageChild(image_widget); #else /* USE_ATHENA */ image_widget = XtCreateManagedWidget("label", labelWidgetClass, image_shell, NULL, 0); #endif /* USE_ATHENA */ Notify(pixmap_widget, FixImage); ColorNotify(pixmap_widget, (UseColorNotifyProc)FixColor); FixStatus(); info_dialog = CreateDialog(top_widget, "info", Okay); input_dialog = CreateDialog(top_widget, "input", Okay | Cancel); error_dialog = CreateDialog(top_widget, "error", Abort | Retry); qsave_dialog = CreateDialog(top_widget, "qsave", Yes | No | Cancel); file_dialog = CreateFDialog(top_widget, "file", Okay | Cancel); extensionEditor = CreateExtensionEditor(top_widget, "extEditor"); textOptions = CreateTextOptions(top_widget, "textOptions"); PWSetFont(pixmap_widget, textOptions->font_struct); PWSetText(pixmap_widget, textOptions->text_string); #ifdef USE_ATHENA XawToggleSetCurrent(radio_group, radio_data); #endif /* USE_ATHENA */ PWEngageRequest(pixmap_widget, PointRequest, True, Plain); XtRealizeWidget(top_widget); XtAppMainLoop(pixmap_context); } pixmap-2.6pl4.orig/Pixmap.h100440 243 144 64457 6263264165 14443 0ustar joostusers/* * $Id: Pixmap.h,v 1.15 1996/08/30 09:41:20 lmallet Exp $ * * Copyright (c) 1991-1994 Lionel MALLET * * 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 Lionel MALLET 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 Lionel MALLET shall * not be used in advertising or otherwise to promote the sale, use or * other dealings in this Software without prior written authorization * from Lionel MALLET. * * Author: Lionel Mallet, SIMULOG */ /* * $XConsortium: Pixmap.h,v 1.4 90/04/25 08:30:49 dmatic Exp $ * * Copyright 1989 Massachusetts Institute of Technology * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, 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 M.I.T. not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. M.I.T. makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. * 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. * * Author: Davor Matic, MIT X Consortium */ #ifndef _Pixmap_h #define _Pixmap_h /**************************************************************** * * Pixmap widget * ****************************************************************/ #include #include #include #include #include "xpm.h" /* Resources: Name Class RepType Default Value ---- ----- ------- ------------- cursor Cursor Cursor XC_tcross foreground Foreground Pixel XtDefaultForeground highlight Highlight Pixel XtDefaultForeground framing Framing Pixel XtDefaultForeground transparent Transparent Pixel XtDefaultTransparent proportional Proportional Boolean True grid Grid Boolean True gridTolerance GridTolerance Dimension 5 stippled Stippled Boolean True axes Axes Boolean True resize Resize Boolean True distance Distance Dimension 10 squareSize SquareSize Dimension 20 pixmapWidth PixmapWidth Dimension 16 pixmapHeight PixmapHeight Dimension 16 button1Action Button1Action Action Set button2Action Button2Action Action Set button3Action Button3Action Action Clear button4Action Button4Action Action Clear button5Action Button5Action Action Clear filename Filename String "scratch" addColorNtfyProc AddColorNtfyProc AddColorNotifyProc NULL extensionNtfyProc ExtensionNtfyProc ExtensionNotifyProc NULL stipple Stipple Bitmap XtUnspecifiedPixmap Inherited from core: background Background Pixel XtDefaultBackground border BorderColor Pixel XtDefaultForeground borderWidth BorderWidth Dimension 1 mappedWhenManaged MappedWhenManaged Boolean True sensitive Sensitive Boolean True width Width Dimension 0 height Height Dimension 0 x Position Position 320 y Position Position 320 */ /* define any special resource names here that are not in */ #define XtNcursor "cursor" #define XtNframing "framing" #define XtNtransparent "transparent" #define XtNproportional "proportional" #define XtNgrid "grid" #define XtNgridTolerance "gridTolerance" #define XtNstippled "stippled" #define XtNaxes "axes" #define XtNdistance "distance" #define XtNsquareSize "squareSize" #define XtNpixmapWidth "pixmapWidth" #define XtNpixmapHeight "pixmapHeight" #define XtNbutton1Action "button1Action" #define XtNbutton2Action "button2Action" #define XtNbutton3Action "button3Action" #define XtNbutton4Action "button4Action" #define XtNbutton5Action "button5Action" #define XtNfilename "filename" #define XtNaddColorNtfyProc "addColorNtfyProc" #define XtNextensionNtfyProc "extensionNtfyProc" #define XtNstipple "stipple" #define XtNscratch "scratch" #define XtNdummy "dummy" #define XtCHighlight "Highlight" #define XtCFraming "Framing" #define XtCTransparent "Transparent" #define XtCProportional "Proportional" #define XtCGrid "Grid" #define XtCGridTolerance "GridTolerance" #define XtCStippled "Stippled" #define XtCAxes "Axes" #define XtCDistance "Distance" #define XtCSquareSize "SquareSize" #define XtCPixmapWidth "PixmapWidth" #define XtCPixmapHeight "PixmapHeight" #define XtCButton1Action "Button1Action" #define XtCButton2Action "Button2Action" #define XtCButton3Action "Button3Action" #define XtCButton4Action "Button4Action" #define XtCButton5Action "Button5Action" #define XtCFilename "Filename" #define XtCAddColorNtfyProc "AddColorNtfyProc" #define XtCExtensionNtfyProc "ExtensionNtfyProc" #define XtCStipple "Stipple" #define XtDefaultTransparent "gray90" /* pixmap defines */ #define NotSet -1 #define Clear 0 #define Set 1 #define Invert 2 #define Highlight 3 #define On True #define Off False #define MarkRequest "MarkRequest" #define StoreRequest "StoreRequest" #define RestoreRequest "RestoreRequest" #define CopyRequest "CopyRequest" #define MoveRequest "MoveRequest" #define PointRequest "PointRequest" #define LineRequest "LineRequest" #define CurveRequest "CurveRequest" #define RectangleRequest "RectangleRequest" #define FilledRectangleRequest "FilledRectangleRequest" #define CircleRequest "CircleRequest" #define FilledCircleRequest "FilledCircleRequest" #define FloodFillRequest "FloodFillRequest" #define HotSpotRequest "HotSpotRequest" #define PickPixelRequest "PickPixelRequest" #define ZoomInRequest "ZoomInRequest" #define TextRequest "TextRequest" #define PasteRequest "PasteRequest" #define ImmediateCopyRequest "ImmediateCopyRequest" #define ImmediateMoveRequest "ImmediateMoveRequest" #define NoColorName "None" #define TRANSPARENT(dpy, scr_num) (1< #include #include #include #include #include #define AVOID /* Avoid some clashing prototyping in Pixmap.h */ #include "PixmapP.h" #include #include #define XtStrlen(s) ((s) ? strlen(s) : 0) #define abs(x) (((x) > 0) ? (x) : -(x)) #define min(x, y) (((x) < (y)) ? (x) : (y)) #define max(x, y) (((x) > (y)) ? (x) : (y)) static Boolean _PWDEBUG = False; static unsigned int depth; static int screen; static Display *dpy; static int max_ncolors = -1; /* picked up from rgb.c of Xpm lib */ static char *rgb_fname = RGBF ; #ifndef UNUSE_XPM typedef struct { /* rgb values and ascii names (from rgb text file) */ int r, g, b; /* rgb values, range of 0 -> 65535 */ char *name; /* color mnemonic of rgb value */ } RgbName; #define MAX_RGBNAMES 1024 #endif /* UNUSE_XPM */ static RgbName rgb_table[MAX_RGBNAMES]; extern int xpmReadRgbNames(); extern char *xpmGetRgbName(); #define DefaultGridTolerance 5 #define DefaultPixmapWidth 32 #define DefaultPixmapHeight 32 #define DefaultStippled TRUE #define DefaultGrid TRUE #define DefaultResize TRUE #define DefaultProportional TRUE #define DefaultAxes FALSE #define DefaultDistance 10 #define DefaultSquareSize 20 /* max display depth to use an array for color table */ #define MAX_DEPTH 8 static XtResource resources[] = { #define offset(field) XtOffset(PixmapWidget, pixmap.field) {XtNcursor, XtCCursor, XtRCursor, sizeof(Cursor), offset(cursor), XtRString, "tcross"}, {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), offset(foreground_pixel), XtRString, XtDefaultForeground}, {XtNhighlight, XtCHighlight, XtRPixel, sizeof(Pixel), offset(highlight_pixel), XtRString, XtDefaultForeground}, {XtNframing, XtCFraming, XtRPixel, sizeof(Pixel), offset(framing_pixel), XtRString, XtDefaultForeground}, {XtNtransparent, XtCTransparent, XtRPixel, sizeof(Pixel), offset(transparent_pixel), XtRString, XtDefaultTransparent}, {XtNproportional, XtCProportional, XtRBoolean, sizeof(Boolean), offset(proportional), XtRImmediate, (XtPointer) DefaultProportional}, {XtNgrid, XtCGrid, XtRBoolean, sizeof(Boolean), offset(grid), XtRImmediate, (XtPointer) DefaultGrid}, {XtNgridTolerance, XtCGridTolerance, XtRDimension, sizeof(Dimension), offset(grid_tolerance), XtRImmediate, (XtPointer) DefaultGridTolerance}, {XtNstippled, XtCStippled, XtRBoolean, sizeof(Boolean), offset(stippled), XtRImmediate, (XtPointer) DefaultStippled}, {XtNaxes, XtCAxes, XtRBoolean, sizeof(Boolean), offset(axes), XtRImmediate, (XtPointer) DefaultAxes}, {XtNresize, XtCResize, XtRBoolean, sizeof(Boolean), offset(resize), XtRImmediate, (XtPointer) DefaultResize}, {XtNdistance, XtCDistance, XtRDimension, sizeof(Dimension), offset(distance), XtRImmediate, (XtPointer) DefaultDistance}, {XtNsquareSize, XtCSquareSize, XtRDimension, sizeof(Dimension), offset(squareH), XtRImmediate, (XtPointer) DefaultSquareSize}, {XtNsquareSize, XtCSquareSize, XtRDimension, sizeof(Dimension), offset(squareW), XtRImmediate, (XtPointer) DefaultSquareSize}, {XtNpixmapWidth, XtCPixmapWidth, XtRDimension, sizeof(Dimension), offset(width), XtRImmediate, (XtPointer) DefaultPixmapWidth}, {XtNpixmapHeight, XtCPixmapHeight, XtRDimension, sizeof(Dimension), offset(height), XtRImmediate, (XtPointer) DefaultPixmapHeight}, {XtNbutton1Action, XtCButton1Action, XtRInt, sizeof(int), offset(button_action[0]), XtRImmediate, (XtPointer) Set}, {XtNbutton2Action, XtCButton2Action, XtRInt, sizeof(int), offset(button_action[1]), XtRImmediate, (XtPointer) Invert}, {XtNbutton3Action, XtCButton3Action, XtRInt, sizeof(int), offset(button_action[2]), XtRImmediate, (XtPointer) Clear}, {XtNbutton4Action, XtCButton4Action, XtRInt, sizeof(int), offset(button_action[3]), XtRImmediate, (XtPointer) Clear}, {XtNbutton5Action, XtCButton5Action, XtRInt, sizeof(int), offset(button_action[4]), XtRImmediate, (XtPointer) Clear}, {XtNfilename, XtCFilename, XtRString, sizeof(String), offset(filename), XtRImmediate, (XtPointer) XtNscratch}, {XtNaddColorNtfyProc, XtCAddColorNtfyProc, XtRFunction, sizeof(AddColorNotifyProc), offset(AddColorNotify), XtRImmediate, (XtPointer) NULL}, {XtNextensionNtfyProc, XtCExtensionNtfyProc, XtRFunction, sizeof(ExtensionNotifyProc), offset(extensionNotify), XtRImmediate, (XtPointer) NULL}, {XtNstipple, XtCStipple, XtRBitmap, sizeof(Pixmap), offset(stipple), XtRImmediate, (XtPointer) XtUnspecifiedPixmap}, #undef offset }; void PWTMark(); void PWTUnmark(); void PWTPaste(); void PWTSetColor(); static XtActionsRec actions[] = { {"mark", (XtActionProc)PWTMark}, {"unmark", (XtActionProc)PWTUnmark}, {"paste", (XtActionProc)PWTPaste}, {"set-color", (XtActionProc)PWTSetColor}, {"PW-debug", (XtActionProc)PWDebug}, {"terminate", (XtActionProc)PWTerminate}, {"store-to-buffer", (XtActionProc)PWStoreToBuffer}, {"change-notify", (XtActionProc)PWChangeNotify}, {"set-changed", (XtActionProc)PWSetChanged}, {"up", (XtActionProc)PWUp}, {"down", (XtActionProc)PWDown}, {"left", (XtActionProc)PWLeft}, {"right", (XtActionProc)PWRight}, {"fold", (XtActionProc)PWFold}, {"flip-horiz", (XtActionProc)PWFlipHoriz}, {"flip-vert", (XtActionProc)PWFlipVert}, {"rotate-right", (XtActionProc)PWRotateRight}, {"rotate-left", (XtActionProc)PWRotateLeft}, {"set", (XtActionProc)PWSet}, {"clear", (XtActionProc)PWClear}, {"undo", (XtActionProc)PWUndo}, {"redraw", (XtActionProc)PWRedraw}, }; static char translations[] = "\ Ctrl: mark()\n\ Ctrl: paste()\n\ Ctrl: unmark()\n\ Shift: set-color()\n\ Ctrll: redraw()\n\ d: PW-debug()\n\ t: terminate()\n\ Up: store-to-buffer()\ up()\ change-notify()\ set-changed()\n\ Down: store-to-buffer()\ down()\ change-notify()\ set-changed()\n\ Left: store-to-buffer()\ left()\ change-notify()\ set-changed()\n\ Right: store-to-buffer()\ right()\ change-notify()\ set-changed()\n\ f: store-to-buffer()\ fold()\ change-notify()\ set-changed()\n\ h: store-to-buffer()\ flip-horiz()\ change-notify()\ set-changed()\n\ v: store-to-buffer()\ flip-vert()\ change-notify()\ set-changed()\n\ r: store-to-buffer()\ rotate-right()\ change-notify()\ set-changed()\n\ l: store-to-buffer()\ rotate-left()\ change-notify()\ set-changed()\n\ s: store-to-buffer()\ set()\ change-notify()\ set-changed()\n\ c: store-to-buffer()\ clear()\ change-notify()\ set-changed()\n\ u: undo()\ change-notify()\ set-changed()\n\ "; Atom targets[] = { XA_BITMAP, XA_PIXMAP, XA_STRING, }; #include "Requests.h" static void ClassInitialize(); static void Initialize(); static void Redisplay(); static void Resize(); static int InternalResize(); static void Destroy(); static Boolean SetValues(); PixmapClassRec pixmapClassRec = { { /* core fields */ /* superclass */ (WidgetClass) &coreClassRec, /* class_name */ "Pixmap", /* widget_size */ sizeof(PixmapRec), /* class_initialize */ ClassInitialize, /* class_part_initialize */ NULL, /* class_inited */ FALSE, /* initialize */ Initialize, /* initialize_hook */ NULL, /* realize */ XtInheritRealize, /* actions */ actions, /* num_actions */ XtNumber(actions), /* resources */ resources, /* num_resources */ XtNumber(resources), /* xrm_class */ NULLQUARK, /* compress_motion */ TRUE, /* compress_exposure */ FALSE, /* compress_enterleave */ TRUE, /* visible_interest */ TRUE, /* 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 */ translations, /* query_geometry */ XtInheritQueryGeometry, /* display_accelerator */ XtInheritDisplayAccelerator, /* extension */ NULL, }, { /* targets */ targets, /* num_trets */ XtNumber(targets), /* requests */ requests, /* num_requests */ XtNumber(requests), } }; WidgetClass pixmapWidgetClass = (WidgetClass) &pixmapClassRec; /* function to retreive the white pixel from a given colormap, assuming it has already been alocated */ #if NeedFunctionPrototypes static Pixel WhitePixelOfColormap(Display *dpy, Colormap cmap) #else static Pixel WhitePixelOfColormap(dpy, cmap) Display *dpy; Colormap cmap; #endif { XColor color; color.red = 0xffff; color.blue = 0xffff; color.green = 0xffff; XAllocColor(dpy, cmap, &color); XFreeColors(dpy, cmap, &color.pixel, 1, 0); return color.pixel; } #if NeedFunctionPrototypes static void ResetColorUse(PWColorInfo *root) #else static void ResetColorUse(root) PWColorInfo *root; #endif { if (root != NULL) { root->in_xpm = -1; ResetColorUse(root->left); ResetColorUse(root->right); } } #if NeedFunctionPrototypes static void ResetPWColorsUse(PixmapWidget PW) #else static void ResetPWColorsUse(PW) PixmapWidget PW; #endif { if (depth <= MAX_DEPTH) { /* colorTable is an array, pixel is the entry index */ int i; for (i = 0 ; i < (1<pixmap.colorTable[i]) PW->pixmap.colorTable[i]->in_xpm = -1; } else { ResetColorUse(*(PW->pixmap.colorTable)); } } #if NeedFunctionPrototypes static PWColorInfo *GetColorWithPixel(PWColorInfo *root, Pixel pixel) #else static PWColorInfo *GetColorWithPixel(root, pixel) PWColorInfo *root; Pixel pixel; #endif { if (root != NULL) { if (root->pixel == pixel) return root; else if (pixel < root->pixel) return GetColorWithPixel(root->left, pixel); else return GetColorWithPixel(root->right, pixel); } else return root; } #if NeedFunctionPrototypes static PWColorInfo *AddColor(PWColorInfo *root, PWColorInfo *color) #else static PWColorInfo *AddColor(root, color) PWColorInfo *root; PWColorInfo *color; #endif { if (root == NULL) { return color; } else { if (color->pixel < root->pixel) root->left = AddColor(root->left, color); else root->right = AddColor(root->right, color); return root; } } #if NeedFunctionPrototypes Boolean PWQueryGrid(Widget w) #else Boolean PWQueryGrid(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; return PW->pixmap.grid; } #if NeedFunctionPrototypes Boolean PWQueryAxes(Widget w) #else Boolean PWQueryAxes(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; return PW->pixmap.axes; } #if NeedFunctionPrototypes Boolean PWQueryStored(Widget w) #else Boolean PWQueryStored(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; return (PW->pixmap.storage != NULL); } #if NeedFunctionPrototypes Pixel PWGetTransparentPixel(Widget w) #else Pixel PWGetTransparentPixel(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; return PW->pixmap.transparent_pixel; } #if NeedFunctionPrototypes Pixmap PWGetStipplePixmap(Widget w) #else Pixmap PWGetStipplePixmap(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; if (PW->pixmap.stippled) return PW->pixmap.stipple; else return XtUnspecifiedPixmap; } #include "Extensions.c" #include "Graphics.c" #include "ReqMach.c" #include "CutPaste.c" #include "Handlers.c" #if NeedFunctionPrototypes void PWDebug(Widget w) #else void PWDebug(w) Widget w; #endif { _PWDEBUG ^= True; XSynchronize(dpy, _PWDEBUG); } void PWTSetColor(w, event) Widget w; XEvent *event; { PixmapWidget PW = (PixmapWidget) w; PWSetForeground(w, PWGetPxl(w, InPixmapX(PW, event->xbutton.x), InPixmapY(PW, event->xbutton.y))); if (PW->pixmap.colorNotify) (*PW->pixmap.colorNotify)(w, PW->pixmap.foreground_pixel); } #if NeedFunctionPrototypes void ColorNotify(Widget w, UseColorNotifyProc proc) #else void ColorNotify(w, proc) Widget w; UseColorNotifyProc proc; #endif { PixmapWidget PW = (PixmapWidget) w; PW->pixmap.colorNotify = proc; } #if NeedFunctionPrototypes void ExtensionNotify(Widget w, ExtensionNotifyProc proc) #else void ExtensionNotify (w, proc) Widget w; ExtensionNotifyProc proc; #endif { PixmapWidget PW = (PixmapWidget) w; PW->pixmap.extensionNotify = proc; } #if NeedFunctionPrototypes void PWPickPixelDraw(Widget w, Position x, Position y, int value) #else void PWPickPixelDraw(w, x, y, value) Widget w; Position x; Position y; int value; #endif { PixmapWidget PW = (PixmapWidget) w; if (PW->pixmap.pickPixelDraw) (*PW->pixmap.pickPixelDraw)(w, x, y, value); } #if NeedFunctionPrototypes void PWPickPixelComplete(Widget w, Position x, Position y, int value) #else void PWPickPixelComplete(w, x, y, value) Widget w; Position x; Position y; int value; #endif { PixmapWidget PW = (PixmapWidget) w; if (PW->pixmap.pickPixelComplete) (*PW->pixmap.pickPixelComplete)(w, x, y, value); } Pixmap GetPixmap(PW, image) PixmapWidget PW; XImage *image; { Pixmap pix; XGCValues gcv; GC gc ; pix = XCreatePixmap(dpy, XtWindow((Widget) PW), image->width, image->height, image->depth); gcv.function = GXcopy; gc = XCreateGC(dpy, pix, GCFunction, &gcv); XPutImage(dpy, pix, gc, image, 0, 0, 0, 0, image->width, image->height); return(pix); } XImage *GetImage(PW, pixmap) PixmapWidget PW; Pixmap pixmap; { Window root; int x, y; unsigned int width, height, border_width, depth; XImage *image; XGetGeometry(dpy, pixmap, &root, &x, &y, &width, &height, &border_width, &depth); image = XGetImage(dpy, pixmap, x, y, width, height, AllPlanes, ZPixmap); return image; } XImage *CreateMaskImage(PW, width, height) PixmapWidget PW; Dimension width, height; { XImage *mask_image; mask_image = XCreateImage(dpy, DefaultVisual(dpy, screen), 1, ZPixmap, 0, NULL, width, height, 8, 0); if (!mask_image) { XtAppWarning(XtWidgetToApplicationContext((Widget) PW), "Pixmap error in creating XImage\n"); exit(1); } else mask_image->data = XtCalloc(1, mask_image->bytes_per_line * mask_image->height); /* Initialize all pixels to 1: default mask is rectangular */ XAddPixel(mask_image, 1); return mask_image; } XImage *CreatePixmapImage(PW, width, height) PixmapWidget PW; Dimension width, height; { int bitmap_pad; XImage *image; Pixel wp; if (depth <= 8) bitmap_pad = 8; else if (depth <= 16) bitmap_pad = 16; else bitmap_pad = 32; image = XCreateImage(dpy, DefaultVisual(dpy, screen), depth, ZPixmap, 0, NULL, width, height, bitmap_pad, 0); if (!image) { XtAppWarning(XtWidgetToApplicationContext((Widget) PW), "Pixmap error in creating XImage\n"); exit(1); } else image->data = XtCalloc(1, image->bytes_per_line * height); wp = WhitePixelOfColormap(dpy, PW->core.colormap); if (wp != 0) /* to clear the image, hope white is or 0 or greater then black */ XAddPixel(image, wp); /* because image pixels are initialized to 0 */ if (_PWDEBUG) { printf("bytes_per_line %d\n", image->bytes_per_line); printf("size data %d\n", image->bytes_per_line * height); printf("bitmap pad %d\n", image->bitmap_pad); } return image; } void DestroyPixmapImage(image) XImage **image; { if (*image) { XDestroyImage(*image); *image = NULL; } } #if NeedFunctionPrototypes XImage *PWGetImage(Widget w) #else XImage *PWGetImage(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; return PW->pixmap.image; } #if NeedFunctionPrototypes void PWChangeNotify(Widget w, XtPointer client_data, XtPointer call_data) #else void PWChangeNotify(w, client_data, call_data) Widget w; XtPointer client_data; XtPointer call_data; #endif { PixmapWidget PW = (PixmapWidget) w; if (PW->pixmap.notify) (*PW->pixmap.notify)(w, client_data, call_data); } #if NeedFunctionPrototypes void Notify(Widget w, void (*proc)()) #else void Notify(w, proc) Widget w; void (*proc)(); #endif { PixmapWidget PW = (PixmapWidget) w; PW->pixmap.notify = proc; } #if NeedFunctionPrototypes void PWSetChanged(Widget w) #else void PWSetChanged(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; PW->pixmap.changed = True; } #if NeedFunctionPrototypes Boolean PWQueryChanged(Widget w) #else Boolean PWQueryChanged(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; return PW->pixmap.changed; } #if NeedFunctionPrototypes void PWClearChanged(Widget w) #else void PWClearChanged(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; PW->pixmap.changed = False; } #if NeedFunctionPrototypes void PWSelect(Widget w, Position from_x, Position from_y, Position to_x, Position to_y, Time time) #else void PWSelect(w, from_x, from_y, to_x, to_y, time) Widget w; Position from_x, from_y, to_x, to_y; Time time; #endif { PWMark(w, from_x, from_y, to_x, to_y); PWGrabSelection(w, time); } #if NeedFunctionPrototypes void PWSwitchAxes(Widget w) #else void PWSwitchAxes(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; PW->pixmap.axes ^= True; PWHighlightAxes(w); } #if NeedFunctionPrototypes void PWAxes(Widget w, Boolean _switch) #else void PWAxes(w, _switch) Widget w; Boolean _switch; #endif { PixmapWidget PW = (PixmapWidget) w; if (PW->pixmap.axes != _switch) PWSwitchAxes(w); } #if NeedFunctionPrototypes void PWRedrawAxes(Widget w) #else void PWRedrawAxes(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; if (PW->pixmap.axes) PWHighlightAxes(w); } #if NeedFunctionPrototypes void PWPutImage(Widget w, Display *display, Drawable drawable, GC gc, Position x, Position y) #else void PWPutImage(w, display, drawable, gc, x, y) PixmapWidget w; Display *display; Drawable drawable; GC gc; Position x, y; #endif { PixmapWidget PW = (PixmapWidget) w; XPutImage(display, drawable, gc, PW->pixmap.image, 0, 0, x, y, PW->pixmap.image->width, PW->pixmap.image->height); } String StripFilename(filename) String filename; { char *begin = rindex (filename, '/'); char *end, *result; int length; if (filename) { begin = (begin ? begin + 1 : filename); end = index (begin, '.'); /* change to rindex to allow longer names */ length = (end ? (end - begin) : strlen (begin)); result = (char *) XtMalloc (length + 1); strncpy (result, begin, length); result [length] = '\0'; return (result); } else return (XtNdummy); } void SetTransparentPixels(pw, image, mask_image) PixmapWidget pw; XImage *image, *mask_image; { register Position x, y; for (x = 0; x < image->width; x++) for (y = 0; y < image->height; y++) if (XGetPixel(mask_image, x, y) == 0) XPutPixel(image, x, y, pw->pixmap.transparent_pixel); } static void InitializeXpmAttributes(PW, attribs) PixmapWidget PW; XpmAttributes *attribs; { attribs->valuemask = XpmVisual | XpmColormap | XpmDepth; attribs->visual = DefaultVisual(dpy, screen); attribs->colormap = PW->core.colormap; attribs->depth = depth; attribs->width = 0; attribs->height = 0; attribs->x_hotspot = 0; attribs->y_hotspot = 0; attribs->cpp = 0; attribs->pixels = (Pixel *)0; attribs->npixels = 0; attribs->colorsymbols = (XpmColorSymbol *)0; attribs->numsymbols = 0; attribs->rgb_fname = rgb_fname; attribs->nextensions = 0; attribs->extensions = (XpmExtension *)0; attribs->ncolors = 0; attribs->colorTable = (XpmColor *)0; attribs->hints_cmt = NULL; attribs->colors_cmt = NULL; attribs->pixels_cmt = NULL; attribs->closeness = 0; attribs->exactColors = 1; } void InitializeXpmInfo(infos) XpmInfo *infos; { infos->hints_cmt = NULL; infos->colors_cmt = NULL; infos->pixels_cmt = NULL; infos->nextensions = 0; infos->extensions = NULL; } void InitializeXpmImage(xpm_image) XpmImage *xpm_image; { xpm_image->width = 0; xpm_image->height = 0; xpm_image->cpp = 0; xpm_image->ncolors = 0; xpm_image->colorTable = (XpmColor *)0; xpm_image->data = (unsigned int *)0; } #if NeedFunctionPrototypes void PWGetUnzoomedPixmap(Widget w, Pixmap *pixmap, Pixmap *pixmap_mask) #else void PWGetUnzoomedPixmap(w, pixmap, pixmap_mask) Widget w; Pixmap *pixmap, *pixmap_mask; #endif { PixmapWidget PW = (PixmapWidget) w; XImage *mask_image, *image; if (PW->pixmap.zooming) { image = CreatePixmapImage(PW, (Dimension) PW->pixmap.zoom.image->width, (Dimension) PW->pixmap.zoom.image->height); CopyImageData(PW->pixmap.zoom.image, image, 0, 0, (Dimension) PW->pixmap.zoom.image->width, (Dimension) PW->pixmap.zoom.image->height, 0, 0); CopyImageData(PW->pixmap.image, image, 0, 0, PW->pixmap.image->width - 1, PW->pixmap.image->height - 1, PW->pixmap.zoom.at_x, PW->pixmap.zoom.at_y); mask_image = CreateMaskImage(PW, (Dimension)PW->pixmap.zoom.image->width, (Dimension)PW->pixmap.zoom.image->height); CopyImageData(PW->pixmap.zoom.mask_image, mask_image, 0, 0, (Dimension) PW->pixmap.zoom.mask_image->width, (Dimension) PW->pixmap.zoom.mask_image->height, 0, 0); CopyImageData(PW->pixmap.mask_image, mask_image, 0, 0, PW->pixmap.mask_image->width - 1, PW->pixmap.mask_image->height - 1, PW->pixmap.zoom.at_x, PW->pixmap.zoom.at_y); } else { image = PW->pixmap.image; mask_image = PW->pixmap.mask_image; } *pixmap = GetPixmap(PW, image); *pixmap_mask = GetPixmap(PW, mask_image); if (PW->pixmap.zooming) { DestroyPixmapImage(&image); DestroyMaskImage(&mask_image); } } void Refresh(); static void ClassInitialize() { static XtConvertArgRec screenConvertArg[] = { {XtWidgetBaseOffset, (XtPointer) XtOffset(Widget, core.screen), sizeof(Screen *)}, }; XtAddConverter(XtRString, XtRBitmap, XmuCvtStringToBitmap, screenConvertArg, XtNumber(screenConvertArg)); } #if NeedFunctionPrototypes static int readFile(PixmapWidget PW, String filename) #else static int readFile(PW, filename) PixmapWidget PW; String filename; #endif { int status, i, shift = 0; XImage *image, *mask_image; XpmAttributes attribs; Pixel *pixel; XpmInfo infos; XpmImage xpm_image; XpmColor *color; InitializeXpmInfo(&infos); InitializeXpmImage(&xpm_image); InitializeXpmAttributes(PW, &attribs); infos.valuemask = XpmReturnComments | XpmReturnColorTable | XpmReturnExtensions; attribs.valuemask |= XpmReturnPixels; status = XpmReadFileToXpmImage(filename, &xpm_image, &infos); if (status == XpmSuccess) status = XpmCreateImageFromXpmImage(dpy, &xpm_image, &image, &mask_image, &attribs); if (status == XpmSuccess) { /* Notify colors to be loaded with this pixmap */ for (i = 0, color = xpm_image.colorTable, pixel = attribs.pixels; i < xpm_image.ncolors; i++, color++, pixel++) { /* look for a defined color value */ char *c_name; char **defaults = (char **)color; int default_index, def_index; switch (depth) { case 1: default_index = 2; break; case 4: default_index = 3; break; case 6: default_index = 4; break; case 8: default: default_index = 5; break; } def_index = default_index; while (def_index > 1 && defaults[def_index] == NULL) --def_index; if (def_index < 2) {/* nothing towards mono, so try * towards color */ def_index = default_index + 1; while (def_index <= 5 && defaults[def_index] == NULL) ++def_index; } if (def_index > 5) { fprintf(stderr, "color #%d undefined, use black.\n", i + 1); c_name = "black"; } else c_name = defaults[def_index]; if (_PWDEBUG) { printf("Pixel %d\n", *(pixel-shift)); printf("Color name %s\n", c_name); printf("colorTable[%d][str] %s\n", i, color->string); printf("colorTable[%d][s] %s\n", i, color->symbolic); printf("colorTable[%d][m] %s\n", i, color->m_color); printf("colorTable[%d][g4] %s\n", i, color->g4_color); printf("colorTable[%d][g] %s\n", i, color->g_color); printf("colorTable[%d][c] %s\n", i, color->c_color); } if (strcasecmp(c_name, "none") == 0) { PWUpdateColorInTable((Widget)PW, TRANSPARENT(dpy, screen), color->string, color->symbolic, color->m_color, color->g4_color, color->g_color, color->c_color); shift++; } else { PWUseColorInTable((Widget)PW, *(pixel-shift), color->string, color->symbolic, color->m_color, color->g4_color, color->g_color, color->c_color); } } if (PW->pixmap.hints_cmt) XtFree(PW->pixmap.hints_cmt); if (infos.hints_cmt) PW->pixmap.hints_cmt = XtNewString(infos.hints_cmt); else PW->pixmap.hints_cmt = NULL; if (PW->pixmap.colors_cmt) XtFree(PW->pixmap.colors_cmt); if (infos.colors_cmt) PW->pixmap.colors_cmt = XtNewString(infos.colors_cmt); else PW->pixmap.colors_cmt = NULL; if (PW->pixmap.pixels_cmt) XtFree(PW->pixmap.pixels_cmt); if (infos.pixels_cmt) PW->pixmap.pixels_cmt = XtNewString(infos.pixels_cmt); else PW->pixmap.pixels_cmt = NULL; if (!mask_image) /* Xpm returns NULL when transp. is not used */ mask_image = CreateMaskImage(PW, image->width, image->height); else SetTransparentPixels(PW, image, mask_image); DestroyPixmapImage(&PW->pixmap.buffer); DestroyMaskImage(&PW->pixmap.mask_buffer); PW->pixmap.buffer = PW->pixmap.image; PW->pixmap.mask_buffer = PW->pixmap.mask_image; PW->pixmap.image = image; PW->pixmap.mask_image = mask_image; PW->pixmap.width = xpm_image.width; PW->pixmap.height = xpm_image.height; if (infos.valuemask & XpmHotspot) { PW->pixmap.hot.x = infos.x_hotspot; PW->pixmap.hot.y = infos.y_hotspot; } else { PW->pixmap.hot.x = PW->pixmap.hot.y = NotSet; } CopyExtensions( &PW->pixmap.extensions, &PW->pixmap.nextensions, infos.extensions, infos.nextensions ); if (PW->pixmap.extensionNotify) PW->pixmap.extensionNotify ((Widget) PW); PW->pixmap.changed = False; PW->pixmap.zooming = False; XpmFreeAttributes(&attribs); XpmFreeXpmImage(&xpm_image); XpmFreeXpmInfo(&infos); } return (status); } static void Initialize(request, new, argv, argc) PixmapWidget request, new; ArgList argv; Cardinal argc; { XGCValues values; XtGCMask mask; dpy = XtDisplay(new); screen = DefaultScreen(dpy); depth = DefaultDepth(dpy,screen); if (max_ncolors == -1) max_ncolors = xpmReadRgbNames(rgb_fname, rgb_table); /* allocate max colors + 1 colorTable entries because 0 is transparent */ if (depth <= MAX_DEPTH) { new->pixmap.colorTable = (PWColorInfo **) XtCalloc((1<pixmap.colorTable = XtNew(PWColorInfo *); *(new->pixmap.colorTable) = NULL; } new->pixmap.notify = NULL; new->pixmap.cardinal = 0; new->pixmap.current = 0; new->pixmap.fold = False; new->pixmap.changed = False; new->pixmap.zooming = False; new->pixmap.selection.own = False; new->pixmap.selection.limbo = False; new->pixmap.clear_pixel = WhitePixelOfColormap(dpy, new->core.colormap); new->pixmap.hints_cmt = NULL; new->pixmap.colors_cmt = NULL; new->pixmap.pixels_cmt = NULL; new->pixmap.filename = XtNewString(new->pixmap.filename); new->pixmap.status = NULL; new->pixmap.request_stack = (PWRequestStack *) XtMalloc(sizeof(PWRequestStack)); new->pixmap.request_stack[0].request = NULL; new->pixmap.request_stack[0].call_data = NULL; new->pixmap.request_stack[0].trap = False; new->core.width = new->pixmap.width * new->pixmap.squareW + 2 * new->pixmap.distance; new->core.height = new->pixmap.height * new->pixmap.squareH + 2 * new->pixmap.distance; new->pixmap.extensions = NULL; new->pixmap.nextensions = 0; new->pixmap.buffer_extensions = NULL; new->pixmap.buffer_nextensions = 0; new->pixmap.text_string = NULL; new->pixmap.font_struct = NULL; /* PWSetFont(new, "-*-fixed-medium-*-*-*-13-*-*-*-*-70-*-*" ); */ new->pixmap.hot.x = new->pixmap.hot.y = NotSet; new->pixmap.buffer_hot.x = new->pixmap.buffer_hot.y = NotSet; new->pixmap.mark.from_x = new->pixmap.mark.from_y = NotSet; new->pixmap.mark.to_x = new->pixmap.mark.to_y = NotSet; new->pixmap.buffer_mark.from_x = new->pixmap.buffer_mark.from_y = NotSet; new->pixmap.buffer_mark.to_x = new->pixmap.buffer_mark.to_y = NotSet; values.foreground = new->pixmap.foreground_pixel; values.background = new->core.background_pixel; values.foreground ^= values.background; values.function = GXcopy; values.plane_mask = AllPlanes; mask = GCForeground | GCBackground | GCFunction | GCPlaneMask; new->pixmap.drawing_gc = XCreateGC(dpy, RootWindow(dpy,screen), mask, &values); values.foreground = new->pixmap.highlight_pixel; values.background = new->core.background_pixel; values.foreground ^= values.background; values.function = GXxor; values.plane_mask = AllPlanes; mask = GCForeground | GCBackground | GCFunction | GCPlaneMask; new->pixmap.highlighting_gc = XCreateGC(dpy, RootWindow(dpy, screen), mask, &values); values.foreground = new->pixmap.framing_pixel; values.background = new->core.background_pixel; values.foreground ^= values.background; values.function = GXxor; values.plane_mask = AllPlanes; mask = GCForeground | GCBackground | GCFunction | GCPlaneMask; new->pixmap.framing_gc = XCreateGC(dpy, RootWindow(dpy, screen), mask, &values); values.foreground = new->pixmap.transparent_pixel; values.background = new->pixmap.clear_pixel; values.function = GXcopy; mask = GCForeground | GCBackground | GCFunction; if (new->pixmap.stipple != XtUnspecifiedPixmap) { values.stipple = new->pixmap.stipple; mask |= GCStipple | GCFillStyle; } values.fill_style = (new->pixmap.stippled ? FillOpaqueStippled : FillSolid); new->pixmap.transparent_gc = XCreateGC(dpy, RootWindow(dpy, screen), mask, &values); new->pixmap.storage = NULL; new-> pixmap.mask_storage = NULL; new->pixmap.image = CreatePixmapImage(new, new->pixmap.width, new->pixmap.height); new->pixmap.mask_image = CreateMaskImage(new, new->pixmap.width, new->pixmap.height); new->pixmap.buffer = CreatePixmapImage(new, new->pixmap.width, new->pixmap.height); new->pixmap.mask_buffer = CreateMaskImage(new, new->pixmap.width, new->pixmap.height); /* add transparent pixel in ColorTable */ PWUseColorInTable((Widget)new, TRANSPARENT(dpy, screen), NULL, NULL, NULL, NULL, NULL, NoColorName); /* add clear pixel in ColorTable */ PWUseColorInTable((Widget)new, new->pixmap.clear_pixel, NULL, NULL, NULL, NULL, NULL, "white"); /* Read file */ readFile(new, new->pixmap.filename); InternalResize(new); Resize(new); } #if NeedFunctionPrototypes Boolean PWQueryMarked(Widget w) #else Boolean PWQueryMarked(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; return QuerySet(PW->pixmap.mark.from_x, PW->pixmap.mark.from_y); } #if NeedFunctionPrototypes Boolean PWQueryStippled(Widget w) #else Boolean PWQueryStippled(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; return(PW->pixmap.stippled); } void FixMark(PW) PixmapWidget PW; { if (QuerySet(PW->pixmap.mark.from_x, PW->pixmap.mark.from_y)) { PW->pixmap.mark.from_x = min(PW->pixmap.mark.from_x, PW->pixmap.image->width); PW->pixmap.mark.from_y = min(PW->pixmap.mark.from_y, PW->pixmap.image->height); PW->pixmap.mark.to_x = min(PW->pixmap.mark.to_x, PW->pixmap.image->width); PW->pixmap.mark.to_y = min(PW->pixmap.mark.to_y, PW->pixmap.image->height); if((PW->pixmap.mark.from_x == PW->pixmap.mark.from_y) && (PW->pixmap.mark.to_x == PW->pixmap.mark.to_y)) PW->pixmap.mark.from_x = PW->pixmap.mark.from_y = PW->pixmap.mark.to_x = PW->pixmap.mark.to_y = NotSet; } } #if NeedFunctionPrototypes int PWStoreFile(Widget w, String filename) #else int PWStoreFile(w, filename) Widget w; String filename; #endif { PixmapWidget PW = (PixmapWidget) w; int status, i, shift = 0; XImage *image, *mask_image; XpmAttributes attribs; Pixel *pixel; XpmInfo infos; XpmImage xpm_image; XpmColor *color; InitializeXpmInfo(&infos); InitializeXpmImage(&xpm_image); InitializeXpmAttributes(PW, &attribs); infos.valuemask = XpmReturnColorTable; attribs.valuemask |= XpmReturnPixels; if ((status = XpmReadFileToXpmImage(filename, &xpm_image, &infos)) == XpmSuccess) status = XpmCreateImageFromXpmImage(dpy, &xpm_image, &image, &mask_image, &attribs); if (status == XpmSuccess) { /* Notify colors to be loaded with this pixmap */ for (i = 0, color = xpm_image.colorTable, pixel = attribs.pixels; i < xpm_image.ncolors; i++, color++, pixel++) { char *c_name; switch (depth) { case 1: c_name = color->m_color; break; case 4: c_name = color->g4_color; break; case 6: c_name = color->g_color; break; case 8: default: c_name = color->c_color; break; } if (_PWDEBUG) { printf("Pixel %d\n", *(pixel-shift)); printf("Color name %s\n", c_name); printf("colorTable[%d][str] %s\n", i, color->string); printf("colorTable[%d][s] %s\n", i, color->symbolic); printf("colorTable[%d][m] %s\n", i, color->m_color); printf("colorTable[%d][g4] %s\n", i, color->g4_color); printf("colorTable[%d][g] %s\n", i, color->g_color); printf("colorTable[%d][c] %s\n", i, color->c_color); } if (strcasecmp(c_name, "none") == 0) { PWUpdateColorInTable((Widget)PW, TRANSPARENT(dpy, screen), color->string, color->symbolic, color->m_color, color->g4_color, color->g_color, color->c_color); shift = 1; } else { PWUseColorInTable((Widget)PW, *(pixel-shift), color->string, color->symbolic, color->m_color, color->g4_color, color->g_color, color->c_color); } } if (!mask_image) /* Xpm returns NULL when transp. is not used */ mask_image = CreateMaskImage(PW, image->width, image->height); else SetTransparentPixels(PW, image, mask_image); DestroyPixmapImage(&PW->pixmap.storage); DestroyMaskImage(&PW->pixmap.mask_storage); PW->pixmap.storage = image; PW->pixmap.mask_storage = mask_image; if (infos.valuemask & XpmHotspot) { PW->pixmap.storage_hot.x = infos.x_hotspot; PW->pixmap.storage_hot.y = infos.y_hotspot; } else { PW->pixmap.storage_hot.x = PW->pixmap.storage_hot.y = NotSet; } XpmFreeAttributes(&attribs); XpmFreeXpmImage(&xpm_image); XpmFreeXpmInfo(&infos); } else XtAppWarning(XtWidgetToApplicationContext(w), " read file failed. PixmapWidget"); return status; } #if NeedFunctionPrototypes String PWUnparseStatus(Widget w) #else String PWUnparseStatus(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; char size_buf[80]; char *status_ptr; sprintf(size_buf, "%dx%d", PW->pixmap.width, PW->pixmap.height); /* 16 is lenght of "Filename: " and " Size:" 1 is NULL don't realloc pixmap.status since alloc might fail and we don't want to */ if ((status_ptr = XtMalloc((strlen(size_buf) + strlen(PW->pixmap.filename) + 16 + 1) * sizeof(char)))) { if (PW->pixmap.status) XtFree(PW->pixmap.status); PW->pixmap.status = status_ptr; sprintf(PW->pixmap.status, "Filename: %s Size:%dx%d", PW->pixmap.filename, PW->pixmap.width, PW->pixmap.height); } return PW->pixmap.status; } #if NeedFunctionPrototypes void PWChangeFilename(Widget w, String str) #else void PWChangeFilename(w, str) Widget w; String str; #endif { PixmapWidget PW = (PixmapWidget) w; if (str) if (strcmp(str, "")) { XtFree(PW->pixmap.filename); PW->pixmap.filename = XtNewString( str); } } /* Warning this function sets or gets the pixmap comments * if passing null, a comment is returned, otherwise, it is stored * memory is allocated for returned comments, should be free by application */ #if NeedFunctionPrototypes void PWComments(Widget w, char **hints_cmt, char **colors_cmt, char **pixels_cmt) #else void PWComments(w, hints_cmt, colors_cmt, pixels_cmt) Widget w; char **hints_cmt, **colors_cmt, **pixels_cmt; #endif { PixmapWidget PW = (PixmapWidget)w; if ((*hints_cmt) && (PW->pixmap.hints_cmt)) { XtFree(PW->pixmap.hints_cmt); PW->pixmap.hints_cmt = XtNewString(*hints_cmt); } else if (*hints_cmt) PW->pixmap.hints_cmt = XtNewString(*hints_cmt); else *hints_cmt = XtNewString(PW->pixmap.hints_cmt); if ((*colors_cmt) && (PW->pixmap.colors_cmt)) { XtFree(PW->pixmap.colors_cmt); PW->pixmap.colors_cmt = XtNewString(*colors_cmt); } else if (*colors_cmt) PW->pixmap.colors_cmt = XtNewString(*colors_cmt); else *colors_cmt = XtNewString(PW->pixmap.colors_cmt); if ((*pixels_cmt) && (PW->pixmap.pixels_cmt)) { XtFree(PW->pixmap.pixels_cmt); PW->pixmap.pixels_cmt = XtNewString(*pixels_cmt); } else if (*pixels_cmt) PW->pixmap.pixels_cmt = XtNewString(*pixels_cmt); else *pixels_cmt = XtNewString(PW->pixmap.pixels_cmt); } #if NeedFunctionPrototypes void PWAddColorNotifyProc(Widget w, AddColorNotifyProc proc) #else void PWAddColorNotifyProc(w, proc) Widget w; AddColorNotifyProc proc; #endif { PixmapWidget PW = (PixmapWidget) w; PW->pixmap.AddColorNotify = proc; } #if NeedFunctionPrototypes PWColorInfo **PWGetColorTable(Widget w) #else PWColorInfo **PWGetColorTable(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; return(PW->pixmap.colorTable); } #if NeedFunctionPrototypes PWColorInfo *PWGetColor(Widget w, Pixel pixel) #else PWColorInfo *PWGetColor(w, pixel) Widget w; Pixel pixel; #endif { PixmapWidget PW = (PixmapWidget) w; if (depth <= MAX_DEPTH) { /* colorTable is an array, pixel is the entry index */ /* index in colorTable is 0 for transparent and pixel+1 for others */ int index = (pixel == TRANSPARENT(dpy, screen) ? 0 : pixel + 1); return (PW->pixmap.colorTable[index]); } else { /* colorTable is a B-tree, find proper entry recursively */ return GetColorWithPixel(*(PW->pixmap.colorTable), pixel); } } #if NeedFunctionPrototypes void PWAddColor(Widget w, PWColorInfo *color) #else void PWAddColor(w, color) Widget w; PWColorInfo *color; #endif { PixmapWidget PW = (PixmapWidget) w; if (depth <= MAX_DEPTH) { /* colorTable is an array, pixel is the entry index */ /* index in colorTable is 0 for transparent and pixel+1 for others */ int index = (color->pixel == TRANSPARENT(dpy, screen) ? 0 : color->pixel + 1); PW->pixmap.colorTable[index] = color; } else { /* colorTable is a B-tree, find proper entry recursively */ *(PW->pixmap.colorTable) = AddColor(*(PW->pixmap.colorTable), color); } } #if NeedFunctionPrototypes void PWUseColorInTable(Widget w, Pixel pixel, char *symbol, char *sname, char *mname, char *g4name, char *gname, char *cname) #else void PWUseColorInTable(w, pixel, symbol, sname, mname, g4name, gname, cname) Widget w; Pixel pixel; char *symbol, *sname, *mname, *g4name, *gname, *cname; #endif /* name are not used as is, instead memory is malloc'ed to fit in */ { PixmapWidget PW = (PixmapWidget) w; Boolean is_new_color = False; PWColorInfo *new_color; if (PWGetColor(w, pixel) == NULL) /* not yet used color probably not in colorTable */ { is_new_color = True; new_color = XtNew(PWColorInfo); new_color->symbol = 0; new_color->s_name = 0; new_color->m_name = 0; new_color->g4_name = 0; new_color->g_name = 0; new_color->c_name = 0; new_color->pixel = pixel; new_color->left = NULL; new_color->right = NULL; PWAddColor(w, new_color); } PWUpdateColorInTable(w, pixel, symbol, sname, mname, g4name, gname, cname); if (is_new_color && (PW->pixmap.AddColorNotify != (AddColorNotifyProc) 0)) PW->pixmap.AddColorNotify(w, pixel, new_color->c_name); } #if NeedFunctionPrototypes void PWUpdateColorInTable(Widget w, Pixel pixel, char *symbol, char *sname, char *mname, char *g4name, char *gname, char *cname) #else void PWUpdateColorInTable(w, pixel, symbol, sname, mname, g4name, gname, cname) Widget w; Pixel pixel; char *symbol, *sname, *mname, *g4name, *gname, *cname; #endif /* name are not used as is, instead memory is malloc'ed to fit in */ { PixmapWidget PW = (PixmapWidget) w; PWColorInfo *color = PWGetColor(w, pixel); if (color == NULL) return; /* inexistent color in Table */ /* Update the color info in ColorTable */ if ((symbol) && ((!color->symbol) || (strcmp(symbol, color->symbol)))) { if (color->symbol) XtFree(color->symbol); color->symbol = XtNewString(symbol); } if ((sname) && ((!color->s_name) || (strcmp(sname, color->s_name)))) { if (color->s_name) XtFree(color->s_name); color->s_name = XtNewString(sname); } if ((mname) && ((!color->m_name) || (strcmp(mname, color->m_name)))) { if (color->m_name) XtFree(color->m_name); color->m_name = XtNewString(mname); } if ((g4name) && ((!color->g4_name) || (strcmp(g4name, color->g4_name)))) { if (color->g4_name) XtFree(color->g4_name); color->g4_name = XtNewString(g4name); } if ((gname) && ((!color->g_name) || (strcmp(gname, color->g_name)))) { if (color->g_name) XtFree(color->g_name); color->g_name = XtNewString(gname); } if ((cname) && ((!color->c_name) || ((strcmp(cname, color->c_name)) && ((cname[0] != '#') || (color->c_name[0] == '#'))))) { if (color->c_name) XtFree(color->c_name); /* try to get a name from rgb_table */ if (cname[0] == '#') { XColor xcolor; char *rgb_name; xcolor.pixel = pixel; XQueryColor(dpy, PW->core.colormap, &xcolor); rgb_name = xpmGetRgbName(rgb_table, max_ncolors, (int) xcolor.red, (int) xcolor.green, (int) xcolor.blue); if (rgb_name) cname=rgb_name; } color->c_name = XtNewString(cname); } else if ((!cname) && (!color->c_name)) { XColor xcolor; char *rgb_name; xcolor.pixel = pixel; XQueryColor(dpy, PW->core.colormap, &xcolor); if (!(rgb_name = xpmGetRgbName(rgb_table, max_ncolors, (int) xcolor.red, (int) xcolor.green, (int) xcolor.blue))) { color->c_name = (char *)XtMalloc(15*sizeof(char)); sprintf(color->c_name, "#%04X%04X%04X", xcolor.red, xcolor.green, xcolor.blue); } else { color->c_name = XtNewString(rgb_name); } } } #if NeedFunctionPrototypes int PWReadFile(Widget w, String filename) #else int PWReadFile(w, filename) Widget w; String filename; #endif { int status, resized; PixmapWidget PW = (PixmapWidget) w; status = readFile(PW, filename); if (status == XpmSuccess) { XtFree(PW->pixmap.filename); PW->pixmap.filename = XtNewString(filename); PWUnmark(w); resized = InternalResize(PW); if (PW->core.visible && !resized) { XClearArea(dpy, XtWindow(PW), 0, 0, PW->core.width, PW->core.height, True); } } else XtAppWarning(XtWidgetToApplicationContext(w), " read file failed. PixmapWidget"); return status; } #if NeedFunctionPrototypes void PWSetImage(Widget w, XImage *image, XImage *mask_image) #else void PWSetImage(w, image, mask_image) Widget w; XImage *image, *mask_image; #endif { PixmapWidget PW = (PixmapWidget) w; XImage *buffer, *mask_buffer; int resized; buffer = CreatePixmapImage(PW, (Dimension) image->width, (Dimension) image->height); mask_buffer = CreateMaskImage(PW, (Dimension) image->width, (Dimension) image->height); TransferImageData(PW->pixmap.image, buffer); TransferImageData(PW->pixmap.mask_image, mask_buffer); DestroyPixmapImage(&PW->pixmap.image); DestroyPixmapImage(&PW->pixmap.buffer); DestroyMaskImage(&PW->pixmap.mask_image); DestroyMaskImage(&PW->pixmap.mask_buffer); PW->pixmap.image = image; PW->pixmap.mask_image = mask_image; PW->pixmap.buffer = buffer; PW->pixmap.mask_buffer = mask_buffer; PW->pixmap.width = image->width; PW->pixmap.height = image->height; resized = InternalResize(PW); if (PW->core.visible && !resized) { XClearArea(dpy, XtWindow(PW), 0, 0, PW->core.width, PW->core.height, True); } } #define MAXPRINTABLE 92 /* number of printable ascii chars * minus \ and " for string compat * and ? to avoid ANSI trigraphs. */ static char *printable = " .XoO+@#$%&*=-;:>,<1234567890qwertyuipasdfghjklzxcvbnmMNBVCZ\ ASDFGHJKLPIUYTREWQ!~^/()_`'][{}|"; void buildXpmImageAndAttributes(PW, image, mask_image, xpm_image_return, infos_return) PixmapWidget PW; XImage *image; XImage *mask_image; XpmImage **xpm_image_return; XpmInfo **infos_return; { register Position x, y; register Pixel pxl; unsigned int *data, color_index = 0; unsigned int i, j, k; XpmColor *color; XpmImage *xpm_image = (XpmImage *)XtMalloc(sizeof(XpmImage)); XpmInfo *infos = (XpmInfo *)XtMalloc(sizeof(XpmInfo)); ResetPWColorsUse(PW); if (PW->pixmap.hints_cmt || PW->pixmap.colors_cmt || PW->pixmap.pixels_cmt) { infos->valuemask = XpmComments; if (PW->pixmap.hints_cmt) infos->hints_cmt = XtNewString(PW->pixmap.hints_cmt); else infos->hints_cmt = NULL; if (PW->pixmap.colors_cmt) infos->colors_cmt = XtNewString(PW->pixmap.colors_cmt); else infos->colors_cmt = NULL; if (PW->pixmap.pixels_cmt) infos->pixels_cmt = XtNewString(PW->pixmap.pixels_cmt); else infos->pixels_cmt = NULL; } else infos->valuemask = 0; infos->x_hotspot = 0; infos->y_hotspot = 0; infos->nextensions = 0; infos->extensions = (XpmExtension *)0; xpm_image->width = image->width; xpm_image->height = image->height; xpm_image->cpp = 0; xpm_image->data = (unsigned int *)XtCalloc(image->width * image->height, sizeof(unsigned int)); xpm_image->colorTable = (XpmColor *)NULL; xpm_image->ncolors = 0; for (y = 0, data = xpm_image->data; y < image->height; y++) for (x = 0; x < image->width; x++, data++) { PWColorInfo *pw_color; pxl = GetPxlFromImageAndMask(image, mask_image, x, y); pw_color = PWGetColor((Widget) PW, pxl); if ((color_index = pw_color->in_xpm) == -1) { /* Add the color in colorTable */ color_index = xpm_image->ncolors; pw_color->in_xpm = color_index; xpm_image->ncolors++; xpm_image->colorTable = (XpmColor *)XtRealloc((char *)xpm_image->colorTable, xpm_image->ncolors * sizeof(XpmColor)); color = xpm_image->colorTable+color_index; color->symbolic = XtNewString(pw_color->s_name); color->m_color = XtNewString(pw_color->m_name); color->g4_color = XtNewString(pw_color->g4_name); color->g_color = XtNewString(pw_color->g_name); color->c_color = XtNewString(pw_color->c_name); } /* put color index in XpmImage */ *data = color_index; } xpm_image->cpp = (xpm_image->ncolors / MAXPRINTABLE) + 1; for (i = 0, color = xpm_image->colorTable; i < xpm_image->ncolors; i++, color++) { char * s; color->string = (char *)XtMalloc(xpm_image->cpp + 1); s = color->string; *s++ = printable[k = i % MAXPRINTABLE]; for (j = 1; j < xpm_image->cpp; j++, s++) *s = printable[k = ((i - k) / MAXPRINTABLE) % MAXPRINTABLE]; *s = '\0'; } *xpm_image_return = xpm_image; *infos_return = infos; } #if NeedFunctionPrototypes int PWWriteFile(Widget w, String filename) #else int PWWriteFile(w, filename) Widget w; String filename; #endif { PixmapWidget PW = (PixmapWidget) w; XImage *image, *mask_image; XPoint hot; int status; XpmImage *xpm_image; XpmInfo *infos; if (PW->pixmap.zooming) { image = CreatePixmapImage(PW, (Dimension) PW->pixmap.zoom.image->width, (Dimension) PW->pixmap.zoom.image->height); CopyImageData(PW->pixmap.zoom.image, image, 0, 0, (Dimension) PW->pixmap.zoom.image->width, (Dimension) PW->pixmap.zoom.image->height, 0, 0); CopyImageData(PW->pixmap.image, image, 0, 0, PW->pixmap.image->width - 1, PW->pixmap.image->height - 1, PW->pixmap.zoom.at_x, PW->pixmap.zoom.at_y); mask_image = CreateMaskImage(PW, (Dimension)PW->pixmap.zoom.image->width, (Dimension)PW->pixmap.zoom.image->height); CopyImageData(PW->pixmap.zoom.mask_image, mask_image, 0, 0, (Dimension) PW->pixmap.zoom.mask_image->width, (Dimension) PW->pixmap.zoom.mask_image->height, 0, 0); CopyImageData(PW->pixmap.mask_image, mask_image, 0, 0, PW->pixmap.mask_image->width - 1, PW->pixmap.mask_image->height - 1, PW->pixmap.zoom.at_x, PW->pixmap.zoom.at_y); if (QuerySet(PW->pixmap.hot.x, PW->pixmap.hot.y)) { hot.x = PW->pixmap.hot.x + PW->pixmap.zoom.at_x; hot.y = PW->pixmap.hot.y + PW->pixmap.zoom.at_y; } else hot = PW->pixmap.zoom.hot; } else { image = PW->pixmap.image; mask_image = PW->pixmap.mask_image; hot = PW->pixmap.hot; } if (filename) { XtFree(PW->pixmap.filename); PW->pixmap.filename = XtNewString(filename); } if (_PWDEBUG) fprintf(stderr, "Saving filename: %s\n", filename); buildXpmImageAndAttributes(PW, image, mask_image, &xpm_image, &infos); if (QuerySet(hot.x, hot.y)) { infos->valuemask |= XpmHotspot; infos->x_hotspot = hot.x; infos->y_hotspot = hot.y; } /* need to account for zooming for ports ?? */ infos->valuemask |= XpmExtensions; /* save extensions */ CopyExtensions( &infos->extensions, &infos->nextensions, PW->pixmap.extensions, PW->pixmap.nextensions ); status = XpmWriteFileFromXpmImage(PW->pixmap.filename, xpm_image, infos); XpmFreeXpmImage(xpm_image); XtFree((char *)xpm_image); XpmFreeXpmInfo(infos); XtFree((char *)infos); if (PW->pixmap.zooming) { DestroyPixmapImage(&image); DestroyMaskImage(&mask_image); } if (status == XpmSuccess) PW->pixmap.changed = False; return status; } #if NeedFunctionPrototypes String PWGetFilename(Widget w, String *str) #else String PWGetFilename(w, str) Widget w; String *str; #endif { PixmapWidget PW = (PixmapWidget) w; *str = XtNewString(PW->pixmap.filename); return *str; } #if NeedFunctionPrototypes String PWGetFilepath(Widget w, String *str) #else String PWGetFilepath(w, str) Widget w; String *str; #endif { PixmapWidget PW = (PixmapWidget) w; String end; *str = XtNewString(PW->pixmap.filename); end = rindex(*str, '/'); if (end) *(end + 1) = '\0'; else **str = '\0'; return *str; } void FixHotSpot(PW) PixmapWidget PW; { if (!QueryInPixmap(PW, PW->pixmap.hot.x, PW->pixmap.hot.y)) PW->pixmap.hot.x = PW->pixmap.hot.y = NotSet; } void ZoomOut(PW) PixmapWidget PW; { CopyImageData(PW->pixmap.image, PW->pixmap.zoom.image, 0, 0, PW->pixmap.image->width - 1, PW->pixmap.image->height - 1, PW->pixmap.zoom.at_x, PW->pixmap.zoom.at_y); CopyImageData(PW->pixmap.mask_image, PW->pixmap.zoom.mask_image, 0, 0, PW->pixmap.mask_image->width - 1, PW->pixmap.mask_image->height - 1, PW->pixmap.zoom.at_x, PW->pixmap.zoom.at_y); DestroyPixmapImage(&PW->pixmap.image); DestroyPixmapImage(&PW->pixmap.buffer); DestroyMaskImage(&PW->pixmap.mask_image); DestroyMaskImage(&PW->pixmap.mask_buffer); PW->pixmap.image = PW->pixmap.zoom.image; PW->pixmap.mask_image = PW->pixmap.zoom.mask_image; PW->pixmap.buffer = PW->pixmap.zoom.buffer; PW->pixmap.mask_buffer = PW->pixmap.zoom.mask_buffer; PW->pixmap.width = PW->pixmap.image->width; PW->pixmap.height = PW->pixmap.image->height; PW->pixmap.fold = PW->pixmap.zoom.fold; PW->pixmap.changed |= PW->pixmap.zoom.changed; PW->pixmap.grid = PW->pixmap.zoom.grid; if (QuerySet(PW->pixmap.hot.x, PW->pixmap.hot.y)) { PW->pixmap.hot.x += PW->pixmap.zoom.at_x; PW->pixmap.hot.y += PW->pixmap.zoom.at_y; } else PW->pixmap.hot = PW->pixmap.zoom.hot; PW->pixmap.mark.from_x = NotSet; PW->pixmap.mark.from_y = NotSet; PW->pixmap.mark.to_x = NotSet; PW->pixmap.mark.to_y = NotSet; PW->pixmap.zooming = False; } #if NeedFunctionPrototypes void PWZoomOut(Widget w) #else void PWZoomOut(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; int resized; if (PW->pixmap.zooming) { ZoomOut(PW); resized = InternalResize(PW); if (PW->core.visible && !resized) XClearArea(dpy, XtWindow(PW), 0, 0, PW->core.width, PW->core.height, True); } } #if NeedFunctionPrototypes void PWZoomMarked(Widget w) #else void PWZoomMarked(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; PWZoomIn(w, PW->pixmap.mark.from_x, PW->pixmap.mark.from_y, PW->pixmap.mark.to_x, PW->pixmap.mark.to_y); } #if NeedFunctionPrototypes void PWZoomIn(Widget w, Position from_x, Position from_y, Position to_x, Position to_y) #else void PWZoomIn(w, from_x, from_y, to_x, to_y) Widget w; Position from_x, from_y, to_x, to_y; #endif { PixmapWidget PW = (PixmapWidget) w; XImage *image, *buffer, *mask_image, *mask_buffer; Dimension width, height, coreWidth, coreHeight; int resized; if (PW->pixmap.zooming) PWZoomOut(w); QuerySwap(from_x, to_x); QuerySwap(from_y, to_y); from_x = max(0, from_x); from_y = max(0, from_y); to_x = min(PW->pixmap.width - 1, to_x); to_y = min(PW->pixmap.height - 1, to_y); width = to_x - from_x + 1; height = to_y - from_y + 1; image = CreatePixmapImage(PW, width, height); buffer = CreatePixmapImage(PW, width, height); mask_image = CreateMaskImage(PW, width, height); mask_buffer = CreateMaskImage(PW, width, height); CopyImageData(PW->pixmap.image, image, from_x, from_y, to_x, to_y, 0, 0); CopyImageData(PW->pixmap.buffer, buffer, from_x, from_y, to_x, to_y, 0, 0); CopyImageData(PW->pixmap.mask_image, mask_image, from_x, from_y, to_x, to_y, 0, 0); CopyImageData(PW->pixmap.mask_buffer, mask_buffer, from_x, from_y, to_x, to_y, 0, 0); PW->pixmap.zoom.image = PW->pixmap.image; PW->pixmap.zoom.buffer = PW->pixmap.buffer; PW->pixmap.zoom.mask_image = PW->pixmap.mask_image; PW->pixmap.zoom.mask_buffer = PW->pixmap.mask_buffer; PW->pixmap.zoom.at_x = from_x; PW->pixmap.zoom.at_y = from_y; PW->pixmap.zoom.fold = PW->pixmap.fold; PW->pixmap.zoom.changed = PW->pixmap.changed; PW->pixmap.zoom.hot = PW->pixmap.hot; PW->pixmap.zoom.grid = PW->pixmap.grid; PW->pixmap.image = image; PW->pixmap.buffer = buffer; PW->pixmap.mask_image = mask_image; PW->pixmap.mask_buffer = mask_buffer; PW->pixmap.width = width; PW->pixmap.height = height; PW->pixmap.changed = False; PW->pixmap.hot.x -= from_x; PW->pixmap.hot.y -= from_y; PW->pixmap.mark.from_x = NotSet; PW->pixmap.mark.from_y = NotSet; PW->pixmap.mark.to_x = NotSet; PW->pixmap.mark.to_y = NotSet; PW->pixmap.zooming = True; PW->pixmap.grid = True; /* potencially true, could use a resource here */ FixHotSpot(PW); coreWidth = PW->core.width; coreHeight = PW->core.height; resized = InternalResize(PW); if (PW->core.visible && !resized) Refresh(PW, 0, 0, PW->core.width, PW->core.height); /* XClearArea(dpy, XtWindow(PW), 0, 0, coreWidth, coreHeight, True); */ } XImage *ScalePixmapImage(); #if NeedFunctionPrototypes void PWRescale(Widget w, Dimension width, Dimension height) #else void PWRescale(w, width, height) Widget w; Dimension width, height; #endif { PixmapWidget PW = (PixmapWidget) w; XImage *image, *mask_image; int resized; if (PW->pixmap.zooming) ZoomOut(PW); image = ScalePixmapImage(PW, PW->pixmap.image, (double) width / (double) PW->pixmap.image->width, (double) height / (double) PW->pixmap.image->height); mask_image = ScaleMaskImage(PW, PW->pixmap.mask_image, (double) width / (double) PW->pixmap.mask_image->width, (double) height / (double) PW->pixmap.mask_image->height); DestroyPixmapImage(&PW->pixmap.image); DestroyMaskImage(&PW->pixmap.mask_image); PW->pixmap.image = image; PW->pixmap.mask_image = mask_image; PW->pixmap.width = image->width; PW->pixmap.height = image->height; FixHotSpot(PW); FixMark(PW); resized = InternalResize(PW); if (PW->core.visible && !resized) XClearArea(dpy, XtWindow(PW), 0, 0, PW->core.width, PW->core.height, True); } #if NeedFunctionPrototypes Boolean PWQueryZooming(Widget w) #else Boolean PWQueryZooming(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; return PW->pixmap.zooming; } #if NeedFunctionPrototypes void PWResize(Widget w, Dimension width, Dimension height) #else void PWResize(w, width, height) Widget w; Dimension width, height; #endif { PixmapWidget PW = (PixmapWidget) w; XImage *image, *mask_image; int resized; if (PW->pixmap.zooming) ZoomOut(PW); image = CreatePixmapImage(PW, width, height); mask_image = CreateMaskImage(PW, width, height); TransferImageData(PW->pixmap.image, image); TransferImageData(PW->pixmap.mask_image, mask_image); DestroyPixmapImage(&PW->pixmap.image); DestroyMaskImage(&PW->pixmap.mask_image); PW->pixmap.image = image; PW->pixmap.mask_image = mask_image; PW->pixmap.width = width; PW->pixmap.height = height; FixHotSpot(PW); FixMark(PW); resized = InternalResize(PW); if (PW->core.visible && !resized) XClearArea(dpy, XtWindow(PW), 0, 0, PW->core.width, PW->core.height, True); } static void Destroy(w) Widget w; { PixmapWidget PW = (PixmapWidget) w; int i; /* free colorTable */ for (i = 0; i < 1<pixmap.colorTable[i]) { if (PW->pixmap.colorTable[i]->symbol) XtFree(PW->pixmap.colorTable[i]->symbol); if (PW->pixmap.colorTable[i]->s_name) XtFree(PW->pixmap.colorTable[i]->s_name); if (PW->pixmap.colorTable[i]->m_name) XtFree(PW->pixmap.colorTable[i]->m_name); if (PW->pixmap.colorTable[i]->g4_name) XtFree(PW->pixmap.colorTable[i]->g4_name); if (PW->pixmap.colorTable[i]->g_name) XtFree(PW->pixmap.colorTable[i]->g_name); if (PW->pixmap.colorTable[i]->c_name) XtFree(PW->pixmap.colorTable[i]->c_name); XtFree((char *)PW->pixmap.colorTable[i]); } XtFree((char *)PW->pixmap.colorTable); XFreeGC(dpy, PW->pixmap.drawing_gc); XFreeGC(dpy, PW->pixmap.highlighting_gc); XFreeGC(dpy, PW->pixmap.framing_gc); XFreeGC(dpy, PW->pixmap.transparent_gc); DestroyPixmapImage(&PW->pixmap.image); DestroyPixmapImage(&PW->pixmap.buffer); DestroyMaskImage(&PW->pixmap.mask_image); DestroyMaskImage(&PW->pixmap.mask_buffer); PWRemoveAllRequests(w); } /* internal function that makes a gemotry request to PixmapWidget's parent */ static int InternalResize(PW) PixmapWidget PW; { Dimension w, h, rw, rh, oldw, oldh; XtGeometryResult status; oldw = PW->core.width; oldh = PW->core.height; w = 2 * (int)PW->pixmap.distance + (int)PW->pixmap.width * PW->pixmap.squareW; h = 2 * (int)PW->pixmap.distance + (int)PW->pixmap.height * PW->pixmap.squareH; status = XtMakeResizeRequest((Widget)PW, w, h, &rw, &rh); if (status == XtGeometryAlmost) status = XtMakeResizeRequest((Widget)PW, rw, rh, NULL, NULL); else if (status == XtGeometryNo) XtWarning("PixmapWidget: Geometry request denied"); return ((oldw != PW->core.width) || (oldh != PW->core.height)); } static void Resize(PW) PixmapWidget PW; { Dimension squareW, squareH; if (PW->pixmap.resize == True) { squareW = max(1, ((int)PW->core.width - 2 * (int)PW->pixmap.distance) / (int)PW->pixmap.width); squareH = max(1, ((int)PW->core.height - 2 * (int)PW->pixmap.distance) / (int)PW->pixmap.height); if (PW->pixmap.proportional) PW->pixmap.squareW = PW->pixmap.squareH = min(squareW, squareH); else { PW->pixmap.squareW = squareW; PW->pixmap.squareH = squareH; } } PW->pixmap.horizOffset = max((Position)PW->pixmap.distance, (Position)(PW->core.width - PW->pixmap.width * PW->pixmap.squareW) / 2); PW->pixmap.vertOffset = max((Position)PW->pixmap.distance, (Position)(PW->core.height - PW->pixmap.height * PW->pixmap.squareH) / 2); PW->pixmap.grid &= ((PW->pixmap.squareW > PW->pixmap.grid_tolerance) && (PW->pixmap.squareH > PW->pixmap.grid_tolerance)); } static void Redisplay(PW, event, region) PixmapWidget PW; XEvent *event; Region region; { if(event->type == Expose) { if (PW->core.visible) { Refresh(PW, event->xexpose.x, event->xexpose.y, event->xexpose.width, event->xexpose.height); } } } #if NeedFunctionPrototypes void PWClip(Widget w, Position from_x, Position from_y, Position to_x, Position to_y) #else void PWClip(w, from_x, from_y, to_x, to_y) Widget w; Position from_x, from_y, to_x, to_y; #endif { PixmapWidget PW = (PixmapWidget) w; XRectangle rectangle; QuerySwap(from_x, to_x); QuerySwap(from_y, to_y); from_x = max(0, from_x); from_y = max(0, from_y); to_x = min(PW->pixmap.width - 1, to_x); to_y = min(PW->pixmap.height - 1, to_y); rectangle.x = InWindowX(PW, from_x); rectangle.y = InWindowY(PW, from_y); rectangle.width = InWindowX(PW, to_x + 1) - InWindowX(PW, from_x); rectangle.height = InWindowY(PW, to_y + 1) - InWindowY(PW, from_y); XSetClipRectangles(dpy, PW->pixmap.highlighting_gc, 0, 0, &rectangle, 1, Unsorted); XSetClipRectangles(dpy, PW->pixmap.drawing_gc, 0, 0, &rectangle, 1, Unsorted); XSetClipRectangles(dpy, PW->pixmap.framing_gc, 0, 0, &rectangle, 1, Unsorted); } #if NeedFunctionPrototypes void PWUnclip(Widget w) #else void PWUnclip(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; XRectangle rectangle; rectangle.x = InWindowX(PW, 0); rectangle.y = InWindowY(PW, 0); rectangle.width = InWindowX(PW, PW->pixmap.width) - InWindowX(PW, 0); rectangle.height = InWindowY(PW, PW->pixmap.height) - InWindowY(PW, 0); XSetClipRectangles(dpy, PW->pixmap.highlighting_gc, 0, 0, &rectangle, 1, Unsorted); XSetClipRectangles(dpy, PW->pixmap.drawing_gc, 0, 0, &rectangle, 1, Unsorted); XSetClipRectangles(dpy, PW->pixmap.framing_gc, 0, 0, &rectangle, 1, Unsorted); } void Refresh(PW, x, y, width, height) PixmapWidget PW; Position x, y; Dimension width, height; { XRectangle rectangle; XDefineCursor(dpy, XtWindow(PW), PW->pixmap.cursor); rectangle.x = min(x, InWindowX(PW, InPixmapX(PW, x))); rectangle.y = min(y, InWindowY(PW, InPixmapY(PW, y))); rectangle.width = max(x + width, InWindowX(PW, InPixmapX(PW, x + width)+1)) - rectangle.x; rectangle.height = max(y + height, InWindowY(PW, InPixmapY(PW, y + height)+1)) - rectangle.y; XClearArea(dpy, XtWindow(PW), rectangle.x, rectangle.y, rectangle.width, rectangle.height, False); XSetClipRectangles(dpy, PW->pixmap.framing_gc, 0, 0, &rectangle, 1, Unsorted); XDrawRectangle(dpy, XtWindow(PW), PW->pixmap.framing_gc, InWindowX(PW, 0) - 1, InWindowY(PW, 0) - 1, InWindowX(PW, PW->pixmap.width) - InWindowX(PW, 0) + 1, InWindowY(PW, PW->pixmap.height) - InWindowY(PW, 0) + 1); PWClip((Widget) PW, InPixmapX(PW, x),InPixmapY(PW, y), InPixmapX(PW, x + width), InPixmapY(PW, y + height)); PWRedrawSquares((Widget) PW, InPixmapX(PW, x), InPixmapY(PW, y), InPixmapX(PW, x + width), InPixmapY(PW, y + height)); PWRedrawGrid((Widget) PW, InPixmapX(PW, x), InPixmapY(PW, y), InPixmapX(PW, x + width), InPixmapY(PW, y + height)); PWRedrawMark((Widget) PW); PWRedrawHotSpot((Widget) PW); if (PW->pixmap.redrawCallback) PW->pixmap.redrawCallback( (Widget) PW, Set ); /* redraw extensions */ PWRedrawAxes((Widget) PW); PWUnclip((Widget) PW); } #if NeedFunctionPrototypes void PWSwitchGrid(Widget w) #else void PWSwitchGrid(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; PW->pixmap.grid ^= TRUE; PWDrawGrid(w, 0, 0, PW->pixmap.image->width - 1, PW->pixmap.image->height - 1); } #if NeedFunctionPrototypes void PWGrid(Widget w, Boolean _switch) #else void PWGrid(w, _switch) Widget w; Boolean _switch; #endif { PixmapWidget PW = (PixmapWidget) w; if (PW->pixmap.grid != _switch) PWSwitchGrid(w); } static Boolean SetValues(current, request, new) Widget current, request, new; { PixmapWidget p_old = (PixmapWidget) current; PixmapWidget p_new = (PixmapWidget) new; PixmapWidget p_req = (PixmapWidget) request; if ((p_old->pixmap.cursor != p_req->pixmap.cursor) && XtIsRealized(new)) XDefineCursor(XtDisplay(new), XtWindow(new), p_new->pixmap.cursor); if (p_old->pixmap.squareW != p_req->pixmap.squareW) { if ((p_old->pixmap.proportional == True) && (p_new->pixmap.squareH != p_new->pixmap.squareW)) p_new->pixmap.squareH = p_new->pixmap.squareW; InternalResize(p_new); } if (p_old->pixmap.squareH != p_req->pixmap.squareH) { if ((p_old->pixmap.proportional == True) && (p_new->pixmap.squareH != p_new->pixmap.squareW)) p_new->pixmap.squareW = p_new->pixmap.squareH; InternalResize(p_new); } return FALSE; } #if NeedFunctionPrototypes Boolean PWQueryProportional(Widget w) #else Boolean PWQueryProportional(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; return (PW->pixmap.proportional); } #if NeedFunctionPrototypes void PWSwitchProportional(Widget w) #else void PWSwitchProportional(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; int resized; PW->pixmap.proportional ^= True; resized = InternalResize(PW); if (PW->core.visible && !resized) XClearArea(dpy, XtWindow(PW), 0, 0, PW->core.width, PW->core.height, True); } #if NeedFunctionPrototypes void PWProportional(Widget w, Boolean _switch) #else void PWProportional(w, _switch) Widget w; Boolean _switch; #endif { PixmapWidget PW = (PixmapWidget) w; if (PW->pixmap.proportional != _switch) PWSwitchProportional(w); } #if NeedFunctionPrototypes void PWSetPickPixelDrawProc( Widget w, PickPixelProc proc ) #else void PWSetPickPixelDrawProc( w, proc ) Widget w; PickPixelProc proc; #endif { PixmapWidget PW = (PixmapWidget) w; PW->pixmap.pickPixelDraw = proc; } #if NeedFunctionPrototypes void PWSetPickPixelCompleteProc( Widget w, PickPixelProc proc ) #else void PWSetPickPixelCompleteProc( w, proc ) Widget w; PickPixelProc proc; #endif { PixmapWidget PW = (PixmapWidget) w; PW->pixmap.pickPixelComplete = proc; } #if NeedFunctionPrototypes void PWSetDrawPointProc( Widget w, PWDrawPointProc proc ) #else void PWSetDrawPointProc( w, proc ) Widget w; PWDrawPointProc proc; #endif { PixmapWidget PW = (PixmapWidget) w; PW->pixmap.drawPointCallback = proc; } #if NeedFunctionPrototypes void PWSetRedrawProc( Widget w, PWRedrawProc proc ) #else void PWSetRedrawProc( w, proc ) Widget w; PWRedrawProc proc; #endif { PixmapWidget PW = (PixmapWidget) w; PW->pixmap.redrawCallback = proc; } #if NeedFunctionPrototypes void PWSetTranslateProc( Widget w, PWTranslateProc proc ) #else void PWSetTranslateProc( w, proc ) Widget w; PWTranslateProc proc; #endif { PixmapWidget PW = (PixmapWidget) w; PW->pixmap.translateCallback = proc; } #if NeedFunctionPrototypes void PWSetRotateProc( Widget w, PWRotateProc proc ) #else void PWSetRotateProc( w, proc ) Widget w; PWRotateProc proc; #endif { PixmapWidget PW = (PixmapWidget) w; PW->pixmap.rotateCallback = proc; } #if NeedFunctionPrototypes void PWSetFlipProc( Widget w, PWFlipProc proc ) #else void PWSetFlipProc( w, proc ) Widget w; PWFlipProc proc; #endif { PixmapWidget PW = (PixmapWidget) w; PW->pixmap.flipCallback = proc; } #if NeedFunctionPrototypes void PWSetFont( Widget w, XFontStruct *font_struct ) #else void PWSetFont( w, font_struct ) Widget w; XFontStruct *font_struct; #endif { PixmapWidget PW = (PixmapWidget) w; PW->pixmap.font_struct = font_struct; if ( PW->pixmap.font_struct && PW->pixmap.text_string ) { int direction, ascent, descent; XCharStruct size; XTextExtents( PW->pixmap.font_struct, PW->pixmap.text_string, strlen(PW->pixmap.text_string), &direction, &ascent, &descent, &size ); PW->pixmap.text_rbearing = size.rbearing; PW->pixmap.text_lbearing = size.lbearing; PW->pixmap.text_ascent = size.ascent; PW->pixmap.text_descent = size.descent; } } #if NeedFunctionPrototypes void PWSetText( Widget w, String s ) #else void PWSetText( w, s ) Widget w; String s; #endif { PixmapWidget PW = (PixmapWidget) w; PW->pixmap.text_string = XtNewString( s ); if ( PW->pixmap.font_struct && PW->pixmap.text_string ) { int direction, ascent, descent; XCharStruct size; XTextExtents( PW->pixmap.font_struct, PW->pixmap.text_string, strlen(PW->pixmap.text_string), &direction, &ascent, &descent, &size ); PW->pixmap.text_rbearing = size.rbearing; PW->pixmap.text_lbearing = size.lbearing; PW->pixmap.text_ascent = size.ascent; PW->pixmap.text_descent = size.descent; } } pixmap-2.6pl4.orig/PixmapP.h100440 243 144 16412 6263264165 14547 0ustar joostusers/* * $Id: PixmapP.h,v 1.12 1996/08/21 16:26:16 lmallet Exp $ * * Copyright (c) 1991-1994 Lionel MALLET * * 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 Lionel MALLET 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 Lionel MALLET shall * not be used in advertising or otherwise to promote the sale, use or * other dealings in this Software without prior written authorization * from Lionel MALLET. * * Author: Lionel Mallet, SIMULOG */ /* * $XConsortium: PixmapP.h,v 1.6 90/06/09 20:19:47 dmatic Exp $ * * Copyright 1989 Massachusetts Institute of Technology * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, 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 M.I.T. not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. M.I.T. makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. * 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. * * Author: Davor Matic, MIT X Consortium */ #ifndef _PixmapP_h #define _PixmapP_h #include "Pixmap.h" #include typedef struct { Atom *targets; Cardinal num_targets; PWRequestRec *requests; Cardinal num_requests; PWRequestRec *request[100]; } PixmapClassPart; /* Full class record declaration */ typedef struct _PixmapClassRec { CoreClassPart core_class; PixmapClassPart pixmap_class; } PixmapClassRec; extern PixmapClassRec pixmapClassRec; /**********/ struct _PWRequestRec { char *name; int status_size; void (*engage)(); XtPointer engage_client_data; void (*terminate)(); XtPointer terminate_client_data; void (*remove)(); XtPointer remove_client_data; }; typedef struct { Position from_x, from_y, to_x, to_y; } PWArea; typedef struct { PWRequestRec *request; XtPointer status; Boolean trap; XtPointer call_data; } PWRequestStack; typedef struct { XImage *image, *mask_image, *buffer, *mask_buffer; XPoint hot; Position at_x, at_y; Boolean fold; Boolean grid; Boolean changed; } PWZoom; typedef struct { Boolean own; Boolean limbo; } PWSelection; /* New fields for the Pixmap widget record */ typedef struct { /* resources */ Cursor cursor; Pixel foreground_pixel; Pixel highlight_pixel; Pixel framing_pixel; Pixel transparent_pixel; Pixmap stipple; Boolean stippled; Boolean proportional; Boolean grid; Dimension grid_tolerance; Boolean axes; Boolean resize; Dimension distance, squareW, squareH, width, height; int button_action[5]; String filename; AddColorNotifyProc AddColorNotify; /* private state */ int nextensions, buffer_nextensions; XpmExtension *extensions, *buffer_extensions; PWDrawPointProc drawPointCallback; PWRedrawProc redrawCallback; PWTranslateProc translateCallback; PWRotateProc rotateCallback; PWFlipProc flipCallback; XFontStruct *font_struct; String text_string; int text_lbearing, text_rbearing; int text_ascent, text_descent; XPoint hot; XPoint buffer_hot; XPoint storage_hot; Pixel clear_pixel; Position horizOffset, vertOffset; void (*notify)(); UseColorNotifyProc colorNotify; ExtensionNotifyProc extensionNotify; PickPixelProc pickPixelDraw; PickPixelProc pickPixelComplete; PWRequestStack *request_stack; Cardinal cardinal, current; /*Boolean trapping;*/ XImage *image, *mask_image, *buffer, *mask_buffer; XImage *storage, *mask_storage; PWArea mark, buffer_mark; GC drawing_gc; GC highlighting_gc; GC framing_gc; GC transparent_gc; Boolean changed; Boolean fold; Boolean zooming; PWZoom zoom; XtPointer *value; char *status; PWSelection selection; PWColorInfo **colorTable; char *hints_cmt; char *colors_cmt; char *pixels_cmt; } PixmapPart; /* Full instance record declaration */ typedef struct _PixmapRec { CorePart core; PixmapPart pixmap; } PixmapRec; /* Private functions */ #define InPixmapX(PW, x)\ (Position) (min((Position)((max(PW->pixmap.horizOffset, x) -\ PW->pixmap.horizOffset) /\ PW->pixmap.squareW), PW->pixmap.width - 1)) #define InPixmapY(PW, y)\ (Position) (min((Position)((max(PW->pixmap.vertOffset, y) -\ PW->pixmap.vertOffset) /\ PW->pixmap.squareH), PW->pixmap.height - 1)) #define InWindowX(PW, x)\ (Position) (PW->pixmap.horizOffset + ((x) * PW->pixmap.squareW)) #define InWindowY(PW, y)\ (Position) (PW->pixmap.vertOffset + ((y) * PW->pixmap.squareH)) #define QuerySet(x, y) (((x) != NotSet) && ((y) != NotSet)) #define QueryZero(x, y) (((x) == 0) || ((y) == 0)) #define Swap(x, y) {Position t; t = x; x = y; y = t;} #define QuerySwap(x, y) if(x > y) Swap(x, y) #define QueryInPixmap(PW, x, y)\ (((x) >= 0) && ((x) < PW->pixmap.image->width) &&\ ((y) >= 0) && ((y) < PW->pixmap.image->height)) #define Value(PW, button) (PW->pixmap.button_action[button - 1]) XImage *GetImage(); Pixmap GetPixmap(); XImage *CreatePixmapImage(); XImage *CreateMaskImage(); void DestroyPixmapImage(); #define DestroyMaskImage(mask) DestroyPixmapImage(mask) #endif /* _PixmapP_h */ pixmap-2.6pl4.orig/PortEdit.c100440 243 144 61662 5564722322 14722 0ustar joostusers/* * $Id: PortEdit.c,v 1.5 1994/05/13 14:14:05 mallet Exp $ * * Copyright (c) 1991-1994 Lionel MALLET * * 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 Lionel MALLET 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 Lionel MALLET shall * not be used in advertising or otherwise to promote the sale, use or * other dealings in this Software without prior written authorization * from Lionel MALLET. * * Author: Tim Wise - Scientific & Engineering Software (SES), Inc. */ #include Boolean _PORTDEBUG = False; /*--------------------------------------------------------------------------*/ /* p o r t E d i t o r B u t t o n s Buttons for port editor. */ /*--------------------------------------------------------------------------*/ static ButtonRec portEditorButtons[] = { /* buttons ids */ #define kSetPort 0 #define kClearPort 1 #define kMovePort 2 #define kPortInfo 3 /* button recs */ /* id, name, trap, widget */ { kSetPort, "setPort", TOGGLE, NULL }, { kClearPort, "clearPort", TOGGLE, NULL }, { kMovePort, "movePort", TOGGLE, NULL }, { kPortInfo, "portInfo", TOGGLE, NULL } }; /* portEditorButtons */ /*****************************************************************************/ /* Port List Routines A list of ports is kept in the XpmExtension format which is an array of strings, one for each port. Convert string format to Port structure when needed. */ /*****************************************************************************/ #define XpmPortName "Ports" #define UNKNOWN -1 typedef struct { int id; /* unique number */ Position x; /* location of port */ Position y; char info[256]; /* port info: name, kind */ } Port; /*--------------------------------------------------------------------------*/ /* N e w P o r t Allocate a new port structure including a string for info. Return a pointer to allocated structure. */ /*--------------------------------------------------------------------------*/ Port *NewPort() { Port *p; p = (Port *) XtNew(Port); if (p != NULL) { p->id = UNKNOWN; p->x = UNKNOWN; p->y = UNKNOWN; p->info[0] = '\0'; } return p; } /*--------------------------------------------------------------------------*/ /* S t r T o P o r t Convert a string to a port structure. Return a pointer to the port structure. NOTE: Caller must free structure!! */ /*--------------------------------------------------------------------------*/ Boolean StrToPort( str, p ) char *str; Port *p; { char *s, *t; int x, y; if (str != NULL && p != NULL) { sscanf( str, "%d%d%d",&p->id, &x, &y ); p->x = (Position) x; p->y = (Position) y; p->info[0] = '\0'; s = XtMalloc( strlen(str) + 1 ); strcpy( s, str ); t = strtok( s, " ," ); /* first token id */ t = strtok( NULL, " ," ); /* second token x */ t = strtok( NULL, " ," ); /* third token y */ if (t != NULL && t+strlen(t)+1 < s+strlen(str)) strcpy( p->info, t+strlen(t)+1 );/* stuff after tokens */ return True; } else return False; } /*--------------------------------------------------------------------------*/ /* P o r t T o S t r Convert a port structure to a string. Return pointer to string. Caller must free string. */ /*--------------------------------------------------------------------------*/ char *PortToStr( p ) Port *p; { char id_str[40]; char x_str[40]; char y_str[40]; char *str = NULL; if (p != NULL) { sprintf( id_str, "%d", p->id ); sprintf( x_str, "%d", p->x ); sprintf( y_str, "%d", p->y ); str = XtMalloc( strlen(x_str) + strlen(y_str) + strlen(id_str) + strlen(p->info) + 4 ); str[0] = '\0'; strcat( str, id_str ); strcat( str, " " ); strcat( str, x_str ); strcat( str, " " ); strcat( str, y_str ); strcat( str, " " ); strcat( str, p->info ); } return str; } /*--------------------------------------------------------------------------*/ /* U p d a t e P o r t Replace string version of port i with info given in port structure. */ /*--------------------------------------------------------------------------*/ void UpdatePort( ports, i, p ) XpmExtension *ports; int i; Port *p; { XtFree( ports->lines[i] ); ports->lines[i] = PortToStr( p ); } /*--------------------------------------------------------------------------*/ /* F i n d P o r t Search a list of ports and find the first at location (x,y). If found, return index of port; otherwise return UNKNOWN. */ /*--------------------------------------------------------------------------*/ int FindPort( ports, at_x, at_y ) XpmExtension *ports; Position at_x; Position at_y; { int i; Port p; if (strcmp(ports->name, XpmPortName) == 0) { for (i=0; i < ports->nlines ; i++) { if ( StrToPort(ports->lines[i], &p) && p.x == at_x && p.y == at_y ) { return i; } } } return UNKNOWN; } /*--------------------------------------------------------------------------*/ /* I s P o r t See if a port exists at location (x,y). */ /*--------------------------------------------------------------------------*/ Boolean IsPort( w, x, y, return_ports, return_port_i ) Widget w; Position x; Position y; XpmExtension **return_ports; /* list of ports; can be NULL! */ int *return_port_i; /* index of port x,y; can be NULL! */ { Boolean result = False; XpmExtension *ports = NULL; int i; /* if given a list of ports, use them; else get ports from widget */ if ( return_ports != NULL && *return_ports != NULL ) ports = *return_ports; else ports = PWFindExtension( w, XpmPortName ); if ( ports != NULL ) { if ( (i=FindPort(ports, x, y)) >= 0 ) { result = True; } } if ( return_port_i != NULL ) *return_port_i = i; if ( return_ports != NULL ) *return_ports = ports; else if ( ports != NULL ) XpmFreeExtensions( ports, 1 ); /* free ports if caller */ /* doesn't want them */ return result; } /*--------------------------------------------------------------------------*/ /* A d d P o r t Add a port to end of list. Return index of new port. */ /*--------------------------------------------------------------------------*/ int AddPort( ports, at_x, at_y ) XpmExtension *ports; Position at_x; Position at_y; { Port *p; char *port_str; int i = UNKNOWN; if ((p=NewPort()) != NULL) { p->x = at_x; p->y = at_y; p->id = 0; /* mark as new port */ if ( (port_str=PortToStr(p)) != NULL ) { i = ports->nlines; ports->nlines++; if (ports->lines != NULL) ports->lines = (char **) XtRealloc( (char *)ports->lines, ports->nlines * sizeof(char*) ); else ports->lines = (char **) XtNew( char** ); ports->lines[i] = port_str; } XtFree((char *)p); } return i; } /*--------------------------------------------------------------------------*/ /* D e l P o r t Delete port i. Shift array elements above i to the left. */ /*--------------------------------------------------------------------------*/ void DelPort( ports, i ) XpmExtension *ports; int i; { char **s, **t, **last; XtFree( ports->lines[i] ); last = ports->lines + ports->nlines; /* last element */ ports->nlines--; /* shift left elements above deletion, if necessary */ if (ports->nlines > 0) for (t = ports->lines+i, s = ports->lines+i+1; s < last; *t++ = *s++); else { XtFree( (char *)ports->lines ); ports->lines = NULL; } } /*--------------------------------------------------------------------------*/ /* T r a n s l a t e P o r t Add offsets dx and dy to location of port i. */ /*--------------------------------------------------------------------------*/ void TranslatePort( ports, port_i, dx, dy ) XpmExtension *ports; int port_i; int dx; int dy; { Port p; if ( StrToPort(ports->lines[port_i], &p) ) { p.x += dx; p.y += dy; UpdatePort( ports, port_i, &p ); } } /*--------------------------------------------------------------------------*/ /* P r i n t P o r t s */ /*--------------------------------------------------------------------------*/ void PrintPorts( ports ) XpmExtension *ports; { fprintf( stderr, "ports:\n" ); if ( ports ) { int i; for (i = 0; i < ports->nlines; i++) fprintf(stderr, "\t\t%s\n", ports->lines[i]); } } /*****************************************************************************/ /* Port Editor Interface Routines */ /*****************************************************************************/ /*--------------------------------------------------------------------------*/ /* P o r t S h a p e Return an array of points defining a port's shape. */ /*--------------------------------------------------------------------------*/ #define NPortPoints 7 XPoint *PortShape( w, x ,y ) Widget w; Position x; Position y; { static XPoint points[NPortPoints]; float fx = x; float fy = y; points[0].x = PWInWindowX( w, fx ); points[0].y = PWInWindowY( w, fy ); points[1].x = PWInWindowX( w, fx + 0.5 ); points[1].y = PWInWindowY( w, fy + 0.5 ); points[2].x = PWInWindowX( w, fx ); points[2].y = PWInWindowY( w, fy + 1 ); points[3].x = PWInWindowX( w, fx + 1 ); points[3].y = PWInWindowY( w, fy + 1 ); points[4].x = PWInWindowX( w, fx + 0.5 ); points[4].y = PWInWindowY( w, fy + 0.5 ); points[5].x = PWInWindowX( w, fx + 1 ); points[5].y = PWInWindowY( w, fy ); points[6].x = PWInWindowX( w, fx ); points[6].y = PWInWindowY( w, fy ); return points; } /*--------------------------------------------------------------------------*/ /* D r a w P o r t Just draw a port a location (x,y) with given value (set, clear, invert, or highlight). */ /*--------------------------------------------------------------------------*/ #if NeedFunctionPrototypes void DrawPort(Widget w, Position x, Position y, int value) #else void DrawPort(w, x, y, value ) Widget w; Position x; Position y; int value; #endif { GC gc; /* if (_PORTDEBUG) printf( "DrawPort: %d %d \n", x, y ); */ gc = (value == Highlight) ? PWHighlightingGC(w) : PWFramingGC(w); XFillPolygon( XtDisplay(w), XtWindow(w), gc, PortShape(w, x, y), NPortPoints, Convex, CoordModeOrigin ); } /*--------------------------------------------------------------------------*/ /* D r a w I f P o r t Draw a port at location (x,y) if there is a port at that location. This routine is used to highlight a port that a user is trying to pick. */ /*--------------------------------------------------------------------------*/ #if NeedFunctionPrototypes void DrawIfPort(Widget w, Position x, Position y, int value ) #else void DrawIfPort( w, x, y, value ) Widget w; Position x; Position y; int value; #endif { if ( IsPort(w, x, y, NULL, NULL) ) DrawPort( w, x, y, value ); } /*--------------------------------------------------------------------------*/ /* S e t P o r t Create and draw a port at (x,y) if there is not already a port there. */ /*--------------------------------------------------------------------------*/ #if NeedFunctionPrototypes void SetPort(Widget w, Position x, Position y, int value ) #else void SetPort( w, x, y, value ) Widget w; Position x; Position y; int value; #endif { XpmExtension *ports = NULL; if (_PORTDEBUG) printf( "SetPort: %d,%d \n", x, y ); if ( !IsPort(w, x, y, &ports, NULL) ) { if (ports == NULL) { PWAddExtension( w, XpmPortName ); ports = PWFindExtension( w, XpmPortName ); } AddPort( ports, x, y ); DrawPort( w, x, y, value ); if (_PORTDEBUG) PrintPorts( ports ); PWUpdateExtension( w, ports ); XpmFreeExtensions( ports, 1 ); } } /*--------------------------------------------------------------------------*/ /* C l e a r P o r t Delete the port at (x,y) from the port list and erase the port on the screen. */ /*--------------------------------------------------------------------------*/ #if NeedFunctionPrototypes void ClearPort(Widget w, Position x, Position y, int value ) #else void ClearPort( w, x, y, value ) Widget w; Position x; Position y; int value; #endif { XpmExtension *ports = NULL; int port_i; if (_PORTDEBUG) printf("ClearPort : %d,%d \n", x, y); if ( IsPort(w, x, y, &ports, &port_i) ) { DelPort( ports, port_i ); DrawPort( w, x, y, value ); /* erase */ if (_PORTDEBUG) PrintPorts( ports ); if ( ports->nlines == 0 ) PWRemoveExtension( w, XpmPortName ); else PWUpdateExtension( w, ports ); XpmFreeExtensions( ports, 1 ); } } /*--------------------------------------------------------------------------*/ /* D r a g P o r t Draw a port while the user is dragging. Draw only if a port existed at the starting location of the drag. */ /*--------------------------------------------------------------------------*/ static struct { Boolean b; /* Are we dragging a port? */ Position from_x; /* starting point of drag */ Position from_y; int port_i; /* which port is being dragged */ } dragging = { False, UNKNOWN, UNKNOWN, UNKNOWN }; #if NeedFunctionPrototypes void DragPort(Widget w, Position x, Position y, int value ) #else void DragPort( w, x, y, value ) Widget w; Position x; Position y; int value; #endif { int i; /* if beginning of drag a port, ... */ if ( dragging.b == False && IsPort(w, x, y, NULL, &i) ) { dragging.b = True; dragging.from_x = x; dragging.from_y = y; dragging.port_i = i; } if (dragging.b) { DrawPort( w, dragging.from_x, dragging.from_y, value );/* erase */ DrawPort( w, x, y, value );/* draw */ } } /*--------------------------------------------------------------------------*/ /* M o v e P o r t Move a port from one location to another after user has completed dragging. */ /*--------------------------------------------------------------------------*/ #if NeedFunctionPrototypes void MovePort(Widget w, Position to_x, Position to_y, int value ) #else void MovePort( w, to_x, to_y, value ) Widget w; Position to_x; Position to_y; int value; #endif { XpmExtension *ports = NULL; if (_PORTDEBUG) printf("MovePort : from %d,%d to %d,%d \n", dragging.from_x, dragging.from_y, to_x, to_y); if ( dragging.b && !IsPort(w, to_x, to_y, &ports, NULL) ) { DrawPort( w, dragging.from_x, dragging.from_y, value );/* erase old */ DrawPort( w, to_x, to_y, value ); /* draw new */ TranslatePort( ports, dragging.port_i, to_x - dragging.from_x, to_y - dragging.from_y ); PWUpdateExtension( w, ports ); XpmFreeExtensions( ports, 1 ); if (_PORTDEBUG) PrintPorts( ports ); } dragging.b = False; dragging.from_x = UNKNOWN; dragging.from_y = UNKNOWN; dragging.port_i = UNKNOWN; } /*--------------------------------------------------------------------------*/ /* P o r t I n f o Allow the user to edit the port information for the port at (x,y). */ /*--------------------------------------------------------------------------*/ #if NeedFunctionPrototypes void PortInfo(Widget w, Position x, Position y, int value ) #else void PortInfo( w, x, y, value ) Widget w; Position x; Position y; int value; #endif { XpmExtension *ports = NULL; Port p; int i; char *newInfo; if (_PORTDEBUG) printf("PortInfo : %d,%d\n", x, y); if ( IsPort(w, x, y, &ports, &i) ) { StrToPort( ports->lines[i], &p ); if ( PopupDialog( input_dialog, "Port Info: ", p.info, &newInfo, XtGrabExclusive) == Okay ) { strcpy( p.info, newInfo ); UpdatePort( ports, i, &p ); } if (_PORTDEBUG) PrintPorts( ports ); PWUpdateExtension( w, ports ); XpmFreeExtensions( ports, 1 ); } } /*--------------------------------------------------------------------------*/ /* R e d r a w P o r t s Redraw all ports of PixmapWidget. */ /*--------------------------------------------------------------------------*/ void RedrawPorts( w, value ) Widget w; int value; { XpmExtension *ports = NULL; Port p; int i; if ( (ports=PWFindExtension( w, XpmPortName )) != NULL ) { for ( i=0; i < ports->nlines; i++ ) { StrToPort( ports->lines[i], &p ); DrawPort( w, p.x, p.y, value ); } } } /*--------------------------------------------------------------------------*/ /* T r a n s l a t e P o r t s For all ports in PixmapWidget, add dx,dy to the ports location. */ /*--------------------------------------------------------------------------*/ void TranslatePorts( w, dx, dy ) Widget w; Position dx; Position dy; { XpmExtension *ports = NULL; Port p; int i; if (_PORTDEBUG) printf("TranslatePorts : %d,%d\n", dx, dy); if ( (ports=PWFindExtension( w, XpmPortName )) != NULL ) { for ( i=0; i < ports->nlines; i++ ) { StrToPort( ports->lines[i], &p ); DrawPort( w, p.x, p.y, Clear ); /* erase old */ PWTranslatePoint( w, &p.x, &p.y, dx, dy ); DrawPort( w, p.x, p.y, Set ); /* draw new */ UpdatePort( ports, i, &p ); } if (_PORTDEBUG) PrintPorts( ports ); PWUpdateExtension( w, ports ); XpmFreeExtensions( ports, 1 ); } } /*--------------------------------------------------------------------------*/ /* F l i p P o r t s Flip all ports of a PixmapWidget either horiziontally or vertically. */ /*--------------------------------------------------------------------------*/ void FlipPorts( w, axis ) Widget w; enum FlipAxis axis; { XpmExtension *ports = NULL; Port p; int i; if ( (ports=PWFindExtension( w, XpmPortName )) != NULL ) { for ( i=0; i < ports->nlines; i++ ) { StrToPort( ports->lines[i], &p ); DrawPort( w, p.x, p.y, Clear ); /* erase old */ PWFlipPoint( w, &p.x, &p.y, axis ); DrawPort( w, p.x, p.y, Set ); /* draw new */ UpdatePort( ports, i, &p ); } if (_PORTDEBUG) PrintPorts( ports ); PWUpdateExtension( w, ports ); XpmFreeExtensions( ports, 1 ); } } /*--------------------------------------------------------------------------*/ /* R o t a t e P o r t s Flip all ports of a PixmapWidget either left or right 90 degrees. */ /*--------------------------------------------------------------------------*/ void RotatePorts( w, direction ) Widget w; enum RotateDirection direction; { XpmExtension *ports = NULL; Port p; int i; if ( (ports=PWFindExtension( w, XpmPortName )) != NULL ) { for ( i=0; i < ports->nlines; i++ ) { StrToPort( ports->lines[i], &p ); DrawPort( w, p.x, p.y, Clear ); /* erase old */ PWRotatePoint( w, &p.x, &p.y, direction ); DrawPort( w, p.x, p.y, Set ); /* draw new */ UpdatePort( ports, i, &p ); } if (_PORTDEBUG) PrintPorts( ports ); PWUpdateExtension( w, ports ); XpmFreeExtensions( ports, 1 ); } } /*--------------------------------------------------------------------------*/ /* P o r t E d i t o r C a l l b a c k Callback for all port editor buttons */ /*--------------------------------------------------------------------------*/ void PortEditorCallback( w, client_data, call_data ) Widget w; XtPointer client_data, call_data; { int *id = (int *)client_data; switch (*id) { case kSetPort: if (_PORTDEBUG) printf( "PortEditorCallback: %s\n", portEditorButtons[*id].name ); PWRemoveAllRequests( pixmap_widget ); PWSetPickPixelDrawProc( pixmap_widget, DrawPort ); PWSetPickPixelCompleteProc( pixmap_widget, SetPort ); PWEngageRequest( pixmap_widget, PickPixelRequest, True, Plain ); break; case kClearPort: if (_PORTDEBUG) printf( "PortEditorCallback: %s\n", portEditorButtons[*id].name ); PWRemoveAllRequests( pixmap_widget ); PWSetPickPixelDrawProc( pixmap_widget, DrawIfPort ); PWSetPickPixelCompleteProc( pixmap_widget, ClearPort ); PWEngageRequest( pixmap_widget, PickPixelRequest, True, Plain ); break; case kMovePort: if (_PORTDEBUG) printf( "PortEditorCallback: %s\n", portEditorButtons[*id].name ); PWRemoveAllRequests( pixmap_widget ); PWSetPickPixelDrawProc( pixmap_widget, DragPort ); PWSetPickPixelCompleteProc( pixmap_widget, MovePort ); PWEngageRequest( pixmap_widget, PickPixelRequest, True, Plain ); break; case kPortInfo: if (_PORTDEBUG) printf( "PortEditorCallback: %s\n", portEditorButtons[*id].name ); PWRemoveAllRequests( pixmap_widget ); PWSetPickPixelDrawProc( pixmap_widget, DrawIfPort ); PWSetPickPixelCompleteProc( pixmap_widget, PortInfo ); PWEngageRequest( pixmap_widget, PickPixelRequest, True, Plain ); break; default: printf( "PortEditorCallback: invalid id = %d\n", *id ); } /* switch */ } /* PortEditorCallback */ /*--------------------------------------------------------------------------*/ /* C r e a t e P o r t E d i t o r B u t t o n s Create buttons of port editor. */ /*--------------------------------------------------------------------------*/ void CreatePortEditorButtons( parentW, radioGroupW ) Widget parentW; /* parent widget of port editor buttons */ Widget radioGroupW; /* radio group to add port editor buttons */ { int i; Widget w; for (i = 0; i < XtNumber(portEditorButtons); i++) { #ifndef USE_ATHENA w = XmCreateToggleButtonGadget(parentW, portEditorButtons[i].name, NULL, 0); XtManageChild(w); portEditorButtons[i].widget = w; XtAddCallback(w, XmNvalueChangedCallback, PortEditorCallback, &portEditorButtons[i].id ); #else w = XtCreateWidget( portEditorButtons[i].name, toggleWidgetClass, parentW, NULL, 0 ); portEditorButtons[i].widget = w; XtAddCallback( w, XtNcallback, PortEditorCallback, &portEditorButtons[i].id ); /* add to button to radio group */ XtVaSetValues( w, XtNradioGroup, radioGroupW, NULL ); #endif } } /*--------------------------------------------------------------------------*/ /* M a n a g e P o r t E d i t o r B u t t o n s Manage or unmanage the buttons of port editor depending on flag. */ /*--------------------------------------------------------------------------*/ void ManagePortEditorButtons( manage ) Boolean manage; /* if true, manage; otherwise unmanage */ { int i; for (i = 0; i < XtNumber(portEditorButtons); i++) { if (manage) XtManageChild( portEditorButtons[i].widget ); else XtUnmanageChild( portEditorButtons[i].widget ); } } pixmap-2.6pl4.orig/Requests.h100440 243 144 14421 5567053477 15012 0ustar joostusers/* * Last edited: Sep 12 16:59 1991 (mallet) */ /* * $Id: Requests.h,v 1.4.1.1 1992/08/05 15:26:04 mallet Exp $ * * Copyright 1991 Lionel Mallet * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appears in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Lionel MALLET not be used in * advertising or publicity pertaining to distribution of the software * without specific, written prior permission. Lionel MALLET makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * Lionel MALLET DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS, IN NO EVENT SHALL Lionel MALLET 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 software is opened and free. Furthermore, everybody is kindly * invited to participate to improve it for the benefit of all. * Improvements can be new features, bugs fixes and porting issues * resolution. * * Author: Lionel Mallet, SIMULOG */ /* * $XConsortium: Requests.h,v 1.2 90/06/09 20:20:44 dmatic Exp $ * * Copyright 1989 Massachusetts Institute of Technology * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, 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 M.I.T. not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. M.I.T. makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. * 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. * * Author: Davor Matic, MIT X Consortium */ typedef struct { Boolean success; Position at_x, at_y; Position from_x, from_y, to_x, to_y; void (*draw)(); Pixel value; Time time; int state; } PWStatus; void OnePointEngage(); void OnePointTerminate(); void OnePointTerminateTransparent(); void DragOnePointEngage(); void DragOnePointTerminate(); void TwoPointsEngage(); void TwoPointsTerminate(); void TwoPointsTerminateTransparent(); void TwoPointsTerminateTimed(); void DragTwoPointsEngage(); void DragTwoPointsTerminate(); void Interface(); void Paste(); static PWRequestRec requests[] = { {MarkRequest, sizeof(PWStatus), TwoPointsEngage, (XtPointer) PWDrawRectangle, TwoPointsTerminateTimed, (XtPointer) PWSelect, NULL, (XtPointer) NULL}, {RestoreRequest, sizeof(PWStatus), OnePointEngage, (XtPointer) PWDragStored, OnePointTerminate, (XtPointer) PWRestore, NULL, (XtPointer) NULL}, {ImmediateCopyRequest, sizeof(PWStatus), OnePointEngage, (XtPointer) PWDragMarked, OnePointTerminate, (XtPointer) PWCopy, NULL, (XtPointer) NULL}, {ImmediateMoveRequest, sizeof(PWStatus), OnePointEngage, (XtPointer) PWDragMarked, OnePointTerminate, (XtPointer) PWMove, NULL, (XtPointer) NULL}, {CopyRequest, sizeof(PWStatus), DragOnePointEngage, (XtPointer) Paste, DragOnePointTerminate, (XtPointer) ImmediateCopyRequest, Interface, (XtPointer) PWUnmark}, {MoveRequest, sizeof(PWStatus), DragOnePointEngage, (XtPointer) Paste, DragOnePointTerminate, (XtPointer) ImmediateMoveRequest, Interface, (XtPointer) PWUnmark}, {PointRequest, sizeof(PWStatus), DragOnePointEngage, (XtPointer) PWDrawPoint, DragOnePointTerminate, (XtPointer) PWDrawPoint, NULL, (XtPointer) NULL}, {CurveRequest, sizeof(PWStatus), DragTwoPointsEngage, (XtPointer) PWBlindLine, DragTwoPointsTerminate, (XtPointer) PWBlindLine, NULL, (XtPointer) NULL}, {LineRequest, sizeof(PWStatus), TwoPointsEngage, (XtPointer) PWDrawLine, TwoPointsTerminate, (XtPointer) PWDrawLine, NULL, (XtPointer) NULL}, {RectangleRequest, sizeof(PWStatus), TwoPointsEngage, (XtPointer) PWDrawRectangle, TwoPointsTerminate, (XtPointer) PWDrawRectangle, NULL, (XtPointer) NULL}, {FilledRectangleRequest, sizeof(PWStatus), TwoPointsEngage, (XtPointer) PWDrawRectangle, TwoPointsTerminate, (XtPointer) PWDrawFilledRectangle, NULL, (XtPointer) NULL}, {CircleRequest, sizeof(PWStatus), TwoPointsEngage, (XtPointer) PWDrawCircle, TwoPointsTerminate, (XtPointer) PWDrawCircle, NULL, (XtPointer) NULL}, {FilledCircleRequest, sizeof(PWStatus), TwoPointsEngage, (XtPointer) PWDrawCircle, TwoPointsTerminate, (XtPointer) PWDrawFilledCircle, NULL, (XtPointer) NULL}, {FloodFillRequest, sizeof(PWStatus), OnePointEngage, (XtPointer) NULL, OnePointTerminate, (XtPointer) PWFloodFill, NULL, (XtPointer) NULL}, {HotSpotRequest, sizeof(PWStatus), OnePointEngage, (XtPointer) PWDrawHotSpot, OnePointTerminate, (XtPointer) PWDrawHotSpot, NULL, (XtPointer) NULL}, {PickPixelRequest, sizeof(PWStatus), OnePointEngage, (XtPointer) PWPickPixelDraw, OnePointTerminate, (XtPointer) PWPickPixelComplete, NULL, (XtPointer) NULL}, {ZoomInRequest, sizeof(PWStatus), TwoPointsEngage, (XtPointer) PWDrawRectangle, TwoPointsTerminate, (XtPointer) PWZoomIn, NULL, (XtPointer) NULL}, {TextRequest, sizeof(PWStatus), OnePointEngage, (XtPointer) PWDragText, OnePointTerminate, (XtPointer) PWDrawText, NULL, (XtPointer) NULL}, }; pixmap-2.6pl4.orig/ReqMach.c100440 243 144 24135 5564722323 14503 0ustar joostusers/* * $Id: ReqMach.c,v 1.4 1994/05/13 14:14:26 mallet Exp $ * * Copyright (c) 1991-1994 Lionel MALLET * * 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 Lionel MALLET 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 Lionel MALLET shall * not be used in advertising or otherwise to promote the sale, use or * other dealings in this Software without prior written authorization * from Lionel MALLET. * * Author: Lionel Mallet, SIMULOG */ /* * $XConsortium: ReqMach.c,v 1.1 90/06/09 20:20:41 dmatic Exp $ * * Copyright 1989 Massachusetts Institute of Technology * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, 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 M.I.T. not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. M.I.T. makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. * 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. * * Author: Davor Matic, MIT X Consortium */ #include #include #include #include #include #include #include "PixmapP.h" #include #include #define XtStrlen(s) ((s) ? strlen(s) : 0) #define abs(x) (((x) > 0) ? (x) : -(x)) #define min(x, y) (((x) < (y)) ? (x) : (y)) #define max(x, y) (((x) > (y)) ? (x) : (y)) /*****************************************************************************\ * Request Machine: stacks up and handles requests from application calls. * \*****************************************************************************/ /* * Searches for a request record of a request specified by its name. * Returns a pointer to the record or NULL if the request was not found. */ PWRequestRec *FindRequest(name) PWRequest name; { int i; for (i = 0; i < pixmapClassRec.pixmap_class.num_requests; i++) if (!strcmp(name, pixmapClassRec.pixmap_class.requests[i].name)) return &pixmapClassRec.pixmap_class.requests[i]; return NULL; } /* * Adds a request to the request stack and does proper initializations. * Returns TRUE if the request was found and FALSE otherwise. */ #if NeedFunctionPrototypes Boolean PWAddRequest(Widget w, PWRequest name, Boolean trap, XtPointer call_data, Cardinal call_data_size) #else Boolean PWAddRequest(w, name, trap, call_data, call_data_size) Widget w; PWRequest name; Boolean trap; XtPointer call_data; Cardinal call_data_size; #endif { PixmapWidget PW = (PixmapWidget) w; PWRequestRec *request; if((request = FindRequest(name)) != (PWRequestRec *)0) { if (_PWDEBUG) fprintf(stderr, "Adding... Cardinal: %d\n", PW->pixmap.cardinal + 1); PW->pixmap.request_stack = (PWRequestStack *) XtRealloc((char *)PW->pixmap.request_stack, (Cardinal)((++PW->pixmap.cardinal + 1) * sizeof(PWRequestStack))); PW->pixmap.request_stack[PW->pixmap.cardinal].request = request; PW->pixmap.request_stack[PW->pixmap.cardinal].status = XtMalloc(request->status_size); PW->pixmap.request_stack[PW->pixmap.cardinal].trap = trap; PW->pixmap.request_stack[PW->pixmap.cardinal].call_data = XtMalloc(call_data_size); bcopy(call_data, PW->pixmap.request_stack[PW->pixmap.cardinal].call_data, call_data_size); return True; } else { XtAppWarning(XtWidgetToApplicationContext(w), "bad request name. PixmapWidget"); return False; } } /* * Engages the request designated by the current parameter. * Returnes TRUE if the request has an engage function and FALSE otherwise. */ Boolean Engage(PW, current) PixmapWidget PW; Cardinal current; { PW->pixmap.current = current; if (_PWDEBUG) fprintf(stderr, "Request: %s\n", PW->pixmap.request_stack[current].request->name); if (PW->pixmap.request_stack[current].request->engage) { (*PW->pixmap.request_stack[current].request->engage) ((Widget) PW, PW->pixmap.request_stack[current].status, PW->pixmap.request_stack[current].request->engage_client_data, PW->pixmap.request_stack[current].call_data); return True; } else return False; } /* * Scans down the request stack removing all requests untill it finds * one to be trapped. */ void TrappingLoop(PW) PixmapWidget PW; { if (_PWDEBUG) fprintf(stderr, "Scanning... Current: %d\n", PW->pixmap.current); if ((PW->pixmap.current > 0) && (!PW->pixmap.request_stack[PW->pixmap.current--].trap)) { PWRemoveRequest((Widget) PW); TrappingLoop(PW); } else if (PW->pixmap.cardinal > 0) { if (_PWDEBUG) fprintf(stderr, "Trapping... Current: %d\n", PW->pixmap.current+1); if(!Engage(PW, ++PW->pixmap.current)) PWTerminateRequest((Widget) PW, True); } } /* * Terimantes the current request and continues with next request if con = TRUE * Returnes TRUE if there is any number of requests left on the stack. */ #if NeedFunctionPrototypes Boolean PWTerminateRequest(Widget w, Boolean cont) #else Boolean PWTerminateRequest(w, cont) Widget w; Boolean cont; #endif { PixmapWidget PW = (PixmapWidget) w; if (PW->pixmap.current > 0) { if (_PWDEBUG) fprintf(stderr, "Terminating... Current: %d\n", PW->pixmap.current); if (PW->pixmap.request_stack[PW->pixmap.current].request->terminate) (*PW->pixmap.request_stack[PW->pixmap.current].request->terminate) (w, PW->pixmap.request_stack[PW->pixmap.current].status, PW->pixmap.request_stack[PW->pixmap.current].request->terminate_client_data, PW->pixmap.request_stack[PW->pixmap.current].call_data); if (cont) { if (PW->pixmap.current == PW->pixmap.cardinal) TrappingLoop(PW); else { if (_PWDEBUG) fprintf(stderr, "Continuing... Current: %d\n", PW->pixmap.current+1); if (!Engage(PW, ++PW->pixmap.current)) PWTerminateRequest(w, True); } } else PW->pixmap.current = 0; } return PW->pixmap.current; } /* * Simple interface to PWTerminateRequest that takes only a widget. */ #if NeedFunctionPrototypes void PWTerminate(Widget w) #else void PWTerminate(w) Widget w; #endif { PWTerminateRequest(w, True); } /* * Removes the top request from the request stack. If the request is active * it will terminate it. * Returns TRUE if the number of requests left on the stack != 0. */ #if NeedFunctionPrototypes Boolean PWRemoveRequest(Widget w) #else Boolean PWRemoveRequest(w) Widget w; #endif { PixmapWidget PW = (PixmapWidget) w; if (PW->pixmap.cardinal > 0) { if (_PWDEBUG) fprintf(stderr, "Removing... Cardinal: %d\n", PW->pixmap.cardinal); if (PW->pixmap.current == PW->pixmap.cardinal) PWTerminateRequest(w, False); if (PW->pixmap.request_stack[PW->pixmap.cardinal].request->remove) (*PW->pixmap.request_stack[PW->pixmap.cardinal].request->remove) (w, PW->pixmap.request_stack[PW->pixmap.cardinal].status, PW->pixmap.request_stack[PW->pixmap.cardinal].request->remove_client_data, PW->pixmap.request_stack[PW->pixmap.cardinal].call_data); XtFree(PW->pixmap.request_stack[PW->pixmap.cardinal].status); XtFree(PW->pixmap.request_stack[PW->pixmap.cardinal].call_data); PW->pixmap.request_stack = (PWRequestStack *) XtRealloc((char *)PW->pixmap.request_stack, (Cardinal)((--PW->pixmap.cardinal + 1) * sizeof(PWRequestStack))); return True; } else return False; } #if NeedFunctionPrototypes void PWRemoveAllRequests(Widget w) #else void PWRemoveAllRequests(w) Widget w; #endif { while (PWRemoveRequest(w)) {/* removes all requests from the stack */} } /* * Adds the request to the stack and performs engaging ritual. * Returns TRUE if the request was found, FALSE otherwise. */ #if NeedFunctionPrototypes Boolean PWEngageRequest(Widget w, PWRequest name, Boolean trap, XtPointer call_data, Cardinal call_data_size) #else Boolean PWEngageRequest(w, name, trap, call_data, call_data_size) Widget w; PWRequest name; Boolean trap; XtPointer call_data; Cardinal call_data_size; #endif { PixmapWidget PW = (PixmapWidget) w; if (PWAddRequest(w, name, trap, call_data, call_data_size)) { PWTerminateRequest(w, False); if (_PWDEBUG) fprintf(stderr, "Engaging... Cardinal: %d\n", PW->pixmap.cardinal); if (!Engage(PW, PW->pixmap.cardinal)) PWTerminateRequest(w, True); return True; } else return False; } /************************* End of the Request Machine ************************/ pixmap-2.6pl4.orig/TextOpt.c100440 243 144 23620 5564722324 14571 0ustar joostusers/* * $Id: TextOpt.c,v 1.6 1994/05/13 14:14:41 mallet Exp $ * * Copyright (c) 1991-1994 Lionel MALLET * * 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 Lionel MALLET 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 Lionel MALLET shall * not be used in advertising or otherwise to promote the sale, use or * other dealings in this Software without prior written authorization * from Lionel MALLET. * * Author: Tim Wise - Scientific & Engineering Software (SES), Inc. */ extern void unsetKillfromWM(); static void PopupTextOptions(button, text_options) Widget button; TextOptions *text_options; { Position x, y; Dimension width, height; if (!text_options->up) { XtVaGetValues( button, XtNwidth, &width, XtNheight, &height, NULL ); XtTranslateCoords(button, (Position) (width / 2), (Position) (height / 2), &x, &y ); XtVaSetValues( text_options->shell, XtNx, x, XtNy, y, NULL ); #ifndef USE_ATHENA XtManageChild(text_options->popup); #else XtPopup(text_options->popup, XtGrabNone); #endif unsetKillfromWM(text_options->popup); text_options->up = True; } else text_options->up = False; } static void PopdownTextOptions( w, client_data, call_data ) Widget w; /* button of form of popup */ XtPointer client_data; /* TextOptions* */ XtPointer call_data; /* unused */ { TextOptions *text_options = (TextOptions *) client_data; #ifndef USE_ATHENA XtUnmanageChild(text_options->popup); #else XtPopdown(text_options->popup); #endif } static void Apply( w, client_data, call_data ) Widget w; /* apply button */ XtPointer client_data; /* TextOptions* */ XtPointer call_data; /* unused */ { TextOptions *text_options = (TextOptions *) client_data; String new_font_name = NULL; String new_text_string = NULL; /* get new font name and new text string */ #ifndef USE_ATHENA /* Big hack for Motif: avoid arbitrary resizing problems */ Dimension width, height; XtVaGetValues(text_options->popup, XmNwidth, &width, XmNheight, &height, NULL); new_font_name = (String) XmTextFieldGetString(text_options->font); new_text_string = (String) XmTextFieldGetString(text_options->text); #else XtVaGetValues( text_options->font, XtNstring, &new_font_name, NULL ); new_font_name = XtNewString( new_font_name ); XtVaGetValues( text_options->text, XtNstring, &new_text_string, NULL ); new_text_string = XtNewString( new_text_string ); #endif /* if new font name != current font name, ... */ if (strcmp( new_font_name, text_options->font_name )) { Display *dpy = XtDisplay(text_options->popup); XFontStruct *new_font = XLoadQueryFont( dpy, new_font_name ); if (new_font) { #ifndef USE_ATHENA XmString xmstr; xmstr = XmStringCreateLtoR("Valid font, text ready to paste", XmSTRING_DEFAULT_CHARSET); XtVaSetValues(text_options->status, XmNlabelString, xmstr, NULL); XmStringFree(xmstr); /* Big hack for Motif: avoid arbitrary resizing problems */ XtVaSetValues(text_options->shell, XmNwidth, width, XmNheight, height, NULL); #else XtVaSetValues(text_options->status, XtNlabel, "Valid font, text ready to paste", NULL ); #endif } else { #ifndef USE_ATHENA XmString xmstr; xmstr = XmStringCreateLtoR("No font with this name!", XmSTRING_DEFAULT_CHARSET); XtVaSetValues(text_options->status, XmNlabelString, xmstr, NULL); XmStringFree(xmstr); /* Big hack for Motif: avoid arbitrary resizing problems */ XtVaSetValues(text_options->shell, XmNwidth, width, XmNheight, height, NULL); #else XtVaSetValues( text_options->status, XtNlabel, "No font with this name!", NULL ); #endif } if (text_options->font_struct) XFreeFont( dpy, text_options->font_struct ); XtFree( text_options->font_name ); text_options->font_struct = new_font; text_options->font_name = XtNewString( new_font_name ); PWSetFont( pixmap_widget, text_options->font_struct ); } /* if new text string != current text string, ... */ if (strcmp( new_text_string, text_options->text_string ) != 0) { XtFree( text_options->text_string ); text_options->text_string = XtNewString( new_text_string ); PWSetText( pixmap_widget, text_options->text_string ); } #ifndef USE_ATHENA #endif XtFree( new_font_name ); XtFree( new_text_string ); } #ifdef USE_ATHENA static void ApplyAction( w, event, params, num_params ) Widget w; /* either text or font widget */ XEvent *event; String *params; Cardinal *num_params; { /* how to get TextOptions data structure ? */ /* oh, just use that global pointer */ Apply( w, (XtPointer) textOptions, (XtPointer) NULL ); } static XtActionsRec actions[] = { { "apply", ApplyAction } }; #endif TextOptions* CreateTextOptions(parent, name ) Widget parent; String name; { Widget popup, shell, textOptions, title, status, font_label, font, text_label, text, close, apply; String font_name, text_string; TextOptions *text_options = (TextOptions *)XtCalloc(1, sizeof(TextOptions)); #ifdef USE_ATHENA XtAppAddActions(pixmap_context, actions, XtNumber(actions)); #endif #ifndef USE_ATHENA textOptions = XmCreateFormDialog(parent, name, NULL, 0); popup = textOptions; shell = XtParent(popup); title = XmCreateLabelGadget(textOptions, "title", NULL, 0); XtManageChild(title); status = XmCreateLabelGadget(textOptions, "fontStatus", NULL, 0); XtManageChild(status); font_label = XmCreateLabelGadget(textOptions, "fontLabel", NULL, 0); XtManageChild(font_label); font = (Widget) XmCreateTextField(textOptions, "fontName", NULL, 0); XtManageChild(font); XtAddCallback(font, XmNactivateCallback, Apply, (XtPointer)text_options); text_label = XmCreateLabelGadget(textOptions, "textLabel", NULL, 0); XtManageChild(text_label); text = (Widget) XmCreateTextField(textOptions, "textString", NULL, 0); XtManageChild(text); XtAddCallback(text, XmNactivateCallback, Apply, (XtPointer)text_options); close = XmCreatePushButtonGadget(textOptions, "close", NULL, 0); XtManageChild(close); XtAddCallback(close, XmNactivateCallback, PopdownTextOptions, (XtPointer)text_options); apply = XmCreatePushButtonGadget(textOptions, "apply", NULL, 0); XtManageChild(apply); XtAddCallback(apply, XmNactivateCallback, Apply, (XtPointer)text_options); #else popup = XtCreatePopupShell( "textOptionsShell", transientShellWidgetClass, parent, NULL, 0 ); shell = popup; textOptions = XtCreateManagedWidget( "textOptions", formWidgetClass, popup, NULL, 0 ); title = XtCreateManagedWidget( "title", labelWidgetClass, textOptions, NULL, 0 ); status = XtCreateManagedWidget( "fontStatus", labelWidgetClass, textOptions, NULL, 0 ); font_label = XtCreateManagedWidget( "fontLabel", labelWidgetClass, textOptions, NULL, 0 ); font = XtCreateManagedWidget( "fontName", asciiTextWidgetClass, textOptions, NULL, 0 ); text_label = XtCreateManagedWidget( "textLabel", labelWidgetClass, textOptions, NULL, 0 ); text = XtCreateManagedWidget( "textString", asciiTextWidgetClass, textOptions, NULL, 0 ); close = XtCreateManagedWidget( "close", commandWidgetClass, textOptions, NULL, 0 ); XtAddCallback(close, XtNcallback, PopdownTextOptions, (XtPointer)text_options); apply = XtCreateManagedWidget( "apply", commandWidgetClass, textOptions, NULL, 0 ); XtAddCallback(apply, XtNcallback, Apply, (XtPointer) text_options); #endif text_options->up = False; text_options->popup = popup; text_options->shell = shell; text_options->text = text; text_options->font = font; text_options->status = status; #ifndef USE_ATHENA text_options->font_name = (String)XmTextFieldGetString(text_options->font); #else XtVaGetValues( text_options->font, XtNstring, &font_name, NULL ); text_options->font_name = XtNewString( font_name ); #endif text_options->font_struct = XLoadQueryFont(XtDisplay(parent), text_options->font_name); #ifndef USE_ATHENA text_options->text_string=(String)XmTextFieldGetString(text_options->text); #else XtVaGetValues( text_options->text, XtNstring, &text_string, NULL ); text_options->text_string = XtNewString(text_string); #endif return text_options; } pixmap-2.6pl4.orig/TextOpt.h100440 243 144 3272 5564722324 14557 0ustar joostusers/* * $Id: TextOpt.h,v 1.3 1994/05/13 14:15:01 mallet Exp $ * * Copyright (c) 1991-1994 Lionel MALLET * * 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 Lionel MALLET 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 Lionel MALLET shall * not be used in advertising or otherwise to promote the sale, use or * other dealings in this Software without prior written authorization * from Lionel MALLET. * * Author: Tim Wise - Scientific & Engineering Software (SES), Inc. */ typedef struct { Boolean up; Widget shell; Widget popup; Widget text; Widget font; Widget status; String text_string; String font_name; XFontStruct *font_struct; } TextOptions; pixmap-2.6pl4.orig/pixmap.man100640 243 144 115302 5564665513 15040 0ustar joostusers.TH PIXMAP 1 "February 1994" "X11" .SH NAME pixmap \- Xpm pixmap editor for X .SH SYNOPSIS .B pixmap [-options ...] .sp .SH DESCRIPTION The \fIpixmap\fP program is a tool for creating or editing rectangular images made up of colored pixels, i.e., pixmaps. Pixmaps are intensively used in X to define window backgrounds, icon images, etc. .PP The \fIpixmap\fP program can have two different interfaces, a Athena widgets version and a Motif widgets version. .SH USAGE \fIPixmap\fP displays grid in which each square represents a single pixel in the picture being edited. Squares can be set, cleared, or inverted (this last operation will be detailed later) directly with the buttons on the pointer and a menu of higher level operations such as draw line and fill circle is provided to the side of the grid. Another menu on the top of the window allows files operations (Load, Save, ...), edit operations (Cut/Copy/Paste, attributes of pixmap editing, ...) and colors operations (drawing color, attributes of colors, ...). \fIPixmap\fP uses a Pixmap widget to represent the pixmap image. .PP Pixmaps are stored as a C string array variable suitable for including in applications, using the format defined by Arnaud Le Hors in his Xpm library (refer to Xpm manual for format description). This format allows pixmaps to be used indistinctly on monochrome, grey scale or color displays. .SH "OPTIONS" .PP \fIPixmap\fP accepts the following options: .TP 4 .B \-display/\-d \fIdisplay\fP This option specifies the name of the X server to use. .TP 4 .B \-geometry \fIgeometry\fP This option specifies the placement and size of the \fIpixmap\fP program window on the screen. See \fIX\fP for details. .TP 4 .B \-help/\-h This option asks for the usage description of \fIpixmap\fP. .TP 4 .B \-size \fIWIDTHxHEIGHT\fP This option specifies the size (width and height) in pixels of the pixmap to be edited. .TP 4 .B \-squares \fISIZE\fP This option specifies the size in display points to use to represent each pixel (a square of SIZE points). .TP 4 .B +grid/\-grid This option indicates that the grid lines in the Pixmap widget should be displayed or not. .TP 4 .B \-stippled This option turns off stipple drawing of transparent pixels. .TP 4 .B \-stipple \fIpixmap\fP This option specifies the depth 1 pixmap to use to draw transparent pixels. .TP 4 .B +axes/\-axes This option indicates that the axes in the Pixmap widget should be displayed or not. .TP 4 .B +proportional/\-proportional This option indicates that the pixels in the Pixmap widget should be drawn proportional, i.e. in squares, or not. .TP 4 .B \-hl \fIcolor\fP This option specifies the color to use for highlighting purposes. \fIcolor\fP can be any name accepted by the XParseColor(3X11) function. .TP 4 .B \-fr \fIcolor\fP This option specifies the color to use draw grid and axes in Pixmap widget. \fIcolor\fP can be any name accepted by the XParseColor(3X11) function. .TP 4 .B \-tr \fIcolor\fP This option specifies the color to use to represent transparent pixels. \fIcolor\fP can be any name accepted by the XParseColor(3X11) function. .TP 4 .B \-fn/\-font \fIfontname\fP This option specifies the font to be used in \fIpixmap\fP. .TP 4 .B \-filename/\-f/\-in \fIfilename\fP This option specifies the name of the file from which the pixmap to be edited should be loaded. .TP 4 .B \-colormap/\-pc This options specifies that pixmap should use its own private colormap instead of the default colormap. .SH PIXELS EDITING WITH MOUSE Pixels may be set, cleared, or inverted by pointing to them and clicking one of the buttons indicated below. Multiple pixels can be changed at once by holding the button down and dragging the cursor across them. Set pixels are filled with the current color; cleared pixels are filled with white; and inverted pixels are either set if they were originally cleared or cleared otherwise. .RS .5in .TP 4 .I "Button 1" .br This button (usually leftmost on the pointer) is used to set one or more pixels. .TP 4 .I "Button 2" .br This button (usually in the middle) is used to invert one or more pixels. .TP 4 .I "Button 3" .br This button (usually on the right) is used to clear one or more pixels. .TP 4 .I "Button 4" .br This button is used to clear one or more pixels. .TP 4 .I "Button 5" .br This button is used to clear one or more pixels. .RE Every button operation can be changed by means of resources in the \.Xdefaults file or application defaults file (/usr/lib/X11/app-defaults/Pixmap). .SH MENU COMMANDS To make defining shapes easier, \fIpixmap\fP provides several commands for drawing and manipulating the pixmap edited, and commands for file management. .PP Commands are layed in a vertical bar at the left of the Pixmap widget and in a menu bar at the top of the window. Most of the drawing commands are located in the left bar, where as file management and other general commands are located in the top menu bar. .PP In the left bar, some commands are represented by icons. They are, from left to right and up to down, \fIFlip horizontally\fP, \fIUp\fP, \fIFlip vertically\fP, \fILeft\fP, \fIFold\fP, \fIRight\fP, \fIRotate right\fP (counterclock), \fIDown\fP, \fIRotate left\fP (clockwise). .PP Some commands are also available directly through the keyboard when the mouse cursor is located on the Pixmap widget. They will be mentionned as an accelerator in the following description. .PP LEFT BAR COMMANDS .RS .5in .TP 4 .I Undo This command is used to undo the last operation. Only one operation can be undone. The accelerator of this command is Anyu. .TP 4 .I Clear This command is used to clear all of the pixels in the pixmap as if Button 3 had been dragged through every pixel in the pixmap. The accelerator of this command is [Shift]c. .TP 4 .I Set This command is used to set all of the pixels in the pixmap to the current color, as if Button 1 had been dragged through every pixel in the pixmap. The accelerator of this command is [Shift]s. .TP 4 .I Redraw This command is used to redisplay the pixmap. The accelerator of this command is Ctrll. .TP 4 .I Copy This command is used to copy a region of the pixmap from one location to another. When this command is invoked, the region to copy should be specified by pressing Button 1, dragging the mouse and releasing Button 1. The region can now be copied by pressing Button 1 with the cursor located on the region selected, dragging the mouse and releasing it where the upper left corner of the region should be copied. If a region was already selected with a Mark command, only the second phase of the copy is necessary. The accelerator of this command is available when a region has already been selected and is Ctrl to drag the region and Ctrl to draw it to point. This accelerated command is identical to the Paste command available through the \fIEdit\fP menu of the top menu bar. .TP 4 .I Move This command is used to move a region of the pixmap from one location to another. When this command is invoked, the region to move should be specified by pressing Button 1, dragging the mouse and releasing Button 1. The region can now be moved by pressing Button 1 with the cursor located on the region selected, dragging the mouse and releasing it where the upper left corner of the region should be moved. The initial region is cleared. If a region was already selected with a Mark command, only the second phase of the move is necessary. .TP 4 .I Mark This command is used to mark a region to move or copy it later (commands \fIMove\fP and \fICopy\fP above), or to put it in the Cut&Paste buffer (commands \fICut\fP and \fICopy\fP of the \fIEdit\fP menu of the top menu bar). When this command is invoked, the region should be specified by pressing Button 1, dragging the mouse and releasing Button 1. Once marked, the region is highlighted. The accelerator of this command is Ctrl to initiate the selection and Ctrl to finish it. .TP 4 .I Unmark This command is used to unmark a region previously marked. It will unhighlight the region. The accelerator of this command is Ctrl. .TP 4 .I Flip horizontally This command is used to flip horizontally the whole pixmap or the marked region. This means mirroring horizontally the pixmap image. The mirror is placed at the middle of the pixmap height. The accelerator of this command is [Shift|Ctrl]h. .TP 4 .I Up This command is used to move the whole pixmap or the marked region up. Pixels at the top of the pixmap are pushed back at the bottom of the new pixmap. The accelerator of this command is AnyUp (not available in Motif version). .TP 4 .I Flip vertically This command is used to flip vertically the whole pixmap or the marked region. This means mirroring vertically the pixmap image. The mirror is placed at the middle of the pixmap width. The accelerator of this command is Anyv. .TP 4 .I Left This command is used to move the whole pixmap or the marked region left. Pixels at the left of the pixmap are pushed back at the right of the new pixmap. The accelerator of this command is AnyLeft (not available in Motif version). .TP 4 .I Fold This command is used to "Fold" the pixmap. This means splitting the pixmap image in four squares (top left, top right, bottom left and bottom right) and inverting them (top becomes bottom, left becomes right, and so on). "Folding" twice a pixmap does no change. The accelerator of this command is [Shift|Ctrl]f. .TP 4 .I Right This command is used to move the whole pixmap or the marked region right. Pixels at the right of the pixmap are pushed back at the left of the new pixmap. The accelerator of this command is AnyRight (not available in Motif version). .TP 4 .I Rotate right This command is used to rotate the pixmap image or the marked region right (clockwise) of 90 degrees. Four \fIRotate right\fP operations does no change. The accelerator of this command is [Shift|Ctrl]r. .TP 4 .I Down This command is used to move the whole pixmap or the marked region down. Pixels at the bottom of the pixmap are pushed back at the top of the new pixmap. The accelerator of this command is AnyDown (not available in Motif version). .TP 4 .I Rotate left This command is used to rotate the pixmap image or the marked region left (counterclock) of 90 degrees. Four \fIRotate left\fP operations does no change. The accelerator of this command is [Shift]l. .TP 4 .I Point This command is used to set, invert or clear a pixel to the current color. It can be considered as a mode. After selecting it, pixels are set, inverted or cleared depending on the button used (see Pixels Editing with the Mouse). If the mouse button remains pressed while dragging the mouse, more than one pixel can be affected. This command has no accelerator. .TP 4 .I Curve This command is used to draw curved lines (set, cleared or inverted). The curve is drawn while dragging the mouse. This command can be considered as a mode. Quite the same affect can be obtained by dragging the mouse in point mode, the main difference resides in the fact that pixels will be drawn contiguously. This command has no accelerator. .TP 4 .I Line This command is used to draw lines between two points (set, cleared or inverted). The lines are first drawn highlighted while mouse button remains pressed. This command can be considered as a mode. This command has no accelerator. .TP 4 .I Rectangle This command is used to draw rectangles between two points defining the two opposite corners of the rectangle (set, cleared or inverted). The rectangles are first drawn highlighted while mouse button remains pressed. This command can be considered as a mode. This command has no accelerator. .TP 4 .I Filled Rectangle This command is used to draw filled rectangles between two points defining the two opposite corners of the rectangle (set, cleared or inverted). The rectangles outlines are first drawn highlighted while mouse button remains pressed. This command can be considered as a mode. This command has no accelerator. .TP 4 .I Circle This command will set, invert or clear the pixels on a circle specified by a center and a point on the curve. Small circles may not look very round because of the size of the pixmap and the limits of having to work with discrete pixels. This command can be considered as a mode. This command has no accelerator. .TP 4 .I Filled Circle This command will set, invert or clear all of the pixels in a circle specified by a center and a point on the curve. All pixels side and including the circle are set. This command can be considered as a mode. This command has no accelerator. .TP 4 .I Flood Fill This command will set all clear pixels in an enclosed shape. The enclosed shape is determined by all the pixels whose color is different from the color of the pixel on which the user has clicked. If the shape is not closed, the entire pixmap will be filled. This command can be considered as a mode. This command has no accelerator. .TP 4 .I Set Hot Spot This command allows the specification of a Hot Spot. The Hot Spot is selected by clicking the \fISet\fP mouse button. Clicking \fIInvert\fP will invert the Hot Spot, set or reset it depending on its previous state. Hot spot is useful for cursor pixmaps and are used to reference the sensible part of the pixmap. This command has no accelerator. .TP 4 .I Clear Hot Spot This command clears the current Hot Spot. This command has no accelerator. .TP 4 .I Set Port This command allows to create a Port extension line graphically. It is part of the customized Port extension editor developped by Tim Wise (SES Inc.). The Port is set on the pixmap image by clicking any of the mouse button. This command has no acelerator. .TP 4 .I Clear Port This command allows to remove a Port extension line graphically. It is part of the customized Port extension editor developped by Tim Wise (SES Inc.). The Port onto which any mouse button was clicked is cancelled. This command has no accelerator. .TP 4 .I Move Port This command allows to move a Port, that is to change the coordinates specified in the Port extension line. It is part of the customized Port extension editor developped by Tim Wise (SES Inc.). The Port onto which any mouse button was pressed is moved with the mouse cursor until the mouse button is released. This command has no accelerator. .TP 4 .I Port Info... This command allows to edit the information associated to a Port, that is contained in a Port extension line. It is part of the customized Port extension editor developped by Tim Wise (SES Inc.). The information associated with the Port onto which any mouse button was clicked is displayed in a dialog window. It can be edited in that dialog and saved by clicking the "Okay" button of the dialog. This command has no accelerator. .PP .RE TOP MENU COMMANDS .RS .5in .TP 4 .I Info This command pops up an info window. .PP .RE \fIFile\fP MENU .RS .5in .TP 4 .I Load... This command is used to load a pixmap file in the pixmap editor. A dialog window is poped up in which a filename has to be provided. The operation can be interrupted with the \fICancel\fP button of the dialog window. The accelerator of this command is Altl. .TP 4 .I Insert... This command is used to load a pixmap in the Cut&Paste buffer of the pixmap editor. The contents of the pixmap file can then be pasted on the current pixmap. A dialog window is poped up in which a filename has to be provided. The operation can be interrupted with the \fICancel\fP button of the dialog window. The accelerator of this command is Alti. .TP 4 .I Save This command is used to save the current pixmap in the current file edited. By default, and until otherwise changed by a \fIFilename...\fP, \fILoad...\fP or \fISave As...\fP operation, or by specifying the filename on the command line, the filename is \fIscratch\fP. The \fIFilename...\fP command can be used to change this default filename. The accelerator of this command is Alts. .TP 4 .I Save As... This command is used to save the current pixmap in a particular file which name has to be provided in the dialog window which pops up. The operation can be interrupted with the \fICancel\fP button of the dialog window. The accelerator of this command is Alta. .TP 4 .I Resize... This command is used to resize the current pixmap to the width and height specified in the dialog window which pops up. The syntax is WIDTHxHEIGHT. This operation is different from the \fIRescale...\fP one in the way that it just add or remove pixels to the current pixmap without trying to fit the space correctly with the pixmap image. The operation can be interrupted with the \fICancel\fP button of the dialog window. The accelerator of this command is Altr. .TP 4 .I Rescale... This command is used to rescale the current pixmap image in order to make it fit a larger or smaller space. The new width and height have to be specified in the dialog window which pops up with the syntax WIDTHxHEIGHT. The operation can be interrupted with the \fICancel\fP button of the dialog window. The accelerator of this command is Alte. .TP 4 .I Filename... This command is used to change the current filename, i.e., the name of the file in which the pixmap will be saved with a \fISave\fP operation. The new filename has to be provided in the dialog window which pops up. The operation can be interrupted with the \fICancel\fP button of the dialog window. The accelerator of this command is Altf. .TP 4 .I Hints comment... This command pops up a dialog window in which the user can specify the hints section comment of the pixmap file. The operation can be interrupted with the \fICancel\fP button of the dialog window. The accelerator of this command is Alth. .TP 4 .I Colors comment... This command pops up a dialog window in which the user can specify the colors section comment of the pixmap file. The operation can be interrupted with the \fICancel\fP button of the dialog window. The accelerator of this command is Altc. .TP 4 .I Pixels comment... This command pops up a dialog window in which the user can specify the pixels section comment of the pixmap file. The operation can be interrupted with the \fICancel\fP button of the dialog window. The accelerator of this command is Altp. .TP 4 .I Quit This command causes \fIpixmap\fP to display a dialog box asking whether or not it should save the pixmap (if it has changed) and then exit. Answering \fIyes\fP is the same as invoking \fISave\fP; \fIno\fP causes \fIpixmap\fP to simply exit; and \fIcancel\fP will abort the \fIQuit\fP command so that more changes may be made. The accelerator of this command is Altq. .PP .RE \fIEdit\fP MENU .RS .5in .TP 4 .I Image This command pops up a window in which the real size pixmap is shown. This window can be closed by clicking the mouse in it or by invoking \fIImage\fP once again. When the window is poped up, an \fIX\fP mark is displayed in the menu at the left of the \fIImage\fP label. The accelerator of this command is i. .TP 4 .I Grid This command toggles the display of the grid. When the grid is displayed, an \fIX\fP mark is added at the left of the \fIGrid\fP label. The accelerator of this command is g. .TP 4 .I Axes This command toggles the display of axes. When axes are displayed, an \fIX\fP mark is added at the left of the \fIAxes\fP label. The accelerator of this command is a. .TP 4 .I Proportional This command toggles the display in proportional mode of the pixmap. Proportional mode means that the Pixmap widget won't try to fit all the available space within the interface and will rather display each pixel in a square, probably leaving some space around the pixmap widget. When the proportional mode is active, an \fIX\fP mark is added at the left of the \fIProportional\fP label. The accelerator of this command is p. .TP 4 .I Zoom This command is used to zoom some pixels of the current pixmap. The zooming region has to be selected by the use as a rectangle region just as if he was marking a region (see \fIMark\fP command). The operation can be interrupted by invoking any other command. When a region is zoomed, an \fIX\fP mark is added at the left of the \fIZoom\fP label. Invoking once again the \fIZoom\fP command zooms out. The accelerator of this command is z. .TP 4 .I Zoom In This command is used to incrementaly zoom into the current pixmap. This side effect of this is to enlarge the size of a square used to represent a single pixel. The accelerator of this command is x. .TP 4 .I Zoom Out This command is used to incrementaly zoom out of the current pixmap. This side effect of this is to reduce the size of a square used to represent a single pixel. The accelerator of this command is y. .TP 4 .I Zooming Factor The command pops up a dialog window in which the user can edit the current zooming factor. The zooming factor is the size of a square used to represent a single pixel. Enlarging the zooming factor will zoom into the current pixmap, while reducing it will zoom out of the pixmap. The accelerator of this command is f. .TP 4 .I Cut When a region is marked, this operation is active. It is used to cut the contents of the region to put it in the Cut&Paste buffer. The \fIPaste\fP command now becomes active and the marked region is unmarked. The pixels in the marked region are cleared. This command acts as the \fIMove\fP one when a region is already marked. The accelerator of this command is Ctrlc. .TP 4 .I Copy When a region is marked, this operation is active. It is used to copy the contents of the region in the Cut&Paste buffer. The \fIPaste\fP command now becomes active and the marked region is unmarked. This command acts as the \fICopy\fP command of the left border when a region is already marked. The accelerator of this command is Ctrlx. .TP 4 .I Paste When a region has been cut or copied in the Cut&Paste buffer, this command is active and can be used to paste the contents of the Cut&Paste buffer where the mouse button is clicked. The paste operation takes care of the button used to specify the point where to paste the buffer. The button can remain pressed to move the buffer around and then be released to paste the buffer at the current location. A \fICopy\fP and \fIPaste\fP operation can be accelerated by Ctrl to intiate the operation and Ctrl to finish the operation, i.e., paste the buffer. The accelerator of this command is Ctrlp. .TP 4 .I Crop When a region is marked, or a file has been inserted in the Cut&Paste buffer, this command will exchange the current pixmap with the marked region, or the Cut&Paste buffer. Cropping twice does nothing. The accelerator of this command is Ctrlo. .PP .RE \fIForeground Color\fP MENU .RS .5in .TP 4 .I Add color... This command is used to add a new color in the \fIColor Panel\fP (see below). The color name is specified in the dialog window which pops up either by a real color name found in rgb\.txt file or by a string like \fI#rrggbb\fP where \fIrr\fP, \fIgg\fP and \fIbb\fP represent the red, green and blue components of the color in hexadecimal format. The operation can be interrupted with the \fICancel\fP button of the dialog window. The accelerator of this command is Ctrla. .TP 4 .I Symbolic name... This command is used to set the symbolic name of the current color. The symbolic name is entered in the dialog window which pops up. The operation can be interrupted with the \fICancel\fP button of the dialog window. The accelerator of this command is Ctrls. .TP 4 .I Monochrome name... This command is used to set the monochrome name of the current color, i.e., the name of the color to use on monochrome displays. The monochrome name is entered in the dialog window which pops up. The operation can be interrupted with the \fICancel\fP button of the dialog window. The accelerator of this command is Ctrlm. .TP 4 .I Grey scale 4 name... This command is used to set the grey scale 4 name of the current color, i.e., the name of the color to use on grey scale 4 displays. The grey scale 4 name is entered in the dialog window which pops up. The operation can be interrupted with the \fICancel\fP button of the dialog window. The accelerator of this command is Ctrl4. .TP 4 .I Grey scale name... This command is used to set the grey scale name of the current color, i.e., the name of the color to use on grey scale (with more then 4 levels) displays. The grey scale name is entered in the dialog window which pops up. The operation can be interrupted with the \fICancel\fP button of the dialog window. The accelerator of this command is Ctrlg. .TP 4 .I Color name... This command is used to set the color name of the current color. This change will be considered when saving the pixmap but to remain visible, it affects the label of the menu item of the color. This is useful to directly change a specific color for another one or to allow multiple symbols to represent the same color (the color can be the same on color display but change on grey scale or monochrome ones). The color name is entered in the dialog window which pops up. The operation can be interrupted with the \fICancel\fP button of the dialog window. The \fINone\fP (not case sensitive) name is used to change the pixel representing the transparent color. The accelerator of this command is Ctrln. .PP .RE \fIXpm Extensions\fP MENU .RS .5in .TP 4 .I Add Extension... This command pops up a dialog window into which the user provides a name for an extension to be added in the current pixmap extensions list. The operation can be interrupted with the \fICancel\fP button of the dialog window. If the user confirms with the \fIOkay\fP button, another dialog windows pops up where the user can edit the extension contents. When the user clicks on the \fICancel\fP button into this extension editing window, the edit operation is interrupted but the extension is added to the extensions list of the current pixmap. If the user wishes to abort the \fIAdd Extension...\fP operation, he/she needs to click on the \fIRemove\fP button. The edition can otherwise be confirmed by clicking on the \fIOkay\fP button. .TP 4 .I Any extension name WHen an extension is added in the extensions list of the current pixmap, its name appears in the \fIXpm Extensions\fP menu. When selected in the menu, the extension edition window pops up. See above for its description. .RE In addition the Motif version defines the status label as two active buttons which operate as \fIFilename...\fP and \fIResize...\fP commands. .SH "COLOR PANEL" Colors in pixmap are presented in the \fIColor Panel\fP. Each loaded color is associated a square button, filled with the color pixel. Scrollbars around the panel allow to scan the whole panel. To choose a color for drawing, the user must click on a color button. At this time, the current name of the color is displayed as the title of the \fIForeground Color\fP menu. A color can also be selected by using Shift on a pixel of the current pixmap which color should be used. This accelerator is very useful when modifying small parts of a pixmap locally. .SH "FILE FORMAT" The \fISave\fP or \fISave As...\fP commands store pixmaps using the format defined by Arnaud Le Hors in his Xpm library (version 3.x). Each pixmap is a C string array variable that can be included and used within programs, or referred to by X Toolkit pixmap resources (assuming that a String to Pixmap converter has been registered on the server). Here is an example of a pixmap file: .sp .nf /* XPM */ static char * plaid[] = { /* plaid pixmap * width height ncolors chars_per_pixel */ "22 22 4 2 ", /* colors */ " c red m white s light_color ", "Y c yellow m black s lines_in_mix ", "+ c yellow m white s lines_in_dark ", "x m black s dark_color ", /* pixels */ "x x x x x x x x x x x x + x x x x x ", " x x x x x x x x x x x x x x x x ", "x x x x x x x x x x x x + x x x x x ", " x x x x x x x x x x x x x x x x ", "x x x x x x x x x x x x + x x x x x ", "Y Y Y Y Y x Y Y Y Y Y + x + x + x + x + x + ", "x x x x x x x x x x x x + x x x x x ", " x x x x x x x x x x x x x x x x ", "x x x x x x x x x x x x + x x x x x ", " x x x x x x x x x x x x x x x x ", "x x x x x x x x x x x x + x x x x x ", " x x x x Y x x x ", " x x x Y x x ", " x x x x Y x x x ", " x x x Y x x ", " x x x x Y x x x ", "x x x x x x x x x x x x x x x x x x x x x x ", " x x x x Y x x x ", " x x x Y x x ", " x x x x Y x x x ", " x x x Y x x ", " x x x x Y x x x " } ; .fi .sp The \fBplaid\fP name used to reference the pixmap variable is constructed from the name of the file in which is saved the pixmap. Any directories are stripped off the front of the name and any suffix beginning with a period is stripped off the end. .PP The pixmap variable is a string array in which the first string of the array contains the width, height, number of colors and number of characters per pixel. .PP The following strings represent the color descriptions, one string per color. A color description can be composed of one or more characters that represent a pixel, and color display name preceded by the `c' character, and/or a symbolic name preceded by the `s' character, and/or a monochrome display name preceded by the `m' character, and or a grey scale 4 levels display name preceded by the string `g4' , and/or a grey scale display name preceded by the aharacter `g', specified in any order. .PP Following color description strings, each string represent a line of the pixmap, composed of symbolic characters assigned to colors. .PP .SH USING PIXMAPS IN PROGRAMS The format of pixmap files is designed to make pixmaps easy to use within X programs, whatever your display is. The following code could be used to create a pixmap to use as a window background, using the enhanced Xpm library (version 3.3) from Groupe Bull and assuming that the pixmap was stored in a file name \fIplaid.xpm\fP: .sp .nf #include "plaid.xpm" Pixmap pixmap; XpmCreatePixmapFromData (display, drawable, plaid, &pixmap, &pixmap_mask, &attributes); .sp .fi .PP Additional routines are available for reading in \fIpixmap\fP files and returning the data in the file in Pixmaps. .SH WIDGET HIERARCHY .PP The hierarchy of the pixmap editor is discribed here in order to configure the editor by means of X resources in a \.Xdefaults file. The first widget class is the Athena version one, while the second one, seperated by a | character, is the Motif version one. .sp .nf .ta .5i 1.0i 1.5i 2.0i 2.5i 3.0i 4.0i 5.0i 6.0i 7.0i 8.0i Pixmap pixmap Paned|RowColumn parent Form|RowColumn formy MenuButton|CascadeButtonGadget fileButton SimpleMenu|RowColumn fileMenu SmeBSB|PushButtonGadget load SmeBSB|PushButtonGadget insert SmeBSB|PushButtonGadget save SmeBSB|PushButtonGadget saveAs SmeLine|SeparatorGadget line SmeBSB|PushButtonGadget resize SmeBSB|PushButtonGadget rescale SmeBSB|PushButtonGadget filename SmeBSB|PushButtonGadget hintsCmt SmeBSB|PushButtonGadget colorsCmt SmeBSB|PushButtonGadget pixelsCmt SmeLine|SeparatorGadget line SmeBSB|PushButtonGadget quit MenuButton|CascadeButtonGadget editButton SimpleMenu|RowColumn editMenu SmeBSB|ToggleButtonGadget image SmeLine|SeparatorGadget line SmeBSB|ToggleButtonGadget grid SmeBSB|ToggleButtonGadget axes SmeBSB|ToggleButtonGadget proportional SmeBSB|ToggleButtonGadget zoom SmeBSB|PushButtonGadget zoomIn SmeBSB|PushButtonGadget zoomOut SmeBSB|PushButtonGadget zoomFactor SmeLine|SeparatorGadget line SmeBSB|PushButtonGadget cut SmeBSB|PushButtonGadget copy SmeBSB|PushButtonGadget paste SmeBSB|PushButtonGadget crop MenuButton|CascadeButtonGadget fgButton SimpleMenu|RowColumn fgMenu SmeBSB|PushButtonGadget addColor SmeBSB|PushButtonGadget symbolicName SmeBSB|PushButtonGadget monochromeName SmeBSB|PushButtonGadget g4Name SmeBSB|PushButtonGadget gName MenuButton|CascadeButtonGadget extensionButton SimpleMenu|RowColumn extensionMenu SmeBSB|PushButtonGadget addExtension SmeBSB|PushButtonGadget . . . Label|CascadeButtonGadget status |CascadeButtonGadget statusb Command|CascadeButtonGadget infoButton Paned|Form pane Form|RowColumn form Command|PushButtonGadget undo Command|PushButtonGadget clear Command|PushButtonGadget set Command|PushButtonGadget redraw Toggle|ToggleButtonGadget copy Toggle|ToggleButtonGadget move Toggle|ToggleButtonGadget mark Command|PushButtonGadget unmark |RowColumn formh Command|PushButtonGadget flipHoriz Command|PushButtonGadget up Command|PushButtonGadget flipVert |RowColumn formh Command|PushButtonGadget left Command|PushButtonGadget fold Command|PushButtonGadget right |RowColumn formh Command|PushButtonGadget rotateLeft Command|PushButtonGadget down Command|PushButtonGadget rotateRight Toggle|ToggleButtonGadget point Toggle|ToggleButtonGadget line Toggle|ToggleButtonGadget rectangle Toggle|ToggleButtonGadget filledRectangle Toggle|ToggleButtonGadget circle Toggle|ToggleButtonGadget filledCircle Toggle|ToggleButtonGadget floodFill Toggle|ToggleButtonGadget setHotSpot Command|PushButtonGadget clearHotSpot Toggle|ToggleButtonGadget setPort Toggle|ToggleButtonGadget clearPort Toggle|ToggleButtonGadget movePort Toggle|ToggleButtonGadget portInfo Paned|PanedWindow vPane ViewPort|ScrolledWindow colorView Box|RowColumn colorPane Command|PushButton . . . ViewPort|ScrolledWindow pixmapView Pixmap|Pixmap pixmap TransientShell|TransientShell image Label|Label label PopupShell|SelectionBox info Dialog| dialog Label| label Text| value Command| Okay PopupShell|SelectionBox input Dialog| dialog Label| label Text| value Command| Okay Command| Cancel PopupShell|SelectionBox file Dialog| dialog Label| label Text| value Command| Okay Command| Cancel PopupShell|SelectionBox error Dialog| dialog Label| label Command| Abort Command| Retry PopupShell|SelectionBox qsave Dialog| dialog Label| label Text| value Command| Yes Command| No Command| Cancel PopupShell|PopupShell extEditorShell|extEditor_popup Form|Form extEditor Label|Label name AsciiText|ScrolledText text Command|PushButtonGadget ok Command|PushButtonGadget cancel Command|PushButtonGadget remove .fi .PP Lines where only appears one or the other type of a widget (like Dialog| or |CascadeButtonGadget) mean that the widget doesn't exist in one or the other version. In the case of dialogs in the Motif version, the widgets are created by means of convenient routines which assign the name of the widget depending on the name of the dialog. By the way, we can't provide with a list of types and names for the substructure of dialog widgets in the Motif version. However, these shouldn't be often modified. .SH X DEFAULTS .PP In addition to the standard Athena or Motif widgets resources, \fIpixmap\fP uses the following resources for the Pixmap widget (named pixmap): .TP 4 .B Cursor The cursor to use within the Pixmap widget. .PP .TP 4 .B Foreground The initial foreground color for drawing. .TP 4 .B Highlight The highlighting color. .TP 4 .B Framing The framing color, used to draw grid and axes. .TP 4 .B Transparent The color representing transparent pixels. .TP 4 .B Proportional Toggles initial proportional display mode. .TP 4 .B Grid Toggles initial grid display. .TP 4 .B GridTolerance Determines when to display grid according to SquareSize. .TP 4 .B Stippled Suppress stipple drawing of transparent pixels. .TP 4 .B Stipple Depth 1 pixmap to use to draw transparent pixels stippled. .TP 4 .B Axes Toggles axes display. .TP 4 .B Resize Toggles Pixmap widget resize when requesting by window manager. .TP 4 .B Distance The margin around Pixmap widget. .TP 4 .B SquareSize The size in screen points used to display each pixmap pixels. .TP 4 .B PixmapWidth The initial width of the pixmap. .TP 4 .B PixmapHeight The initial height of the pixmap. .TP 4 .B Button1Action The action associated to mouse button 1 (between Set, Invert and Clear). .TP 4 .B Button2Action The action associated to mouse button 2 (between Set, Invert and Clear). .TP 4 .B Button3Action The action associated to mouse button 3 (between Set, Invert and Clear). .TP 4 .B Button4Action The action associated to mouse button 4 (between Set, Invert and Clear). .TP 4 .B Button5Action The action associated to mouse button 5 (between Set, Invert and Clear). .TP 4 .B Filename The initial file to load. .TP 4 .B AddColorNtfyProc The procedure to call when reading a pixmap file to notify color loading. It is strongly advised not to change this resource. .TP 4 .B ExtensionNtfyProc The procedure to call when reading a pixmap file to notify extension loading. It is strongly advised not to change this resource. .SH "SEE ALSO" X(1), \fIXpm library manual\fP, \fIXlib - C Language X Interface\fP (particularly the section on \fIManipulating Pixmaps\fP) .SH BUGS .PP If you move the pointer too fast while holding a pointer button down, some pixels may be missed. This is caused by limitations in how frequently the X server can sample the pointer location. .PP Loading a pixmap file where the same color is used more than once with different symbols and descriptions, and writing it will loose information concerning the color used more than once. The pixmap file plaid given as an example in this man won't be saved that way by \fIpixmap\fP. .PP Accelerators to menu operations don't seem to work with Athena version. .PP In the Motif version, the \fIFilename...\fP and \fIResize...\fP commands open their respective dialog window in a strange mode. The user has to voluntary (;-) give the focus to the text widget inside to be able to change its content. .SH COPYRIGHT Copyright 1991,1992,1993,1994 - Lionel Mallet. .SH AUTHOR \fIpixmap\fP by Lionel Mallet - Simulog. Extension edition and customized Port editor by Tim Wise - SES Inc. pixmap-2.6pl4.orig/Pixmap.tex100640 243 144 23152 5533123541 14770 0ustar joostusers%% $Id: Pixmap.tex,v 1.6 1994/02/08 10:38:40 mallet Exp $ \documentstyle{article} \newcommand{\PAGESIZE}[2] { \textheight #1 \textwidth #2 } \newcommand{\MARGINS}[3] { \topmargin #1 \oddsidemargin #2 \evensidemargin #3 } \PAGESIZE{21.5cm}{16cm} \MARGINS{-10mm}{0mm}{0mm} \footskip 20mm \title{Pixmap Editor Reference Card} \author{Copyright L. Mallet - Simulog} \date{October 1992} \begin{document} \maketitle \section{Command line options} The pixmap editor can parse the following command line options:\\ \begin{tabular}{|l|p{8cm}|} \hline {\tt -display/-d Display} & specify the display on which start the Pixmap editor\\\hline {\tt -geometry Geometry} & specify the geometry of the Pixmap editor window, {\tt Geometry} is a standard X Window geometry specification\\\hline {\tt -help/-h} & ask for usage description\\\hline {\tt -size WidthxHeight} & specify the width and height of the pixmap to be edited\\\hline {\tt -squares Dimension} & specify the dimension of the squares representing pixels on the screen ({\tt -squares 5} will display each pixel of the pixmap in a square of width and height of 5 screen points)\\\hline {\tt +grid/-grid} & specify if the grid should be displayed or not by default when starting the editor\\\hline {\tt -stippled} & turn off stippled drawing of transparent pixels\\\hline {\tt -stipple Pixmap} & specify the stipple depth 1 pixmap to use to draw transparent pixels\\\hline {\tt +axes/-axes} & specify if the axes should be displayed or not by default when starting the editor\\\hline {\tt -proportional/+proportional} & specify if all available space should be used or not in editor to display the pixmap or if squares should remain proportional, i.e. if a 4x3 pixmap will fit the space in the editor or not)\\\hline {\tt -hl color} & specify the color to use when highlighting\\\hline {\tt -fr color} & specify the color to use for the Pixmap widget frame, i.e., the grid, axes and frame lines surrounding the pixmap\\\hline {\tt -tr color} & specify the color to use to represent transparent pixels\\\hline {\tt -fn/-font fontname} & specify the font to use within the Pixmap editor\\\hline {\tt -filename/-f/-in filename} & specify the name of the file from which the pixmap to be edited should be loaded\\\hline {\tt -colormap/-pc} & specify that pixmap should use a private colormap instead of the default colormap\\\hline \end{tabular}\\ \noindent Colors should be specified by name. A color name can be anyone accepted by the function XParseColor.\\ \noindent The default command line options are: \begin{verbatim} -size 32x32 -squares 20 +grid -axes +proportional -hl black -fr black -tr gray90 -filename scratch \end{verbatim} However, some of these options can be overidden in the application defaults file ({\tt \$XAPPLRESDIR/Pixmap}), e.g., squares which is set to 15, or in the user's resource configuration file ({\tt \$HOME/.Xdefaults}). \section{Pixmap widget resources} The Pixmap widget can be modified through its resources. They are :\\ \begin{tabular}{|l|l|p{5cm}|l|} \hline Name & Type & Definition & Default\\\hline\hline XtNcursor & Cursor & cursor used within Pixmap widget & XC\_tcross\\\hline XtNforeground & Pixel & initial foreground color of the pixmap & XtDefaultForeground\\\hline XtNhighlight & Pixel & highlighting color & XtDefaultForeground\\\hline XtNframing & Pixel & framing color (to draw grid and axes) & XtDefaultForeground\\\hline XtNtransparent & Pixel & transparent pixels color & XtNDefaultTransparent\\\hline XtNproportional & Boolean & toggle proportional display & True\\\hline XtNgrid & Boolean & toggle grid display & True\\\hline XtNgridTolerance & Dimension & tolerance of grid display, if squareWidth or squareHeight are lower or equal to gridTolerance, even if requested by resource grid, grid is not displayed & 5\\\hline XtNstippled & Boolean & toggle stipple display of transparent pixels & True\\\hline XtNstipple & Pixmap & stipple depth 1 pixmap to use to display transparent pixels & XtUnspecifiedPixmap\\\hline XtNaxes & Boolean & toggle axes display & False\\\hline XtNresize & Boolean & toggle resize Pixmap widget & True\\\hline XtNdistance & Dimension & space between border and pixmap & 10\\\hline XtNsquareSize & Dimension & widht and height of squares & 20\\\hline XtNpixmapWidth & Dimension & initial width of the pixmap & 32\\\hline XtNpixmapHeight & Dimension & initial height of the pixmap & 32\\\hline XtNbutton1Action & Int & action of button 1 & Set\\\hline XtNbutton2Action & Int & action of button 2 & Invert\\\hline XtNbutton3Action & Int & action of button 3 & Clear\\\hline XtNbutton4Action & Int & action of button 4 & Clear\\\hline XtNbutton5Action & Int & action of button 5 & Clear\\\hline XtNfilename & String & name of default file to read & scratch\\\hline XtNaddColorNtfyProc & AddColorNotifyProc & procedure to call while reading pixmap file to notify color loading & NULL\\\hline XtNextensionNtfyProc & ExtensionNotifyProc & procedure to call while reading pixmap file to notify extension loading & NULL\\\hline \end{tabular}\\ \noindent {\tt XtNDefaultTransparent} color is {\tt gray90}. \section{Default Button Settings} \begin{itemize} \item button 1: Set \item button 2: Invert \item button 3: Clear \item button 4: Clear \item button 5: Clear \end{itemize} \section{Default Key Bindings} Most of the commands are directly available from the keyboard by means of accelerators. Here is the set of accelerators defined:\\ \begin{tabular}{|p{4cm}|p{10cm}|} \hline Key & Action\\\hline\hline Alt$<$Key$>$l & load pixmap from file\\\hline Alt$<$Key$>$i & insert pixmap from file in Cut\&Paste buffer\\\hline Alt$<$Key$>$s & save pixmap to current file\\\hline Alt$<$Key$>$a & save pixmap to file\\\hline Alt$<$Key$>$r & resize pixmap\\\hline Alt$<$Key$>$e & rescale pixmap\\\hline Alt$<$Key$>$f & set current filename\\\hline Alt$<$Key$>$h & set hints comment\\\hline Alt$<$Key$>$c & set colors comment\\\hline Alt$<$Key$>$p & set pixels comment\\\hline Alt$<$Key$>$q & quit\\\hline $<$Key$>$i & toggle image\\\hline $<$Key$>$g & toggle grid\\\hline $<$Key$>$a & toggle axes\\\hline $<$Key$>$p & toggle proportional\\\hline $<$Key$>$z & toggle zoom\\\hline $<$Key$>$x & zoom into pixmap\\\hline $<$Key$>$y & zoom out of pixmap\\\hline $<$Key$>$f & set zoom factor\\\hline Ctrl$<$Key$>$c & cut to Cut\&Paste buffer\\\hline Ctrl$<$Key$>$x & copy to Cut\&Paste buffer\\\hline Ctrl$<$Key$>$p & paste Cut\&Paste buffer\\\hline Ctrl$<$Key$>$o & rotate marked area or Cut\&Paste buffer and image\\\hline Ctrl$<$Key$>$a & add color in color menu\\\hline Ctrl$<$Key$>$s & symbolic name of current color\\\hline Ctrl$<$Key$>$m & monochrome name of current color\\\hline Ctrl$<$Key$>$4 & grey scale 4 name of current color\\\hline Ctrl$<$Key$>$g & grey scale name of current color\\\hline Ctrl$<$Key$>$n & color name of current color\\\hline Ctrl$<$Btn1Down$>$ & mark region\\\hline Ctrl$<$Btn2Down$>$ & paste Cut\&Paste buffer to point\\\hline Ctrl$<$Btn3Down$>$ & unmark region\\\hline Shift$<$BtnUp$>$ & set drawing color to pixel color\\\hline Ctrl$<$Key$>$l & redraw pixmap\\\hline Any$<$Key$>$d & toggle debug mode\\\hline Any$<$Key$>$t & terminate current engaged request (current action)\\\hline Any$<$Key$>$Up & move pixmap image up (not in Motif version)\\\hline Any$<$Key$>$Down & move pixmap image down (not in Motif version)\\\hline Any$<$Key$>$Left & move pixmap image left (not in Motif version)\\\hline Any$<$Key$>$Right & move pixmap image right (not in Motif version)\\\hline $[$Shift$|$Ctrl$]<$Key$>$f& fold pixmap image, inverse top and bottom, and left and right\\\hline $[$Shift$|$Ctrl$]<$Key$>$h & flip pixmap image horizontally\\\hline Any$<$Key$>$v & flip pixmap image vertically\\\hline $[$Shift$|$Ctrl$]<$Key$>$r& rotate pixmap image right (clockwise)\\\hline $[$Shift$]<$Key$>$l & rotate pixmap image left (counterclock)\\\hline $[$Shift$]<$Key$>$s & set pixmap to current color (all pixels are set)\\\hline $[$Shift$]<$Key$>$c & clear pixmap image (all pixels are cleared)\\\hline Any$<$Key$>$u & undo last operation\\\hline \end{tabular}\\ In the Motif version, some actions, namely Any$<$Key$>[$Left$|$Right$|$Up$|$Down$]$, are overriden by XmManager widget translation table and thus are not available.\\ \section{Configuration files} The Pixmap editor is configurable by means of standard X Window files. They are read in the following order : \begin{itemize} \item application defaults file ({\tt /usr/lib/X11/app-defaults/Pixmap}), \item user resource database file ({\tt \$HOME/.Xdefaults}). \end{itemize} But the color interface is also configurable by means of a color database file which can be located in the application defaults directory, in the user's home directory or in the directory from which the Pixmap editor was started. The color database file is named ``{\tt .pixmap}''. The precedence order is : \begin{enumerate} \item local directory file, \item user's home directory file, \item application defaults directory file. \end{enumerate} This file is a list of color names (accepted by XParseColor, i.e., either a name found in the rgb database file or a name like ``\#rgb'' where r, g and b are hexadecimal values specifying the red, green and blue components of the color), one on each line. \begin{verbatim} blue red #000040408F8F white #000000000000 \end{verbatim} \centerline{Example of a color database file.} \end{document} pixmap-2.6pl4.orig/APixmap.ad100644 243 144 33470 5533123510 14661 0ustar joostusersPixmap*selFile.allowShellResize: True Pixmap*TransientShell.allowShellResize: True Pixmap*font: -adobe-helvetica-bold-r-normal--*-120-*-*-*-*-iso*-* Pixmap*shapeStyle: oval Pixmap*cursor: left_ptr Pixmap*pane.orientation: horizontal Pixmap*Form*top: ChainTop Pixmap*Form*bottom: ChainTop Pixmap*Form*left: ChainLeft Pixmap*Form*right: ChainLeft Pixmap*MenuButton.leftBitmap: menu12 Pixmap*form*width: 120 Pixmap*form*height: 15 Pixmap*baseTranslations:#override\ Metal: do-load()\n\ Metai: do-insert()\n\ Metas: do-save()\n\ Metaa: do-save-as()\n\ Metar: do-resize()\n\ Metae: do-rescale()\n\ Metaf: do-filename()\n\ Metah: do-hintscmt()\n\ Metac: do-colorscmt()\n\ Metap: do-pixelscmt()\n\ Metaq: do-quit()\n\ Ctrla: do-addcolor()\n\ Ctrls: do-symbname()\n\ Ctrlm: do-mononame()\n\ Ctrl4: do-grey4name()\n\ Ctrlg: do-greyname()\n\ Ctrln: do-colorname()\n\ i: switch-image()\n\ g: switch-grid()\n\ a: switch-axes()\n\ p: switch-proportional()\n\ z: switch-zoom()\n\ x: zoom-in()\n\ y: zoom-out()\n\ f: zoom-factor()\n\ Ctrlc: do-cut()\n\ Ctrlx: do-copy()\n\ Ctrlp: do-paste()\n\ Ctrlo: do-crop() Pixmap*Dialog.value*baseTranslations: #augment\ : insert-char()\n Pixmap*Toggle.translations: : highlight(WhenUnset)\n\ : unhighlight()\n\ ,: set() notify() Pixmap*MenuButton.translations: : highlight()\n\ : reset()\n\ : reset() fix-menu() PopupMenu() Pixmap*Dialog.value.translations:#override Return: set-okay() Pixmap*image.label.translations:#override ,: switch-image() Pixmap*image.label.label: Pixmap*image.width: 50 Pixmap*image.height: 50 Pixmap*colorView.allowHoriz: True Pixmap*colorView.allowVert: True Pixmap*colorView.useBottom: True Pixmap*colorView.useRight: True Pixmap*colorView.width: 500 Pixmap*colorView.height: 70 Pixmap*colorView.preferredPaneSize: 70 Pixmap*colorView.skipAdjust: False Pixmap*colorPane.width: 500 Pixmap*colorPane.height: 70 Pixmap*colorPane*Command.label: Pixmap*colorPane*Command.width: 15 Pixmap*colorPane*Command.height: 15 Pixmap*pixmapView.allowHoriz: True Pixmap*pixmapView.allowVert: True Pixmap*pixmapView.useBottom: True Pixmap*pixmapView.useRight: True Pixmap*pixmapView.width: 500 Pixmap*pixmapView.height: 500 Pixmap*pixmap.pixmapWidth: 32 Pixmap*pixmap.pixmapHeight: 32 Pixmap*pixmap.squareSize: 15 Pixmap*pixmap.cursor: tcross Pixmap*pixmap.stipple: @PIXMAPDIR@Stipple Pixmap*info*label.font:-adobe-helvetica-bold-r-normal--*-100-*-*-p-*-iso8859-1 Pixmap*info*label.height: 150 Pixmap*TransientShell.width: 300 !Pixmap*Dialog.value.borderWidth: 0 Pixmap*input*icon: Term Pixmap*qsave*icon: Term Pixmap*file*icon: Term Pixmap*error*icon: Excl Pixmap*Dialog.Yes.label: Yes Pixmap*Dialog.No.label: No Pixmap*Dialog.Okay.label: OK Pixmap*Dialog.Abort.label: Abort Pixmap*Dialog.Cancel.label: Cancel Pixmap*Dialog.Retry.label: Retry Pixmap*MenuButton.width: 52 Pixmap*SimpleMenu.width: 0 Pixmap*SimpleMenu.height: 0 Pixmap*SimpleMenu.cursor: hand2 Pixmap*SimpleMenu.line.height: 0 Pixmap*fileButton.label: File Pixmap*fileButton.menuName: fileMenu Pixmap*editButton.label: Edit Pixmap*editButton.fromHoriz: fileButton Pixmap*editButton.menuName: editMenu Pixmap*colorButton.width: 120 Pixmap*colorButton.label: Foreground Color Pixmap*colorButton.fromHoriz: editButton Pixmap*colorButton.menuName: colorMenu Pixmap*extensionButton.width: 120 Pixmap*extensionButton.label: Xpm Extensions Pixmap*extensionButton.fromHoriz: colorButton Pixmap*extensionButton.menuName: extensionMenu Pixmap*infoButton.width: 48 Pixmap*infoButton.label: About Pixmap*infoButton.fromHoriz: extensionButton Pixmap*formy.status*top: ChainTop Pixmap*formy.status*bottom: ChainTop Pixmap*formy.status*left: ChainLeft Pixmap*formy.status*right: ChainRight Pixmap*status.fromHoriz: infoButton Pixmap*status.borderWidth: 0 Pixmap*infoPopup.width: 335 Pixmap*infoPopup.height: 150 Pixmap*SmeBSB.HorizontalMargins: 32 Pixmap*fileMenu.load.label: Load...[Alt l] Pixmap*fileMenu.insert.label: Insert...[Alt i] Pixmap*fileMenu.save.label: Save [Alt s] Pixmap*fileMenu.saveAs.label: Save As...[Alt a] Pixmap*fileMenu.resize.label: Resize...[Alt r] Pixmap*fileMenu.rescale.label: Rescale...[Alt e] Pixmap*fileMenu.filename.label: Filename...[Alt f] Pixmap*fileMenu.hintsCmt.label: Hints comment...[Alt h] Pixmap*fileMenu.colorsCmt.label: Colors comment...[Alt c] Pixmap*fileMenu.pixelsCmt.label: Pixels comment...[Alt p] Pixmap*fileMenu.quit.label: Quit [Alt q] Pixmap*editMenu.image.label: Image [i] Pixmap*editMenu.grid.label: Grid [g] Pixmap*editMenu.axes.label: Axes [a] Pixmap*editMenu.proportional.label: Proportional [p] Pixmap*editMenu.zoom.label: Zoom [z] Pixmap*editMenu.zoomIn.label: Zoom In [x] Pixmap*editMenu.zoomOut.label: Zoom Out [y] Pixmap*editMenu.zoomFactor.label: Zoom Factor [f] Pixmap*editMenu.cut.label: Cut [Ctrl c] Pixmap*editMenu.copy.label: Copy [Ctrl x] Pixmap*editMenu.paste.label: Paste [Ctrl p] Pixmap*editMenu.crop.label: Crop [Ctrl o] Pixmap*colorMenu.addColor.label: Add Color...[Ctrl a] Pixmap*colorMenu.symbolicName.label: Symbolic name...[Ctrl s] Pixmap*colorMenu.monochromeName.label: Monochrome name...[Ctrl m] Pixmap*colorMenu.g4Name.label: Grey scale 4 name...[Ctrl 4] Pixmap*colorMenu.gName.label: Grey scale name...[Ctrl g] Pixmap*colorMenu.cName.label: Color name...[Ctrl n] Pixmap*extensionMenu.addExtension.label: Add Extension... Pixmap*form.undo.label: Undo Pixmap*form.clear.vertDistance: 10 Pixmap*form.clear.fromVert: undo Pixmap*form.clear.label: Clear Pixmap*form.set.fromVert: clear Pixmap*form.set.label: Set Pixmap*form.redraw.fromVert: set Pixmap*form.redraw.label: Redraw Pixmap*form.copy.vertDistance: 10 Pixmap*form.copy.fromVert: redraw Pixmap*form.copy.label: Copy Pixmap*form.move.fromVert: copy Pixmap*form.move.radioGroup: copy Pixmap*form.move.label: Move Pixmap*form.mark.fromVert: move Pixmap*form.mark.label: Mark Pixmap*form.mark.radioGroup: copy Pixmap*form.unmark.fromVert: mark Pixmap*form.unmark.label: Unmark Pixmap*form.unmark.radioGroup: copy Pixmap*form.flipHoriz.vertDistance: 10 Pixmap*form.flipHoriz.width: 36 Pixmap*form.flipHoriz.height: 36 Pixmap*form.flipHoriz.fromVert: unmark Pixmap*form.flipHoriz.bitmap: @PIXMAPDIR@FlipHoriz Pixmap*form.up.vertDistance: 10 Pixmap*form.up.width: 36 Pixmap*form.up.height: 36 Pixmap*form.up.fromVert: unmark Pixmap*form.up.fromHoriz: flipHoriz Pixmap*form.up.bitmap: @PIXMAPDIR@Up Pixmap*form.flipVert.vertDistance: 10 Pixmap*form.flipVert.width: 36 Pixmap*form.flipVert.height: 36 Pixmap*form.flipVert.fromVert: unmark Pixmap*form.flipVert.fromHoriz: up Pixmap*form.flipVert.bitmap: @PIXMAPDIR@FlipVert Pixmap*form.left.width: 36 Pixmap*form.left.height: 36 Pixmap*form.left.fromVert: flipHoriz Pixmap*form.left.bitmap: @PIXMAPDIR@Left Pixmap*form.fold.width: 36 Pixmap*form.fold.height: 36 Pixmap*form.fold.fromVert: up Pixmap*form.fold.fromHoriz: left Pixmap*form.fold.bitmap: @PIXMAPDIR@Fold Pixmap*form.right.width: 36 Pixmap*form.right.height: 36 Pixmap*form.right.fromVert: flipVert Pixmap*form.right.fromHoriz: fold Pixmap*form.right.bitmap: @PIXMAPDIR@Right Pixmap*form.rotateLeft.width: 36 Pixmap*form.rotateLeft.height: 36 Pixmap*form.rotateLeft.fromVert: left Pixmap*form.rotateLeft.bitmap: @PIXMAPDIR@RotateLeft Pixmap*form.down.width: 36 Pixmap*form.down.height: 36 Pixmap*form.down.fromVert: fold Pixmap*form.down.fromHoriz: rotateLeft Pixmap*form.down.bitmap: @PIXMAPDIR@Down Pixmap*form.rotateRight.width: 36 Pixmap*form.rotateRight.height: 36 Pixmap*form.rotateRight.fromVert: right Pixmap*form.rotateRight.fromHoriz: down Pixmap*form.rotateRight.bitmap: @PIXMAPDIR@RotateRight Pixmap*form.point.vertDistance: 10 Pixmap*form.point.fromVert: rotateLeft Pixmap*form.point.radioGroup: move Pixmap*form.point.label: Point Pixmap*form.curve.fromVert: point Pixmap*form.curve.radioGroup: point Pixmap*form.curve.label: Curve Pixmap*form.line.fromVert: curve Pixmap*form.line.radioGroup: curve Pixmap*form.line.label: Line Pixmap*form.rectangle.fromVert: line Pixmap*form.rectangle.radioGroup: line Pixmap*form.rectangle.label: Rectangle Pixmap*form.filledRectangle.fromVert: rectangle Pixmap*form.filledRectangle.radioGroup: rectangle Pixmap*form.filledRectangle.label: Filled Rectangle Pixmap*form.circle.fromVert: filledRectangle Pixmap*form.circle.radioGroup: filledRectangle Pixmap*form.circle.label: Circle Pixmap*form.filledCircle.fromVert: circle Pixmap*form.filledCircle.radioGroup: circle Pixmap*form.filledCircle.label: Filled Circle Pixmap*form.floodFill.fromVert: filledCircle Pixmap*form.floodFill.radioGroup: filledCircle Pixmap*form.floodFill.label: Flood Fill Pixmap*form.text.fromVert: floodFill Pixmap*form.text.radioGroup: floodFill Pixmap*form.text.label: Text Pixmap*form.setHotSpot.vertDistance: 10 Pixmap*form.setHotSpot.fromVert: text Pixmap*form.setHotSpot.radioGroup: text Pixmap*form.setHotSpot.label: Set Hot Spot Pixmap*form.clearHotSpot.fromVert: setHotSpot Pixmap*form.clearHotSpot.radioGroup: setHotSpot Pixmap*form.clearHotSpot.label: Clear Hot Spot ! Port Editor Buttons ! Pixmap*form.setPort.vertDistance: 10 Pixmap*form.setPort.fromVert: clearHotSpot Pixmap*form.setPort.radioGroup: point Pixmap*form.setPort.label: Set Port Pixmap*form.clearPort.fromVert: setPort Pixmap*form.clearPort.radioGroup: point Pixmap*form.clearPort.label: Clear Port Pixmap*form.movePort.fromVert: clearPort Pixmap*form.movePort.radioGroup: point Pixmap*form.movePort.label: Move Port Pixmap*form.portInfo.fromVert: movePort Pixmap*form.portInfo.radioGroup: point Pixmap*form.portInfo.label: Port Info ... ! Extension Editor Pixmap*extEditorShell.width: 510 Pixmap*extEditor.text.width: 500 Pixmap*extEditor.name.width: 500 Pixmap*extEditor.text.height: 200 Pixmap*extEditor.text.fromVert: name Pixmap*extEditor.ok.fromVert: text Pixmap*extEditor.cancel.fromVert: text Pixmap*extEditor.cancel.fromHoriz: ok Pixmap*extEditor.remove.fromVert: text Pixmap*extEditor.remove.fromHoriz: cancel Pixmap*extEditor.Command.left: ChainLeft Pixmap*extEditor.Command.right: ChainLeft Pixmap*extEditor.Command.bottom: ChainBottom Pixmap*extEditor.Command.top: ChainBottom Pixmap*extEditor.name.top: ChainTop Pixmap*extEditor.name.bottom: ChainTop Pixmap*extEditor.text.bottom: ChainBottom Pixmap*extEditor.text.top: ChainTop Pixmap*extEditor.name.justify: left Pixmap*extEditor.name.borderWidth: 0 Pixmap*extEditor.ok.label: Okay Pixmap*extEditor.cancel.label: Cancel Pixmap*extEditor.remove.label: Remove Pixmap*extEditor.text*editType: edit Pixmap*extEditor.text.wrap: word Pixmap*extEditor.text.autoFill: False Pixmap*extEditor.text.scrollVertical: always Pixmap*extEditor.text*baseTranslations: #augment\ : insert-char()\n ! Text options dialog Pixmap*textOptions.fontName*string: -*-fixed-medium-*-*-*-13-*-100-*-*-60-*-* Pixmap*textOptions.textString*string: Hello, Woody! Pixmap*textOptionsShell.width: 465 Pixmap*textOptions.title.width: 455 Pixmap*textOptions.fontStatus.width: 455 Pixmap*textOptions.fontLabel.width: 100 Pixmap*textOptions.textLabel.width: 100 Pixmap*textOptions.fontName.width: 350 Pixmap*textOptions.textString.width: 350 Pixmap*textOptions.fontStatus.fromVert: title Pixmap*textOptions.fontLabel.fromVert: fontStatus Pixmap*textOptions.fontName.fromVert: fontStatus Pixmap*textOptions.fontName.fromHoriz: fontLabel Pixmap*textOptions.textLabel.fromVert: fontLabel Pixmap*textOptions.textString.fromVert: fontLabel Pixmap*textOptions.textString.fromHoriz: textLabel Pixmap*textOptions.close.vertDistance: 20 Pixmap*textOptions.close.fromVert: textLabel Pixmap*textOptions.apply.vertDistance: 20 Pixmap*textOptions.apply.fromVert: textLabel Pixmap*textOptions.apply.fromHoriz: close Pixmap*textOptions.title.label: Text Options Pixmap*textOptions.fontStatus.label: Pixmap*textOptions.fontLabel.label: Font Name: Pixmap*textOptions.textLabel.label: Text String: Pixmap*textOptions.title.justify: Center Pixmap*textOptions.fontStatus.justify: Center Pixmap*textOptions.fontLabel.justify: Right Pixmap*textOptions.textLabel.justify: Right Pixmap*textOptions.Label.borderWidth: 0 Pixmap*textOptions*close*label: Close Pixmap*textOptions*apply*label: Apply Pixmap*textOptions.fontName*editType: edit Pixmap*textOptions.fontName.resizable: True Pixmap*textOptions.fontName.resize: width Pixmap*textOptions.textString*editType: edit Pixmap*textOptions.textString.resizable: True Pixmap*textOptions.textString.resize: width Pixmap*textOptions.fontName.translations:#override Return: apply() Pixmap*textOptions.textString.translations:#override Return: apply() Pixmap*textOptions.fontName*baseTranslations: #augment\ : insert-char() Pixmap*textOptions.textString*baseTranslations: #augment\ : insert-char() pixmap-2.6pl4.orig/MPixmap.ad100644 243 144 40062 6263264165 14705 0ustar joostusersPixmap*TransientShell.allowShellResize: True Pixmap*fontList:-adobe-helvetica-bold-r-normal--12-120-*-*-*-*-iso*-* Pixmap*menuCursor: left_ptr Pixmap*pixmap.baseTranslations:#override\ Metal: do-load()\n\ Metai: do-insert()\n\ Metas: do-save()\n\ Metaa: do-save-as()\n\ Metar: do-resize()\n\ Metae: do-rescale()\n\ Metaf: do-filename()\n\ Metah: do-hintscmt()\n\ Metac: do-colorscmt()\n\ Metap: do-pixelscmt()\n\ Metaq: do-quit()\n\ Ctrla: do-addcolor()\n\ Ctrls: do-symbname()\n\ Ctrlm: do-mononame()\n\ Ctrl4: do-grey4name()\n\ Ctrlg: do-greyname()\n\ Ctrln: do-colorname()\n\ i: switch-image()\n\ g: switch-grid()\n\ a: switch-axes()\n\ p: switch-proportional()\n\ z: switch-zoom()\n\ x: zoom-in()\n\ y: zoom-out()\n\ f: zoom-factor()\n\ Ctrlc: do-cut()\n\ Ctrlx: do-copy()\n\ Ctrlp: do-paste()\n\ Ctrlo: do-crop() Pixmap*MarginTop: 0 Pixmap*MarginBottom: 0 Pixmap*input.dialogStyle: DIALOG_FULL_APPLICATION_MODAL Pixmap*error.dialogStyle: DIALOG_FULL_APPLICATION_MODAL Pixmap*qsave.dialogStyle: DIALOG_FULL_APPLICATION_MODAL Pixmap*file.dialogStyle: DIALOG_FULL_APPLICATION_MODAL Pixmap*extEditor_popup*dialogStyle: DIALOG_FULL_APPLICATION_MODAL Pixmap*image.label.translations:#override,:switch-image() Pixmap*image.label.label: Pixmap*image.width: 50 Pixmap*image.height: 50 Pixmap*formy.topAttachment: ATTACH_FORM Pixmap*formy.leftAttachment: ATTACH_FORM Pixmap*formy.rightAttachment: ATTACH_FORM Pixmap*vPane.topAttachment: ATTACH_FORM Pixmap*vPane.bottomAttachment: ATTACH_FORM Pixmap*vPane.rightAttachment: ATTACH_FORM Pixmap*pixmapView.width: 510 Pixmap*pixmapView.height: 510 Pixmap*pixmapView.scrollingPolicy: AUTOMATIC Pixmap*pixmapView.scrollBarDisplayPolicy: AS_NEEDED Pixmap*pixmapView.visualPolicy: CONSTANT Pixmap*pixmapView.resizable: True Pixmap*pviewHS.orientation: HORIZONTAL Pixmap*pviewVS.orientation: VERTICAL Pixmap*pixmap.pixmapWidth: 32 Pixmap*pixmap.pixmapHeight: 32 Pixmap*pixmap.squareSize: 15 Pixmap*pixmap.cursor: tcross Pixmap*pixmap.stipple: @PIXMAPDIR@Stipple Pixmap*colorView.width: 508 Pixmap*colorView.height: 70 Pixmap*colorView.scrollingPolicy: AUTOMATIC Pixmap*colorView.scrollBarDisplayPolicy: AS_NEEDED Pixmap*colorView.visualPolicy: CONSTANT Pixmap*colorView.resizable: True Pixmap*cviewHS.orientation: HORIZONTAL Pixmap*cviewVS.orientation: VERTICAL Pixmap*colorPane.orientation: VERTICAL Pixmap*colorPane.numColumns: 40 Pixmap*colorPane.packing: PACK_COLUMN Pixmap*colorPane.spacing: 0 Pixmap*colorPane.marginWidth: 0 Pixmap*colorPane.marginHeight: 0 Pixmap*colorPane*XmPushButton.marginLeft: 5 Pixmap*colorPane*XmPushButton.marginRight: 5 Pixmap*colorPane*XmPushButton.marginTop: 5 Pixmap*colorPane*XmPushButton.marginBottom: 5 Pixmap*colorPane*XmPushButton.labelString: Pixmap*colorPane*XmPushButton.shadowThickness: 2 Pixmap*colorPane*XmPushButton.fillOnArm: False Pixmap*colorPane*XmPushButton.topShadowColor: gray70 Pixmap*colorPane*XmPushButton..bottomShadowColor: gray30 Pixmap*info*label.fontList:-adobe-helvetica-bold-r-normal--*-100-*-*-p-*-iso8859-1 Pixmap*info*label.height: 150 Pixmap*infoPopup.width: 300 Pixmap*infoPopup.height: 150 Pixmap*fileButton.labelString: File Pixmap*editButton.labelString: Edit Pixmap*colorButton.labelString: Foreground Color Pixmap*extensionButton.labelString: Xpm Extensions Pixmap*status.labelString: Filename: foobargeefoobargee Pixmap*statusb.labelString: Size: xxxxxxxxx Pixmap*infoButton.labelString: About Pixmap*infoButton.width: 48 Pixmap*infoButton.rightAttachment: ATTACH_FORM Pixmap*fileMenu.load.labelString: Load... Pixmap*fileMenu.load.accelerator: Altl Pixmap*fileMenu.load.acceleratorText: Alt l Pixmap*fileMenu.insert.labelString: Insert... Pixmap*fileMenu.insert.accelerator: Alti Pixmap*fileMenu.insert.acceleratorText: Alt i Pixmap*fileMenu.save.labelString: Save Pixmap*fileMenu.save.accelerator: Alts Pixmap*fileMenu.save.acceleratorText: Alt s Pixmap*fileMenu.saveAs.labelString: Save As... Pixmap*fileMenu.saveAs.accelerator: Alta Pixmap*fileMenu.saveAs.acceleratorText: Alt a Pixmap*fileMenu.resize.labelString: Resize... Pixmap*fileMenu.resize.accelerator: Altr Pixmap*fileMenu.resize.acceleratorText: Alt r Pixmap*fileMenu.rescale.labelString: Rescale... Pixmap*fileMenu.rescale.accelerator: Alte Pixmap*fileMenu.rescale.acceleratorText: Alt e Pixmap*fileMenu.filename.labelString: Filename... Pixmap*fileMenu.filename.accelerator: Altf Pixmap*fileMenu.filename.acceleratorText: Alt f Pixmap*fileMenu.hintsCmt.labelString: Hints comment... Pixmap*fileMenu.hintsCmt.accelerator: Alth Pixmap*fileMenu.hintsCmt.acceleratorText: Alt h Pixmap*fileMenu.colorsCmt.labelString: Colors comment... Pixmap*fileMenu.colorsCmt.accelerator: Altc Pixmap*fileMenu.colorsCmt.acceleratorText: Alt c Pixmap*fileMenu.pixelsCmt.labelString: Pixels comment... Pixmap*fileMenu.pixelsCmt.accelerator: Altp Pixmap*fileMenu.pixelsCmt.acceleratorText: Alt p Pixmap*fileMenu.quit.labelString: Quit Pixmap*fileMenu.quit.accelerator: Altq Pixmap*fileMenu.quit.acceleratorText: Alt q Pixmap*editMenu.image.labelString: Image Pixmap*editMenu.image.accelerator: i Pixmap*editMenu.image.acceleratorText: i Pixmap*editMenu.image.marginHeight: 0 Pixmap*editMenu.image.marginTop: 0 Pixmap*editMenu.image.marginBottom: 0 Pixmap*editMenu.grid.labelString: Grid Pixmap*editMenu.grid.accelerator: g Pixmap*editMenu.grid.acceleratorText: g Pixmap*editMenu.grid.marginHeight: 0 Pixmap*editMenu.grid.marginTop: 0 Pixmap*editMenu.grid.marginBottom: 0 Pixmap*editMenu.axes.labelString: Axes Pixmap*editMenu.axes.accelerator: a Pixmap*editMenu.axes.acceleratorText: a Pixmap*editMenu.axes.marginHeight: 0 Pixmap*editMenu.axes.marginTop: 0 Pixmap*editMenu.axes.marginBottom: 0 Pixmap*editMenu.proportional.labelString: Proportional Pixmap*editMenu.proportional.accelerator: p Pixmap*editMenu.proportional.acceleratorText: p Pixmap*editMenu.proportional.marginHeight: 0 Pixmap*editMenu.proportional.marginTop: 0 Pixmap*editMenu.proportional.marginBottom: 0 Pixmap*editMenu.zoom.labelString: Zoom Pixmap*editMenu.zoom.accelerator: z Pixmap*editMenu.zoom.acceleratorText: z Pixmap*editMenu.zoom.marginHeight: 0 Pixmap*editMenu.zoom.marginTop: 0 Pixmap*editMenu.zoom.marginBottom: 0 Pixmap*editMenu.zoomIn.labelString: Zoom In Pixmap*editMenu.zoomIn.accelerator: x Pixmap*editMenu.zoomIn.acceleratorText: x Pixmap*editMenu.zoomIn.marginHeight: 0 Pixmap*editMenu.zoomIn.marginTop: 0 Pixmap*editMenu.zoomIn.marginBottom: 0 Pixmap*editMenu.zoomOut.labelString: Zoom Out Pixmap*editMenu.zoomOut.accelerator: y Pixmap*editMenu.zoomOut.acceleratorText: y Pixmap*editMenu.zoomOut.marginHeight: 0 Pixmap*editMenu.zoomOut.marginTop: 0 Pixmap*editMenu.zoomOut.marginBottom: 0 Pixmap*editMenu.zoomFactor.labelString: Zooming Factor Pixmap*editMenu.zoomFactor.accelerator: f Pixmap*editMenu.zoomFactor.acceleratorText: f Pixmap*editMenu.zoomFactor.marginHeight: 0 Pixmap*editMenu.zoomFactor.marginTop: 0 Pixmap*editMenu.zoomFactor.marginBottom: 0 Pixmap*editMenu.cut.labelString: Cut Pixmap*editMenu.cut.accelerator: Ctrlc Pixmap*editMenu.cut.acceleratorText: Ctrl c Pixmap*editMenu.copy.labelString: Copy Pixmap*editMenu.copy.accelerator: Ctrlx Pixmap*editMenu.copy.acceleratorText: Ctrl x Pixmap*editMenu.paste.labelString: Paste Pixmap*editMenu.paste.accelerator: Ctrlp Pixmap*editMenu.paste.acceleratorText: Ctrl p Pixmap*editMenu.crop.labelString: Crop Pixmap*editMenu.crop.accelerator: Ctrlo Pixmap*editMenu.crop.acceleratorText: Ctrl o Pixmap*colorMenu.addColor.labelString: Add Color... Pixmap*colorMenu.addColor.accelerator: Ctrla Pixmap*colorMenu.addColor.acceleratorText: Ctrl a Pixmap*colorMenu.symbolicName.labelString: Symbolic name... Pixmap*colorMenu.symbolicName.accelerator: Ctrls Pixmap*colorMenu.symbolicName.acceleratorText: Ctrl s Pixmap*colorMenu.monochromeName.labelString: Monochrome name... Pixmap*colorMenu.monochromeName.accelerator: Ctrlm Pixmap*colorMenu.monochromeName.acceleratorText:Ctrl m Pixmap*colorMenu.g4Name.labelString: Grey scale 4 name... Pixmap*colorMenu.g4Name.accelerator: Ctrl4 Pixmap*colorMenu.g4Name.acceleratorText: Ctrl 4 Pixmap*colorMenu.gName.labelString: Grey scale name... Pixmap*colorMenu.gName.accelerator: Ctrlg Pixmap*colorMenu.gName.acceleratorText: Ctrl g Pixmap*colorMenu.cName.labelString: Color name... Pixmap*colorMenu.cName.accelerator: Ctrln Pixmap*colorMenu.cName.acceleratorText: Ctrl n Pixmap*extensionMenu.addExtension.labelString: Add Extension... Pixmap*pane.leftAttachment: ATTACH_FORM Pixmap*pane.rightAttachment: ATTACH_FORM Pixmap*pane.topAttachment: ATTACH_FORM Pixmap*pane.bottomAttachment: ATTACH_FORM Pixmap*pane.packing: PACK_NONE Pixmap*pane*navigationType: NONE Pixmap*pane*traversalOn: False Pixmap*form*translations: : ManagerGadgetButtonMotion()\n\ : ManagerGadgetArm()\n\ ,: ManagerGadgetActivate()\n\ : ManagerGadgetActivate()\n\ (2+): ManagerGadgetMultiArm()\n\ (2+): ManagerGadgetMultiActivate() Pixmap*form.spacing: 0 Pixmap*form.undo.labelString: Undo Pixmap*form.clear.labelString: Clear Pixmap*form.set.labelString: Set Pixmap*form.redraw.labelString: Redraw Pixmap*form.copy.labelString: Copy Pixmap*form.move.labelString: Move Pixmap*form.mark.labelString: Mark Pixmap*form.unmark.labelString: Unmark Pixmap*formh.orientation: HORIZONTAL Pixmap*formh.marginWidth: 15 Pixmap*formh.spacing: 10 Pixmap*formh.marginHeight: 0 Pixmap*formh.flipHoriz.labelType: PIXMAP Pixmap*formh.flipHoriz.labelPixmap: @PIXMAPDIR@MFlipHoriz Pixmap*formh.up.labelType: PIXMAP Pixmap*formh.up.labelPixmap: @PIXMAPDIR@MUp Pixmap*formh.flipVert.labelType: PIXMAP Pixmap*formh.flipVert.labelPixmap: @PIXMAPDIR@MFlipVert Pixmap*formh.left.labelType: PIXMAP Pixmap*formh.left.labelPixmap: @PIXMAPDIR@MLeft Pixmap*formh.fold.labelType: PIXMAP Pixmap*formh.fold.labelPixmap: @PIXMAPDIR@MFold Pixmap*formh.right.labelType: PIXMAP Pixmap*formh.right.labelPixmap: @PIXMAPDIR@MRight Pixmap*formh.rotateLeft.labelType: PIXMAP Pixmap*formh.rotateLeft.labelPixmap: @PIXMAPDIR@MRotateLeft Pixmap*formh.down.labelType: PIXMAP Pixmap*formh.down.labelPixmap: @PIXMAPDIR@MDown Pixmap*formh.rotateRight.labelType: PIXMAP Pixmap*formh.rotateRight.labelPixmap: @PIXMAPDIR@MRotateRight Pixmap*form.point.labelString: Point Pixmap*form.curve.labelString: Curve Pixmap*form.line.labelString: Line Pixmap*form.rectangle.labelString: Rectangle Pixmap*form.filledRectangle.labelString: Filled Rectangle Pixmap*form.circle.labelString: Circle Pixmap*form.filledCircle.labelString: Filled Circle Pixmap*form.floodFill.labelString: Flood Fill Pixmap*form.setHotSpot.labelString: Set Hot Spot Pixmap*form.clearHotSpot.labelString: Clear Hot Spot ! Port Editor Buttons ! Pixmap*form.setPort.labelString: Set Port Pixmap*form.clearPort.labelString: Clear Port Pixmap*form.movePort.labelString: Move Port Pixmap*form.portInfo.labelString: Port Info ... Pixmap*textOptions_popup.minWidth: 400 Pixmap*textOptions_popup.minHeight: 150 Pixmap*textOptions.width: 400 Pixmap*textOptions.height: 150 Pixmap*textOptions.autoUnmanage: False Pixmap*textOptions.title.labelString: Text Options Pixmap*textOptions.fontStatus.labelString: Pixmap*textOptions.fontLabel.labelString: Font Name: Pixmap*textOptions.textLabel.labelString: Text String: Pixmap*textOptions.close.labelString: Close Pixmap*textOptions.close.width: 70 Pixmap*textOptions.apply.labelString: Apply Pixmap*textOptions.apply.width: 70 Pixmap*textOptions.fontName.value: -*-fixed-medium-*-*-*-13-*-100-*-*-60-*-* Pixmap*textOptions.textString.value: Hello, Woody! Pixmap*textOptions.title.topAttachment: ATTACH_POSITION Pixmap*textOptions.title.topPosition: 5 Pixmap*textOptions.title.leftAttachment: ATTACH_FORM Pixmap*textOptions.title.rightAttachment: ATTACH_FORM Pixmap*textOptions.fontStatus.topAttachment: ATTACH_POSITION Pixmap*textOptions.fontStatus.topPosition: 15 Pixmap*textOptions.fontStatus.leftAttachment: ATTACH_FORM Pixmap*textOptions.fontStatus.rightAttachment: ATTACH_FORM Pixmap*textOptions.fontLabel.topAttachment: ATTACH_POSITION Pixmap*textOptions.fontLabel.topPosition: 33 Pixmap*textOptions.fontLabel.leftAttachment: ATTACH_POSITION Pixmap*textOptions.fontLabel.leftPosition: 5 Pixmap*textOptions.fontName.topAttachment: ATTACH_POSITION Pixmap*textOptions.fontName.topPosition: 30 Pixmap*textOptions.fontName.leftAttachment: ATTACH_POSITION Pixmap*textOptions.fontName.leftPosition: 25 Pixmap*textOptions.fontName.rightAttachment: ATTACH_POSITION Pixmap*textOptions.fontName.rightPosition: 95 Pixmap*textOptions.textLabel.topAttachment: ATTACH_POSITION Pixmap*textOptions.textLabel.topPosition: 55 Pixmap*textOptions.textLabel.leftAttachment: ATTACH_POSITION Pixmap*textOptions.textLabel.leftPosition: 5 Pixmap*textOptions.textString.topAttachment: ATTACH_POSITION Pixmap*textOptions.textString.topPosition: 52 Pixmap*textOptions.textString.leftAttachment: ATTACH_POSITION Pixmap*textOptions.textString.leftPosition: 25 Pixmap*textOptions.textString.rightAttachment: ATTACH_POSITION Pixmap*textOptions.textString.rightPosition: 95 Pixmap*textOptions.close.bottomAttachment: ATTACH_POSITION Pixmap*textOptions.close.bottomPosition: 95 Pixmap*textOptions.close.leftAttachment: ATTACH_POSITION Pixmap*textOptions.close.leftPosition: 25 Pixmap*textOptions.apply.bottomAttachment: ATTACH_POSITION Pixmap*textOptions.apply.bottomPosition: 95 Pixmap*textOptions.apply.leftAttachment: ATTACH_POSITION Pixmap*textOptions.apply.leftPosition: 60 ! Extension editor dialog Pixmap*extEditor_popup.minHeight: 250 Pixmap*extEditor_popup.minWidth: 220 Pixmap*extEditor_popup*XmForm.height: 300 Pixmap*extEditor_popup*XmForm.width: 250 Pixmap*extEditor_popup*text.editMode: MULTI_LINE_EDIT Pixmap*extEditor_popup*ok.labelString: Okay Pixmap*extEditor_popup*cancel.labelString: Cancel Pixmap*extEditor_popup*remove.labelString: Remove Pixmap*extEditor_popup*name.leftAttachment: ATTACH_POSITION Pixmap*extEditor_popup*name.leftPosition: 5 Pixmap*extEditor_popup*name.topAttachment: ATTACH_POSITION Pixmap*extEditor_popup*name.topPosition: 5 Pixmap*extEditor_popup*textSW.leftAttachment: ATTACH_POSITION Pixmap*extEditor_popup*textSW.leftPosition: 5 Pixmap*extEditor_popup*textSW.rightAttachment: ATTACH_POSITION Pixmap*extEditor_popup*textSW.rightPosition: 95 Pixmap*extEditor_popup*textSW.topAttachment: ATTACH_POSITION Pixmap*extEditor_popup*textSW.topPosition: 15 Pixmap*extEditor_popup*textSW.bottomAttachment: ATTACH_POSITION Pixmap*extEditor_popup*textSW.bottomPosition: 80 Pixmap*extEditor_popup*ok.width: 70 Pixmap*extEditor_popup*ok.leftAttachment: ATTACH_POSITION Pixmap*extEditor_popup*ok.leftPosition: 4 Pixmap*extEditor_popup*ok.bottomAttachment: ATTACH_POSITION Pixmap*extEditor_popup*ok.bottomPosition: 95 Pixmap*extEditor_popup*cancel.width: 70 Pixmap*extEditor_popup*cancel.leftAttachment: ATTACH_POSITION Pixmap*extEditor_popup*cancel.leftPosition: 36 Pixmap*extEditor_popup*cancel.bottomAttachment: ATTACH_POSITION Pixmap*extEditor_popup*cancel.bottomPosition: 95 Pixmap*extEditor_popup*remove.width: 70 Pixmap*extEditor_popup*remove.rightAttachment: ATTACH_POSITION Pixmap*extEditor_popup*remove.rightPosition: 96 Pixmap*extEditor_popup*remove.bottomAttachment: ATTACH_POSITION Pixmap*extEditor_popup*remove.bottomPosition: 95 pixmap-2.6pl4.orig/Stipple100644 243 144 154 5070571003 14310 0ustar joostusers#define Stipple_width 4 #define Stipple_height 4 static char Stipple_bits[] = { 0x00, 0x00, 0x03, 0x03}; pixmap-2.6pl4.orig/Excl100444 243 144 2064 5244454234 13614 0ustar joostusers#define Excl_width 40 #define Excl_height 32 static char Excl_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, 0xc3, 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, 0x0e, 0x00, 0x3c, 0x00, 0x70, 0x1e, 0x00, 0x00, 0x00, 0x78, 0xfe, 0xff, 0xff, 0xff, 0x7f, 0xfc, 0xff, 0xff, 0xff, 0x3f}; pixmap-2.6pl4.orig/Term100444 243 144 1553 5244454240 13627 0ustar joostusers#define Term_width 32 #define Term_height 32 static char Term_bits[] = { 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0x1f, 0x04, 0x00, 0x00, 0x20, 0xe4, 0xff, 0xff, 0x27, 0x14, 0x00, 0x00, 0x28, 0x14, 0x80, 0x01, 0x28, 0x14, 0x80, 0x01, 0x28, 0x14, 0x80, 0x01, 0x28, 0x14, 0x80, 0x01, 0x28, 0x14, 0x80, 0x01, 0x28, 0x14, 0x80, 0x01, 0x28, 0x14, 0x80, 0x00, 0x28, 0x14, 0x80, 0x00, 0x28, 0x14, 0x80, 0x00, 0x28, 0x14, 0x80, 0x00, 0x28, 0x14, 0x00, 0x00, 0x28, 0x14, 0x80, 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, 0xc0, 0x5f, 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}; pixmap-2.6pl4.orig/Up100644 243 144 1462 5057170444 13310 0ustar joostusers#define Up_width 30 #define Up_height 30 static char Up_bits[] = { 0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x70, 0x07, 0x00, 0x00, 0xb8, 0x0e, 0x00, 0x00, 0x5c, 0x1d, 0x00, 0x00, 0xae, 0x3a, 0x00, 0x00, 0x57, 0x75, 0x00, 0x80, 0xbb, 0xee, 0x00, 0xc0, 0x7d, 0xdf, 0x01, 0xe0, 0xbe, 0xbe, 0x03, 0x60, 0x77, 0x77, 0x03, 0xe0, 0xb3, 0xe6, 0x03, 0xe0, 0x71, 0xc7, 0x03, 0x00, 0xb0, 0x06, 0x00, 0x00, 0x70, 0x07, 0x00, 0x00, 0xb0, 0x06, 0x00, 0x00, 0x70, 0x07, 0x00, 0x00, 0xb0, 0x06, 0x00, 0x00, 0x70, 0x07, 0x00, 0x00, 0xb0, 0x06, 0x00, 0x00, 0x70, 0x07, 0x00, 0x00, 0xb0, 0x06, 0x00, 0x00, 0x70, 0x07, 0x00, 0x00, 0xb0, 0x06, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00, 0x70, 0x07, 0x00, 0x00, 0x30, 0x06, 0x00, 0x00, 0x10, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00}; pixmap-2.6pl4.orig/MUp100644 243 144 404 5564656034 13407 0ustar joostusers#define MUp_width 15 #define MUp_height 15 static char MUp_bits[] = { 0x00, 0x00, 0x80, 0x00, 0xc0, 0x01, 0x60, 0x03, 0xb0, 0x06, 0x58, 0x0d, 0xac, 0x1a, 0xfe, 0x3f, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0x00, 0x00}; pixmap-2.6pl4.orig/Down100644 243 144 1470 5057170440 13626 0ustar joostusers#define Down_width 30 #define Down_height 30 static char Down_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x18, 0x03, 0x00, 0x00, 0xb8, 0x03, 0x00, 0x00, 0xf8, 0x03, 0x00, 0x00, 0x58, 0x03, 0x00, 0x00, 0xb8, 0x03, 0x00, 0x00, 0x58, 0x03, 0x00, 0x00, 0xb8, 0x03, 0x00, 0x00, 0x58, 0x03, 0x00, 0x00, 0xb8, 0x03, 0x00, 0x00, 0x58, 0x03, 0x00, 0x00, 0xb8, 0x03, 0x00, 0x00, 0x58, 0x03, 0x00, 0x00, 0xb8, 0x03, 0x00, 0x00, 0x58, 0x03, 0x00, 0xf0, 0xb8, 0xe3, 0x01, 0xf0, 0x59, 0xf3, 0x01, 0xb0, 0xbb, 0xbb, 0x01, 0x70, 0x5f, 0xdf, 0x01, 0xe0, 0xbe, 0xef, 0x00, 0xc0, 0x5d, 0x77, 0x00, 0x80, 0xab, 0x3a, 0x00, 0x00, 0x57, 0x1d, 0x00, 0x00, 0xae, 0x0e, 0x00, 0x00, 0x5c, 0x07, 0x00, 0x00, 0xb8, 0x03, 0x00, 0x00, 0xf0, 0x01, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00}; pixmap-2.6pl4.orig/MDown100644 243 144 412 5564656031 13726 0ustar joostusers#define MDown_width 15 #define MDown_height 15 static char MDown_bits[] = { 0x00, 0x00, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xfe, 0x3f, 0xac, 0x1a, 0x58, 0x0d, 0xb0, 0x06, 0x60, 0x03, 0xc0, 0x01, 0x80, 0x00, 0x00, 0x00}; pixmap-2.6pl4.orig/FlipHoriz100644 243 144 1507 5057170440 14626 0ustar joostusers#define FlipHoriz_width 30 #define FlipHoriz_height 30 static char FlipHoriz_bits[] = { 0x00, 0x80, 0x07, 0x00, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x80, 0x1d, 0x00, 0x00, 0x80, 0x3b, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0xee, 0x00, 0x00, 0x00, 0xdc, 0x01, 0xc0, 0xff, 0xbf, 0x03, 0xe0, 0xff, 0x5f, 0x07, 0xb0, 0xaa, 0xaa, 0x0e, 0x58, 0x55, 0x55, 0x1d, 0xac, 0xaa, 0xaa, 0x0e, 0xfe, 0xff, 0x5f, 0x07, 0xff, 0xff, 0xbf, 0x03, 0x6b, 0x00, 0xdc, 0x01, 0x77, 0x00, 0xee, 0x00, 0x6b, 0x00, 0x77, 0x00, 0x77, 0x80, 0x3b, 0x00, 0x6b, 0x80, 0x1d, 0x00, 0x77, 0x80, 0x0f, 0x00, 0x6b, 0x80, 0x07, 0x00, 0xff, 0x1f, 0x00, 0x00, 0xfe, 0x0f, 0x00, 0x00, 0xac, 0x06, 0x00, 0x00, 0x58, 0x03, 0x00, 0x00, 0xb0, 0x06, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0xc0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; pixmap-2.6pl4.orig/MFlipHoriz100644 243 144 431 5564656031 14726 0ustar joostusers#define MFlipHoriz_width 15 #define MFlipHoriz_height 15 static char MFlipHoriz_bits[] = { 0x00, 0x00, 0x00, 0x00, 0xff, 0x07, 0x56, 0x0d, 0xac, 0x1a, 0x58, 0x35, 0xb0, 0x6a, 0xe0, 0x7f, 0xb0, 0x6a, 0x58, 0x35, 0xac, 0x1a, 0x56, 0x0d, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00}; pixmap-2.6pl4.orig/FlipVert100644 243 144 1504 5057170440 14450 0ustar joostusers#define FlipVert_width 30 #define FlipVert_height 30 static char FlipVert_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x80, 0x3b, 0x00, 0x00, 0xc0, 0x75, 0x00, 0x00, 0xe0, 0xea, 0x00, 0x00, 0x70, 0xd5, 0x01, 0x00, 0xb8, 0xaa, 0x03, 0x00, 0xdc, 0x75, 0x07, 0x00, 0xee, 0xfb, 0x0e, 0x00, 0xf7, 0xf5, 0x1d, 0x00, 0xbb, 0xbb, 0x1b, 0x00, 0x9f, 0x35, 0x1f, 0x00, 0x8f, 0x3b, 0x1e, 0x00, 0x80, 0x35, 0x00, 0x00, 0x80, 0x3b, 0x00, 0x00, 0x80, 0x35, 0x20, 0x08, 0x80, 0x3b, 0x60, 0x0c, 0x80, 0x35, 0xe0, 0x0e, 0x80, 0x3b, 0xe0, 0x0f, 0x80, 0x35, 0x60, 0x0d, 0x80, 0x3b, 0xe0, 0x0e, 0x80, 0xf5, 0x7f, 0x0d, 0x00, 0xfb, 0xff, 0x06, 0x00, 0xb6, 0x6a, 0x03, 0x00, 0x7c, 0xf5, 0x01, 0x00, 0xb8, 0xea, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xe0, 0x3f, 0x00}; pixmap-2.6pl4.orig/MFlipVert100644 243 144 426 5564656032 14560 0ustar joostusers#define MFlipVert_width 15 #define MFlipVert_height 15 static char MFlipVert_bits[] = { 0x04, 0x10, 0x0c, 0x18, 0x1c, 0x1c, 0x34, 0x16, 0x6c, 0x1b, 0xd4, 0x15, 0xac, 0x1a, 0xd4, 0x15, 0xac, 0x1a, 0xd4, 0x15, 0xac, 0x1a, 0xd8, 0x0d, 0xb0, 0x06, 0xe0, 0x03, 0xc0, 0x01}; pixmap-2.6pl4.orig/Fold100644 243 144 1470 5057170440 13603 0ustar joostusers#define Fold_width 30 #define Fold_height 30 static char Fold_bits[] = { 0xff, 0x3f, 0xff, 0x3f, 0xff, 0xff, 0xff, 0x3f, 0x57, 0xf5, 0xab, 0x3a, 0xab, 0xff, 0x7f, 0x35, 0xd7, 0x3f, 0xff, 0x3a, 0xab, 0x03, 0x70, 0x35, 0x57, 0x07, 0xb8, 0x3a, 0xbb, 0x0e, 0x5c, 0x37, 0x7f, 0x1d, 0xae, 0x3f, 0xfb, 0x3a, 0xd7, 0x37, 0xdf, 0xf5, 0xeb, 0x3e, 0x9b, 0xeb, 0x75, 0x36, 0x1f, 0xd7, 0x3a, 0x3e, 0x1f, 0xae, 0x1d, 0x3e, 0x0e, 0xfc, 0x0e, 0x1c, 0x0e, 0xdc, 0x0f, 0x1c, 0x1f, 0x6e, 0x1d, 0x3e, 0x1f, 0xd7, 0x3a, 0x3e, 0x9b, 0xeb, 0x75, 0x36, 0xdf, 0xf5, 0xeb, 0x3e, 0xfb, 0x3a, 0xd7, 0x37, 0x7f, 0x1d, 0xae, 0x3f, 0xbb, 0x0e, 0x5c, 0x37, 0x57, 0x07, 0xb8, 0x3a, 0xab, 0x03, 0x70, 0x35, 0xd7, 0x3f, 0xff, 0x3a, 0xab, 0xff, 0x7f, 0x35, 0x57, 0xf5, 0xab, 0x3a, 0xff, 0xff, 0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f}; pixmap-2.6pl4.orig/MFold100644 243 144 412 5564656032 13704 0ustar joostusers#define MFold_width 15 #define MFold_height 15 static char MFold_bits[] = { 0x3f, 0x3f, 0x1f, 0x3e, 0x0f, 0x3c, 0x1f, 0x3e, 0x3b, 0x37, 0xf1, 0x23, 0xe0, 0x01, 0xe0, 0x01, 0xf1, 0x23, 0x3b, 0x37, 0x1f, 0x3e, 0x0f, 0x3c, 0x1f, 0x3e, 0x3f, 0x3f, 0x00, 0x00}; pixmap-2.6pl4.orig/Left100644 243 144 1470 5057170441 13612 0ustar joostusers#define Left_width 30 #define Left_height 30 static char Left_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x80, 0x3b, 0x00, 0x00, 0xc0, 0x1d, 0x00, 0x00, 0xe0, 0x0e, 0x00, 0x00, 0x70, 0x07, 0x00, 0x00, 0xb8, 0xff, 0xff, 0x1f, 0x5c, 0xff, 0xff, 0x0f, 0xae, 0xaa, 0xaa, 0x06, 0x57, 0x55, 0x55, 0x03, 0xae, 0xaa, 0xaa, 0x06, 0x5c, 0xff, 0xff, 0x0f, 0xb8, 0xff, 0xff, 0x1f, 0x70, 0x07, 0x00, 0x00, 0xe0, 0x0e, 0x00, 0x00, 0xc0, 0x1d, 0x00, 0x00, 0x80, 0x3b, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; pixmap-2.6pl4.orig/MLeft100644 243 144 412 5564656032 13712 0ustar joostusers#define MLeft_width 15 #define MLeft_height 15 static char MLeft_bits[] = { 0x00, 0x00, 0x80, 0x00, 0xc0, 0x00, 0xe0, 0x00, 0xb0, 0x00, 0xd8, 0x00, 0xac, 0x3f, 0xd6, 0x3f, 0xac, 0x3f, 0xd8, 0x00, 0xb0, 0x00, 0xe0, 0x00, 0xc0, 0x00, 0x80, 0x00, 0x00, 0x00}; pixmap-2.6pl4.orig/Right100644 243 144 1473 5057170444 14003 0ustar joostusers#define Right_width 30 #define Right_height 30 static char Right_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x80, 0x1d, 0x00, 0x00, 0x80, 0x3b, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0xee, 0x00, 0x00, 0x00, 0xdc, 0x01, 0xff, 0xff, 0xbf, 0x03, 0xfe, 0xff, 0x5f, 0x07, 0xac, 0xaa, 0xaa, 0x0e, 0x58, 0x55, 0x55, 0x1d, 0xac, 0xaa, 0xaa, 0x0e, 0xfe, 0xff, 0x5f, 0x07, 0xff, 0xff, 0xbf, 0x03, 0x00, 0x00, 0xdc, 0x01, 0x00, 0x00, 0xee, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x80, 0x3b, 0x00, 0x00, 0x80, 0x1d, 0x00, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; pixmap-2.6pl4.orig/MRight100644 243 144 415 5564656033 14101 0ustar joostusers#define MRight_width 15 #define MRight_height 15 static char MRight_bits[] = { 0x00, 0x00, 0x80, 0x00, 0x80, 0x01, 0x80, 0x03, 0x80, 0x06, 0x80, 0x0d, 0xfe, 0x1a, 0xfe, 0x35, 0xfe, 0x1a, 0x80, 0x0d, 0x80, 0x06, 0x80, 0x03, 0x80, 0x01, 0x80, 0x00, 0x00, 0x00}; pixmap-2.6pl4.orig/RotateLeft100644 243 144 1512 5057170444 14771 0ustar joostusers#define RotateLeft_width 30 #define RotateLeft_height 30 static char RotateLeft_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x80, 0x3b, 0x00, 0x00, 0xc0, 0x1d, 0x00, 0x00, 0xe0, 0x0e, 0x00, 0x00, 0x70, 0xff, 0x0f, 0x00, 0xb8, 0xfe, 0x1f, 0x00, 0x5c, 0x55, 0x35, 0x00, 0xae, 0xaa, 0x6a, 0x00, 0x5c, 0x55, 0xd5, 0x00, 0xb8, 0xfe, 0xff, 0x01, 0x70, 0xff, 0xff, 0x03, 0xe0, 0x0e, 0x58, 0x03, 0xc0, 0x1d, 0xb8, 0x03, 0x80, 0x3b, 0x58, 0x03, 0x00, 0x77, 0xb8, 0x03, 0x00, 0x6e, 0x58, 0x03, 0x00, 0x7c, 0xb8, 0x03, 0x00, 0x78, 0x58, 0x03, 0x00, 0x00, 0xb8, 0x03, 0x00, 0x00, 0x58, 0x03, 0x00, 0x00, 0xf8, 0x03, 0x00, 0x00, 0xb8, 0x03, 0x00, 0x00, 0x18, 0x03, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; pixmap-2.6pl4.orig/MRotateLeft100644 243 144 434 5564656033 15076 0ustar joostusers#define MRotateLeft_width 15 #define MRotateLeft_height 15 static char MRotateLeft_bits[] = { 0x00, 0x00, 0x80, 0x00, 0xc0, 0x00, 0xe0, 0x00, 0xb0, 0x00, 0xd8, 0x00, 0xac, 0x0f, 0xd6, 0x18, 0xac, 0x3f, 0xd8, 0x38, 0xb0, 0x38, 0xe0, 0x38, 0xc0, 0x38, 0x80, 0x38, 0x00, 0x00}; pixmap-2.6pl4.orig/RotateRight100644 243 144 1515 5057170444 15157 0ustar joostusers#define RotateRight_width 30 #define RotateRight_height 30 static char RotateRight_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x80, 0x1d, 0x00, 0x00, 0x80, 0x3b, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0xee, 0x00, 0x00, 0x00, 0xdc, 0x01, 0x00, 0xfc, 0xbf, 0x03, 0x00, 0xfe, 0x5f, 0x07, 0x00, 0xab, 0xaa, 0x0e, 0x80, 0x55, 0x55, 0x1d, 0xc0, 0xaa, 0xaa, 0x0e, 0xe0, 0xff, 0x5f, 0x07, 0xf0, 0xff, 0xbf, 0x03, 0xb0, 0x06, 0xdc, 0x01, 0x70, 0x07, 0xee, 0x00, 0xb0, 0x06, 0x77, 0x00, 0x70, 0x87, 0x3b, 0x00, 0xb0, 0x86, 0x1d, 0x00, 0x70, 0x87, 0x0f, 0x00, 0xb0, 0x86, 0x07, 0x00, 0x70, 0x07, 0x00, 0x00, 0xb0, 0x06, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00, 0x70, 0x07, 0x00, 0x00, 0x30, 0x06, 0x00, 0x00, 0x10, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; pixmap-2.6pl4.orig/MRotateRight100644 243 144 437 5564656034 15265 0ustar joostusers#define MRotateRight_width 15 #define MRotateRight_height 15 static char MRotateRight_bits[] = { 0x00, 0x00, 0x80, 0x00, 0x80, 0x01, 0x80, 0x03, 0x80, 0x06, 0x80, 0x0d, 0xf8, 0x1a, 0x8c, 0x35, 0xfe, 0x1a, 0x8e, 0x0d, 0x8e, 0x06, 0x8e, 0x03, 0x8e, 0x01, 0x8e, 0x00, 0x00, 0x00}; pixmap-2.6pl4.orig/wave.xpm100644 243 144 5612 5244154446 14474 0ustar joostusers/* XPM */ static char * wave_xpm [] = { /**/ "50 50 7 1 1 22", /**/ " c lightblue", ". c white", "X s lines_in_dark m white c yellow", "o s dark_color m black c black", "O c #000040407979", "+ c #B7B7C2C2E5E5", "@ c #ABABA0A0FFFF", /* symbolic name:*/ " ", " ", " .. .. ", " . . . ", " . XXXXXXXXX ", " XXXXXXXXXXXXX ", " XXXXXXXXXXXXXXX ", " XXXXXXXXXXXXXXXXXXX .. .. ", " ....... XXXXXXXXXXXXXXXXXXX . . . ", " ........... XXXXXXXXXXXXXXXXXXXXX . ", " ............. XXXXXXXXooXooXXXXXXXXXX ", " .......OOOOO....XXXXXXXoXXoXXoXXXXXXXXX ", " .....OOOOOOOOOO...XXXXXXXXoXXXXXXXXXXXXX ", " ......OOOOOOOOOOOO..XXXXXXXXXXXXXXXXXXXXX ", " .. .+OOOOOOOOOOOOO++XXXXXXXXXXXXXXXXXXX ", " . +OOOOOOOOOOOOOOO++XXXXXXXXXXXXXXXXX ", " . +OOOOOOOOOOOOOOOO++XXXXXXXXXXXXXXX ", " . +OOOOOOOOOOOOOOOOOO+XXXXXXXXXXXXXX ", " +OOOOOOOOOOOOOOOOOO++XXXXXXXXXXXX ", " +OOOOOOOOOOOOOOOOOOOO+XXXXXXXXXXX ", " . +OOOOOOOOOOOOOOOOOOOO+XXXXXXXXXX ", " +OOOOOOOOOOOOOOOOOOOOO++XXXXXXX ", " . +OOOOOOOOOOOOOOOOOOOOOOO+XXXXXX ", " +OOOOOOOOOOOOOOOOOOOOOOOO++XXX ", " +OOOOOOOOOOOOOOOOOOOOOOOOOO+X ", " +OOOOOOOOOOOOOOOOOOOOOOOOOOO+ ", " +OOOOOOOOOOOOOOOOOOOOOOOOOOOO+ ", " +OOOOOOOOOOOOOOOOOOOOOOOOOOOOO+ ", " +OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO ", " +OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO ", " +OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO ", " +OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO ", "++++++++OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO ", "OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", "OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", "OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", "OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", "OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", "@@OOOOOOOOOOOOOOOOO@@OO@@@OO@@OOOOOOOOO@@OO@@@@@@@", "@@OOOOOOOOOOOOOOOOO@@OO@@@OO@@OOOOOOOOO@@OO@@@@@@O", "O@@OOOOOOOOOOOOOOO@@OO@@O@@OO@@OOOOOOO@@OO@@OOOOOO", "O@@OOOOOOOOOOOOOOO@@OO@@O@@OO@@OOOOOOO@@OO@@OOOOOO", "OO@@OOOOO@@@OOOOO@@OO@@OOO@@OO@@OOOOO@@OO@@OOOOOOO", "OO@@OOOOO@@@OOOOO@@OO@@OOO@@OO@@OOOOO@@OO@@@@@OOOO", "OOO@@OOO@@O@@OOO@@OO@@OOOOO@@OO@@OOO@@OO@@@@@OOOOO", "OOO@@OOO@@O@@OOO@@OO@@@@@@@@@OO@@OOO@@OO@@OOOOOOOO", "OOOO@@O@@OOO@@O@@OO@@@@@@@@@@@OO@@O@@OO@@OOOOOOOOO", "OOOO@@O@@OOO@@O@@OO@@OOOOOOO@@OO@@O@@OO@@OOOOOOOOO", "OOOOO@@@OOOOO@@@OO@@OOOOOOOOO@@OO@@@OO@@@@@@@@OOOO", "OOOOO@@@OOOOO@@@OO@@OOOOOOOOO@@OO@@@OO@@@@@@@OOOOO"}; pixmap-2.6pl4.orig/window.xpm100644 243 144 3526 5067140162 15034 0ustar joostusers/* XPM */ static char * window [] = { "40 40 4 1", " s None c None", ". c azure", "X c #79792E2E0000", "o c black", "........................................", "........................................", "........................................", "........................................", "....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....", "....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....", "....XXXXXX XXXXXX....", "....XX XXXX XXXX XX....", "....XX XXXX XXXX XX....", "....XX X XXXX XXXX X XX....", "....XX X XXX XXX X XX....", "....XX X XX XX X XX....", "....XX X XX XX X XX....", "....XX X XX XX X XX....", "....XX X XX XX X XX....", "....XX X XX XX X XX....", "....XX X XX XX X XX....", "....XX X XX XX X XX....", "....XXXX X XX XX X XXXX....", "....XX XXX XX XX XXX XX....", "....XX XX oo XX XX XX....", "....XX X XX oo XX XX X XX....", "....XX X Xoo oXX X XX....", "....XX X oo oX X XX....", "....XX X oo XX X XX....", "....XX X XX XX X XX....", "....XX X XX XX X XX....", "....XX X XX XX X XX....", "....XX X XX XX X XX....", "....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....", "....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....", "......XXXXX....XX......XX....XXXXX......", "........XXXX...XX......XX...XXXX........", "..........XXXX.XX......XX.XXXX..........", "............XXXXX......XXXXX............", "..............XXX......XXX..............", "........................................", "........................................", "........................................", "........................................"}; pixmap-2.6pl4.orig/plaid.xpm100644 243 144 1463 5246140142 14611 0ustar joostusers/* XPM */ static char * plaid_xpm[] = { /* plaid pixmap * width height ncolors chars_per_pixel */ "22 22 3 1", /* colors */ " s dark_color m black c black", ". s light_color m white c red", "X s lines_in_dark m white c yellow", /* pixels */ " . . . . X ", ". . . . . . ", " . . . . X ", ". . . . . . ", " . . . . X ", "XXXXX XXXXXX X X X X X", " . . . . X ", ". . . . . . ", " . . . . X ", ". . . . . . ", " . . . . X ", "..... ..... . . X . . ", "..... ...... . .X. . .", "..... ..... . . X . . ", "..... ...... . .X. . .", "..... ..... . . X . . ", " ", "..... ..... . . X . . ", "..... ...... . .X. . .", "..... ..... . . X . . ", "..... ...... . .X. . .", "..... ..... . . X . . "}; pixmap-2.6pl4.orig/plaid_m.xpm100644 243 144 2513 5065160645 15133 0ustar joostusers/* XPM */ static char * plaid_mask [] = { /* plaid pixmap * width height ncolors chars_per_pixel */ "22 22 5 2", /* colors */ " s mask c None", ". s dark_color m black", "X s lines_in_dark m white c yellow", "o s light_color m white c red", "O s lines_in_mix m black c green", /* pixels */ " . . . . . X . . . . . ", " o . . . . . . . . . . . ", " o . . . . . . X . . . . . ", " o . o . . . . . . . . . . . ", " o . o . . . . . . X . . . . . ", " O O O O O X . X . X . X . X . X ", " . . o . o . . . . . . X . . . . . ", " o . o . o . o . . . . . . . . . . . ", " o . . . o . o . . . . . . X . . . . . ", " o . o . o . o . o . . . . . . . . . . . ", " o . o . . . o . o . . . . . . X . . . . . ", "o o o o o . o o o o o . o . o . O . o . o . ", "o o o o o . o o o o o o . o . o O o . o . o ", "o o o o o . o o o o o . o . o . O . o . o . ", "o o o o o . o o o o o o . o . o O o . o . o ", "o o o o o . o o o o o . o . o . O . o . o . ", ". . . . . . . . . . . . . . . . . . . . . . ", "o o o o o . o o o o o . o . o . O . o . o . ", "o o o o o . o o o o o o . o . o O o . o . o ", "o o o o o . o o o o o . o . o . O . o . o . ", "o o o o o . o o o o o o . o . o O o . o . o ", "o o o o o . o o o o o . o . o . O . o . o . "}; pixmap-2.6pl4.orig/X11/ 40755 243 144 0 6263264111 13245 5ustar joostuserspixmap-2.6pl4.orig/X11/Xfuncs.h100640 243 144 3201 5076566353 14767 0ustar joostusers/* * $XConsortium: Xfuncs.h,v 1.8 91/04/17 09:27:52 rws Exp $ * * Copyright 1990 by the Massachusetts Institute of Technology * * 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 M.I.T. not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. M.I.T. makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * */ #ifndef _XFUNCS_H_ #define _XFUNCS_H_ #include #ifdef X_USEBFUNCS void bcopy(); void bzero(); int bcmp(); #else #if (__STDC__ && !defined(X_NOT_STDC_ENV) && !defined(sun) && !defined(macII)) || defined(SVR4) || defined(hpux) || defined(_IBMR2) #include #define bcopy(b1,b2,len) memmove(b2, b1, (size_t)(len)) #define bzero(b,len) memset(b, 0, (size_t)(len)) #define bcmp(b1,b2,len) memcmp(b1, b2, (size_t)(len)) #else #ifdef sgi #include #else #ifdef SYSV #include #if defined(_XBCOPYFUNC) && !defined(macII) #define bcopy _XBCOPYFUNC #define _XNEEDBCOPYFUNC #endif void bcopy(); #define bzero(b,len) memset(b, 0, len) #define bcmp(b1,b2,len) memcmp(b1, b2, len) #else /* bsd */ void bcopy(); void bzero(); int bcmp(); #endif /* SYSV */ #endif /* sgi */ #endif /* __STDC__ and relatives */ #endif /* X_USEBFUNCS */ #endif /* _XFUNCS_H_ */ pixmap-2.6pl4.orig/X11/Xfuncproto.h100640 243 144 4327 5076566353 15702 0ustar joostusers/* $XConsortium: Xfuncproto.h,v 1.7 91/05/13 20:49:21 rws Exp $ */ /* * Copyright 1989, 1991 by the Massachusetts Institute of Technology * * 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 M.I.T. not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. M.I.T. makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * */ /* Definitions to make function prototypes manageable */ #ifndef _XFUNCPROTO_H_ #define _XFUNCPROTO_H_ #ifndef NeedFunctionPrototypes #if defined(FUNCPROTO) || __STDC__ || defined(__cplusplus) || defined(c_plusplus) #define NeedFunctionPrototypes 1 #else #define NeedFunctionPrototypes 0 #endif #endif /* NeedFunctionPrototypes */ #ifndef NeedVarargsPrototypes #if __STDC__ || defined(__cplusplus) || defined(c_plusplus) || (FUNCPROTO&2) #define NeedVarargsPrototypes 1 #else #define NeedVarargsPrototypes 0 #endif #endif /* NeedVarargsPrototypes */ #if NeedFunctionPrototypes #ifndef NeedNestedPrototypes #if __STDC__ || defined(__cplusplus) || defined(c_plusplus) || (FUNCPROTO&8) #define NeedNestedPrototypes 1 #else #define NeedNestedPrototypes 0 #endif #endif /* NeedNestedPrototypes */ #ifndef _Xconst #if __STDC__ || defined(__cplusplus) || defined(c_plusplus) || (FUNCPROTO&4) #define _Xconst const #else #define _Xconst #endif #endif /* _Xconst */ #ifndef NeedWidePrototypes #ifdef NARROWPROTO #define NeedWidePrototypes 0 #else #define NeedWidePrototypes 1 /* default to make interropt. easier */ #endif #endif /* NeedWidePrototypes */ #endif /* NeedFunctionPrototypes */ #ifndef _XFUNCPROTOBEGIN #ifdef __cplusplus /* for C++ V2.0 */ #define _XFUNCPROTOBEGIN extern "C" { /* do not leave open across includes */ #define _XFUNCPROTOEND } #else #define _XFUNCPROTOBEGIN #define _XFUNCPROTOEND #endif #endif /* _XFUNCPROTOBEGIN */ #endif /* _XFUNCPROTO_H_ */ pixmap-2.6pl4.orig/X11/Xosdefs.h100640 243 144 4532 5076566353 15144 0ustar joostusers/* * O/S-dependent (mis)feature macro definitions * * $XConsortium: Xosdefs.h,v 1.7 91/07/19 23:22:19 rws Exp $ * * Copyright 1991 Massachusetts Institute of Technology * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, 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 M.I.T. not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. M.I.T. makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef _XOSDEFS_H_ #define _XOSDEFS_H_ /* * X_NOT_STDC_ENV means does not have ANSI C header files. Lack of this * symbol does NOT mean that the system has stdarg.h. * * X_NOT_POSIX means does not have POSIX header files. Lack of this * symbol does NOT mean that the POSIX environment is the default. * You may still have to define _POSIX_SOURCE to get it. */ #ifdef NOSTDHDRS #define X_NOT_POSIX #define X_NOT_STDC_ENV #endif #ifdef sony #ifndef SYSTYPE_SYSV #define X_NOT_POSIX #endif #endif #ifdef UTEK #define X_NOT_POSIX #define X_NOT_STDC_ENV #endif #ifdef CRAY #define X_NOT_POSIX #endif #ifdef vax #ifndef ultrix /* assume vanilla BSD */ #define X_NOT_POSIX #define X_NOT_STDC_ENV #endif #endif #ifdef luna #define X_NOT_POSIX #define X_NOT_STDC_ENV #endif #ifdef Mips #define X_NOT_POSIX #define X_NOT_STDC_ENV #endif #ifdef USL #ifdef SYSV /* (release 3.2) */ #define X_NOT_POSIX #define X_NOT_STDC_ENV #endif #endif #ifdef SYSV386 #ifdef SYSV #define X_NOT_POSIX #define X_NOT_STDC_ENV #endif #endif #ifdef MOTOROLA #ifdef SYSV #define X_NOT_STDC_ENV #endif #endif #endif /* _XOSDEFS_H_ */ pixmap-2.6pl4.orig/SelFile/ 40755 243 144 0 6263264111 14217 5ustar joostuserspixmap-2.6pl4.orig/SelFile/README100644 243 144 5272 5507550636 15214 0ustar joostusers XsraSelFile File Selection Dialog Package This directory contains the XsraSelFile file selection dialog package. This package allows an application to obtain a filename from a user. The filename is selected by typing in a text widget or by browsing with the mouse in directory listings. The following is a brief description of the available features. * filename completion When the user types a filename in the Text widget, SelFile shows the possible completions in the directory listings. The user can hit the space bar to complete the filename. * fast directory reading When a directory is opened, the entries are read and sorted. Then the stats of only the first screenful of entries are taken, and these entries are displayed. The stats of the other entries are taken upon demand (i.e. when the user wishes to see them by scrolling, etc.) or in the background. The Xt work procedure facility is used to do background work. The idea here is to give the user some feedback as soon as possible. "It's just an illu--sion" :-) * Xaw and/or Xw widgets SelFile can be linked with Xaw (Athena) and/or Xw (Hewlett-Packard) widgets. Normally, SelFile is linked with the R3 or a later version of the Xt Intrinsics, but it can be linked with the R2 Xt. See the Imakefile for details. * automatic display update after directory modification Every now and then SelFile looks at the directories being displayed to see if they have been updated, and updates the display accordingly. Similarly, file modes are checked (but not as often). * tilde (~) for home directories When the user types a tilde at the beginning of the Text widget, SelFile shows the home directories. ------------------------------------------------------------------------------- This work is loosely based on (and the name comes from) an earlier X10 SelFile by Michiharu `NinjaTerm' Ariza. Admittedly, this X11 SelFile also looks a bit like the directory browser on the NeXT machine. ------------------------------------------------------------------------------- If you have any porting problems bug reports comments (particularly about ideas in the TODO file) or any other type of feedback please send mail to erik@sra.co.jp OR erik%sra.co.jp@uunet.uu.net OR erik%sra.co.jp@mcvax.uucp OR try junet instead of co.jp OR Erik M. van der Poel Software Research Associates, Inc. 1-1-1 Hirakawa-cho, Chiyoda-ku Tokyo 102 Japan. TEL +81-3-234-2692 pixmap-2.6pl4.orig/SelFile/Imakefile100644 243 144 703 5507550647 16121 0ustar joostusers#ifndef XCOMM #define XCOMM # #endif XCOMM Imakefile for SelFile (pfp) INCLUDES = -I. INSTALLFLAGS = $(INSTINCFLAGS) LINTLIBS = $(LINTXTOLL) $(LINTXLIB) HEADERS = xpm.h SRCS = SelFile.c Path.c Dir.c Draw.c OBJS = SelFile.o Path.o Dir.o Draw.o SELFILE_DEFINE = -DSELFILE -DHOME_ON_DEMAND NormalLibraryObjectRule() NormalLibraryTarget(Xgnu,$(OBJS)) InstallLibrary(Xgnu,$(USRLIBDIR)) DependTarget() depend:: SFinternal.h pixmap-2.6pl4.orig/SelFile/Makefile100644 243 144 27025 5562463255 16015 0ustar joostusers# Makefile generated by imake - do not edit! # $XConsortium: imake.c,v 1.87 94/04/17 20:10:28 rws Exp $ # ----------------------------------------------------------------------- # Makefile generated from "Imake.tmpl" and # $XConsortium: Imake.tmpl,v 1.218 94/03/31 20:11:26 matt Exp $ # .SUFFIXES: .i # $XConsortium: Imake.cf,v 1.12 94/03/29 15:42:08 gildea Exp $ # ----------------------------------------------------------------------- # site-specific configuration parameters that need to come before # the platform-specific parameters - edit site.def to change # site: $XConsortium: site.sample,v 1.9 94/04/08 17:02:06 rws Exp $ # ----------------------------------------------------------------------- # platform-specific configuration parameters - edit sun.cf to change # platform: $XConsortium: sun.cf,v 1.129 94/04/09 16:06:28 rws Exp $ # operating system: SunOS 4.1.3 # $XConsortium: sunLib.rules,v 1.14 94/03/28 15:24:43 gildea Exp $ # ----------------------------------------------------------------------- # site-specific configuration parameters that go after # the platform-specific parameters - edit site.def to change # site: $XConsortium: site.sample,v 1.9 94/04/08 17:02:06 rws Exp $ # ----------------------------------------------------------------------- # Imake rules for building libraries, programs, scripts, and data files # rules: $XConsortium: Imake.rules,v 1.193 94/04/10 17:39:55 rws Exp $ PATHSEP = / SHELL = /bin/sh TOP = .. CURRENT_DIR = SelFile IMAKE = imake DEPEND = makedepend MKDIRHIER = mkdirhier CONFIGSRC = $(TOP)/config IMAKESRC = $(CONFIGSRC)/imake DEPENDSRC = $(CONFIGSRC)/makedepend IXXSRC = $(UNSUPPORTEDSRC)/programs/ixx IXX = ixx IXXFLAGS = -s BaseObject -m TypeObj -r RequestObj -p Xf IXXINCLUDES = -i '' INCROOT = /usr/X11R6/include USRLIBDIR = /usr/X11R6/lib SHLIBDIR = /usr/X11R6/lib LINTLIBDIR = $(USRLIBDIR)/lint MANPATH = /usr/X11R6/man MANSOURCEPATH = $(MANPATH)/man MANDIR = $(MANSOURCEPATH)$(MANSUFFIX) LIBMANDIR = $(MANSOURCEPATH)$(LIBMANSUFFIX) FILEMANDIR = $(MANSOURCEPATH)$(FILEMANSUFFIX) AR = ar clq BOOTSTRAPCFLAGS = CC = cc AS = as COMPRESS = compress CPP = /lib/cpp $(STD_CPP_DEFINES) PREPROCESSCMD = cc -E $(STD_CPP_DEFINES) INSTALL = install INSTALLFLAGS = -c LD = ld LEX = lex LEXLIB = -ll YACC = yacc CCYACC = yacc LINT = lint LINTLIBFLAG = -C LINTOPTS = -axz LN = ln -s MAKE = make MV = mv CP = cp RANLIB = ranlib RANLIBINSTFLAGS = RM = rm -f MANSUFFIX = n LIBMANSUFFIX = 3 FILEMANSUFFIX = 4 TROFF = psroff MSMACROS = -ms TBL = tbl EQN = eqn STD_INCLUDES = STD_CPP_DEFINES = STD_DEFINES = EXTRA_LOAD_FLAGS = EXTRA_LDOPTIONS = EXTRA_LIBRARIES = TAGS = ctags SHAREDCODEDEF = -DSHAREDCODE SHLIBDEF = -DSUNSHLIB SHLIBLDFLAGS = -assert pure-text PICFLAGS = -pic CXXPICFLAGS = -pic PROTO_DEFINES = INSTPGMFLAGS = INSTBINFLAGS = -m 0755 INSTUIDFLAGS = -m 4755 INSTLIBFLAGS = -m 0644 INSTINCFLAGS = -m 0444 INSTMANFLAGS = -m 0444 INSTDATFLAGS = -m 0444 INSTKMEMFLAGS = -g kmem -m 2755 PROJECTROOT = /usr/X11R6 TOP_INCLUDES = -I$(INCROOT) CDEBUGFLAGS = -O CCOPTIONS = ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(STD_INCLUDES) ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(THREADS_DEFINES) $(DEFINES) CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(THREADS_CFLAGS) $(ALLDEFINES) LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES) $(DEPEND_DEFINES) LDPRELIB = -L$(USRLIBDIR) LDPOSTLIB = LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) $(EXTRA_LDOPTIONS) $(THREADS_LDFLAGS) $(LOCAL_LDFLAGS) $(LDPRELIB) CXXLDOPTIONS = $(CDEBUGFLAGS) $(CXXOPTIONS) $(EXTRA_LDOPTIONS) $(THREADS_CXXLDFLAGS) $(LOCAL_LDFLAGS) $(LDPRELIB) LDLIBS = $(LDPOSTLIB) $(THREADS_LIBS) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) CCLINK = $(CC) CXXLINK = $(CXX) LDSTRIPFLAGS = -x LDCOMBINEFLAGS = -X -r DEPENDFLAGS = MACROFILE = sun.cf RM_CMD = $(RM) IMAKE_DEFINES = IRULESRC = $(CONFIGDIR) IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES) ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Project.tmpl \ $(IRULESRC)/site.def $(IRULESRC)/$(MACROFILE) \ $(EXTRA_ICONFIGFILES) # ----------------------------------------------------------------------- # X Window System Build Parameters and Rules # $XConsortium: Project.tmpl,v 1.242 94/04/13 14:58:40 rws Exp $ # ----------------------------------------------------------------------- # X Window System make variables; these need to be coordinated with rules BINDIR = /usr/X11R6/bin BUILDINCROOT = $(TOP) BUILDINCDIR = $(BUILDINCROOT)/X11 BUILDINCTOP = .. BUILDLIBDIR = $(TOP)/usrlib BUILDLIBTOP = .. INCDIR = $(INCROOT)/X11 ADMDIR = /usr/adm LIBDIR = $(USRLIBDIR)/X11 FONTDIR = $(LIBDIR)/fonts XINITDIR = $(LIBDIR)/xinit XDMDIR = $(LIBDIR)/xdm TWMDIR = $(LIBDIR)/twm NLSDIR = $(LIBDIR)/nls XLOCALEDIR = $(LIBDIR)/locale PEXAPIDIR = $(LIBDIR)/PEX XAPPLOADDIR = $(LIBDIR)/app-defaults FONTCFLAGS = -t INSTAPPFLAGS = $(INSTDATFLAGS) RGB = rgb FONTC = bdftopcf MKFONTDIR = mkfontdir DOCUTILSRC = $(TOP)/doc/util XDOCMACROS = $(DOCUTILSRC)/macros.t XIDXMACROS = $(DOCUTILSRC)/indexmacros.t PROGRAMSRC = $(TOP)/programs LIBSRC = $(TOP)/lib FONTSRC = $(TOP)/fonts INCLUDESRC = $(TOP)/X11 SERVERSRC = $(TOP)/programs/Xserver CONTRIBSRC = $(TOP)/../contrib UNSUPPORTEDSRC = $(TOP)/unsupported DOCSRC = $(TOP)/doc RGBSRC = $(TOP)/programs/rgb BDFTOPCFSRC = $(PROGRAMSRC)/bdftopcf MKFONTDIRSRC = $(PROGRAMSRC)/mkfontdir FONTSERVERSRC = $(PROGRAMSRC)/xfs FONTINCSRC = $(TOP)/include/fonts EXTINCSRC = $(TOP)/include/extensions TRANSCOMMSRC = $(LIBSRC)/xtrans TRANS_INCLUDES = -I$(TRANSCOMMSRC) # $XConsortium: sunLib.tmpl,v 1.36 94/04/08 19:13:50 rws Exp $ XLIBSRC = $(LIBSRC)/X11 SOXLIBREV = 4.20 DEPXONLYLIB = XONLYLIB = -lX11 LINTXONLY = $(LINTLIBDIR)/llib-lX11.ln XLIBONLY = $(XONLYLIB) XEXTLIBSRC = $(LIBSRC)/Xext SOXEXTREV = 4.20 DEPEXTENSIONLIB = EXTENSIONLIB = -lXext LINTEXTENSION = $(LINTLIBDIR)/llib-lXext.ln LINTEXTENSIONLIB = $(LINTEXTENSION) DEPXLIB = $(DEPEXTENSIONLIB) $(DEPXONLYLIB) XLIB = $(EXTENSIONLIB) $(XONLYLIB) LINTXLIB = $(LINTXONLYLIB) XAUTHSRC = $(LIBSRC)/Xau DEPXAUTHLIB = $(USRLIBDIR)/libXau.a XAUTHLIB = -lXau LINTXAUTH = $(LINTLIBDIR)/llib-lXau.ln XDMCPLIBSRC = $(LIBSRC)/Xdmcp DEPXDMCPLIB = $(USRLIBDIR)/libXdmcp.a XDMCPLIB = -lXdmcp LINTXDMCP = $(LINTLIBDIR)/llib-lXdmcp.ln XMUSRC = $(LIBSRC)/Xmu SOXMUREV = 4.20 DEPXMULIB = $(USRLIBDIR)/libXmu.sa.$(SOXMUREV) XMULIB = -lXmu LINTXMU = $(LINTLIBDIR)/llib-lXmu.ln OLDXLIBSRC = $(LIBSRC)/oldX SOOLDXREV = 4.20 DEPOLDXLIB = OLDXLIB = -loldX LINTOLDX = $(LINTLIBDIR)/llib-loldX.ln TOOLKITSRC = $(LIBSRC)/Xt SOXTREV = 4.20 DEPXTOOLONLYLIB = $(USRLIBDIR)/libXt.sa.$(SOXTREV) XTOOLONLYLIB = -lXt LINTXTOOLONLY = $(LINTLIBDIR)/llib-lXt.ln DEPXTOOLLIB = $(DEPXTOOLONLYLIB) $(DEPSMLIB) $(DEPICELIB) XTOOLLIB = $(XTOOLONLYLIB) $(SMLIB) $(ICELIB) LINTXTOOLLIB = $(LINTXTOOLONLYLIB) AWIDGETSRC = $(LIBSRC)/Xaw SOXAWREV = 6.0 DEPXAWLIB = $(USRLIBDIR)/libXaw.sa.$(SOXAWREV) XAWLIB = -lXaw LINTXAW = $(LINTLIBDIR)/llib-lXaw.ln XTFSRC = $(TOP)/workInProgress/Xtf SOXTFREV = 0.7 DEPXTFLIB = XTFLIB = -lXtf LINTXTF = $(LINTLIBDIR)/llib-lXtf.ln FRESCOSRC = $(TOP)/workInProgress/Fresco SOFRESCOREV = 0.7 DEPFRESCOLIB = FRESCOLIB = -lFresco LINTFRESCO = $(LINTLIBDIR)/llib-lFresco.ln XILIBSRC = $(LIBSRC)/Xi SOXINPUTREV = 4.20 DEPXILIB = XILIB = -lXi LINTXI = $(LINTLIBDIR)/llib-lXi.ln XTESTLIBSRC = $(LIBSRC)/Xtst SOXTESTREV = 1.10 DEPXTESTLIB = XTESTLIB = -lXtst LINTXTEST = $(LINTLIBDIR)/llib-lXtst.ln PEXLIBSRC = $(LIBSRC)/PEX5 SOPEXREV = 1.10 DEPPEXLIB = PEXLIB = -lPEX5 LINTPEX = $(LINTLIBDIR)/llib-lPEX5.ln XIELIBSRC = $(LIBSRC)/XIE SOXIEREV = 6.0 DEPXIELIB = XIELIB = -lXIE LINTXIE = $(LINTLIBDIR)/llib-lXIE.ln PHIGSLIBSRC = $(LIBSRC)/PHIGS DEPPHIGSLIB = $(USRLIBDIR)/libphigs.a PHIGSLIB = -lphigs LINTPHIGS = $(LINTLIBDIR)/llib-lphigs.ln DEPXBSDLIB = $(USRLIBDIR)/libXbsd.a XBSDLIB = -lXbsd LINTXBSD = $(LINTLIBDIR)/llib-lXbsd.ln ICESRC = $(LIBSRC)/ICE SOICEREV = 6.0 DEPICELIB = ICELIB = -lICE LINTICE = $(LINTLIBDIR)/llib-lICE.ln SMSRC = $(LIBSRC)/SM SOSMREV = 6.0 DEPSMLIB = SMLIB = -lSM LINTSM = $(LINTLIBDIR)/llib-lSM.ln FSLIBSRC = $(LIBSRC)/FS DEPFSLIB = $(USRLIBDIR)/libFS.a FSLIB = -lFS LINTFS = $(LINTLIBDIR)/llib-lFS.ln FONTLIBSRC = $(LIBSRC)/font DEPFONTLIB = $(USRLIBDIR)/libfont.a FONTLIB = -lfont LINTFONT = $(LINTLIBDIR)/llib-lfont.ln DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB) DEPLIBS1 = $(DEPLIBS) DEPLIBS2 = $(DEPLIBS) DEPLIBS3 = $(DEPLIBS) CONFIGDIR = $(LIBDIR)/config # ----------------------------------------------------------------------- # start of Imakefile # Imakefile for SelFile (pfp) INCLUDES = -I. INSTALLFLAGS = $(INSTINCFLAGS) LINTLIBS = $(LINTXTOLL) $(LINTXLIB) HEADERS = xpm.h SRCS = SelFile.c Path.c Dir.c Draw.c OBJS = SelFile.o Path.o Dir.o Draw.o SELFILE_DEFINE = -DSELFILE -DHOME_ON_DEMAND .c.o: $(RM) $@ $(CC) -c $(CFLAGS) $(_NOOP_) $*.c all:: libXgnu.a libXgnu.a: $(OBJS) $(RM) $@ $(AR) $@ $(OBJS) $(RANLIB) $@ $(_NULLCMD_) install:: libXgnu.a @if [ -d $(DESTDIR)$(USRLIBDIR) ]; then set +x; \ else (set -x; $(MKDIRHIER) $(DESTDIR)$(USRLIBDIR)); fi $(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) libXgnu.a $(DESTDIR)$(USRLIBDIR) $(RANLIB) $(RANLIBINSTFLAGS) $(DESTDIR)$(USRLIBDIR)/libXgnu.a depend:: $(DEPEND) $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- $(SRCS) depend:: SFinternal.h # ----------------------------------------------------------------------- # common rules for all Makefiles - do not edit .c.i: $(RM) $@ $(CC) -E $(CFLAGS) $(_NOOP_) $*.c > $@ emptyrule:: clean:: $(RM_CMD) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut "#"* Makefile:: -@if [ -f Makefile ]; then set -x; \ $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \ else exit 0; fi $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) tags:: $(TAGS) -w *.[ch] $(TAGS) -xw *.[ch] > TAGS # ----------------------------------------------------------------------- # empty rules for directories that do not have SUBDIRS - do not edit install:: @echo "install in $(CURRENT_DIR) done" install.man:: @echo "install.man in $(CURRENT_DIR) done" Makefiles:: includes:: depend:: # ----------------------------------------------------------------------- # dependencies generated by makedepend pixmap-2.6pl4.orig/SelFile/Dir.c100444 243 144 7551 5507550643 15214 0ustar joostusers/* * Copyright 1989 Software Research Associates, Inc., Tokyo, Japan * * 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 Software Research Associates not be used * in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. Software Research Associates * makes no representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * SOFTWARE RESEARCH ASSOCIATES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, * IN NO EVENT SHALL SOFTWARE RESEARCH ASSOCIATES 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. * * Author: Erik M. van der Poel * Software Research Associates, Inc., Tokyo, Japan * erik@sra.co.jp */ #include #ifdef SEL_FILE_IGNORE_CASE #include #endif /* def SEL_FILE_IGNORE_CASE */ #include "SFinternal.h" #if defined(SVR4) || defined(SYSV) || defined(USG) #include #else /* defined(SVR4) || defined(SYSV) || defined(USG) */ #include #define dirent direct #endif /* defined(SVR4) || defined(SYSV) || defined(USG) */ #include #if defined(SVR4) || defined(SYSV) || defined(USG) extern void qsort(); #endif /* defined(SVR4) || defined(SYSV) || defined(USG) */ #ifdef SEL_FILE_IGNORE_CASE int SFcompareEntries(p, q) SFEntry *p; SFEntry *q; { register char *r, *s; register char c1, c2; r = p->real; s = q->real; c1 = *r++; if (islower(c1)) { c1 = toupper(c1); } c2 = *s++; if (islower(c2)) { c2 = toupper(c2); } while (c1 == c2) { if (!c1) { return strcmp(p->real, q->real); } c1 = *r++; if (islower(c1)) { c1 = toupper(c1); } c2 = *s++; if (islower(c2)) { c2 = toupper(c2); } } return c1 - c2; } #else /* def SEL_FILE_IGNORE_CASE */ int SFcompareEntries(p, q) SFEntry *p; SFEntry *q; { return strcmp(p->real, q->real); } #endif /* def SEL_FILE_IGNORE_CASE */ int SFgetDir(dir) SFDir *dir; { SFEntry *result = NULL; int alloc = 0; int i; DIR *dirp; struct dirent *dp; char *str; int len; int maxChars; struct stat statBuf; maxChars = strlen(dir->dir) - 1; dir->entries = NULL; dir->nEntries = 0; dir->nChars = 0; result = NULL; i = 0; dirp = opendir("."); if (!dirp) { return 1; } (void) stat(".", &statBuf); dir->mtime = statBuf.st_mtime; (void) readdir(dirp); /* throw away "." */ #ifndef S_IFLNK (void) readdir(dirp); /* throw away ".." */ #endif /* ndef S_IFLNK */ while (dp = readdir(dirp)) { if (i >= alloc) { alloc = 2 * (alloc + 1); result = (SFEntry *) XtRealloc((char *) result, (unsigned) (alloc * sizeof(SFEntry))); } result[i].statDone = 0; str = dp->d_name; len = strlen(str); result[i].real = XtMalloc((unsigned) (len + 2)); (void) strcat(strcpy(result[i].real, str), " "); if (len > maxChars) { maxChars = len; } result[i].shown = result[i].real; i++; } #if defined(SVR4) || defined(SYSV) || defined(USG) qsort((char *) result, (unsigned) i, sizeof(SFEntry), SFcompareEntries); #else /* defined(SVR4) || defined(SYSV) || defined(USG) */ qsort((char *) result, i, sizeof(SFEntry), SFcompareEntries); #endif /* defined(SVR4) || defined(SYSV) || defined(USG) */ dir->entries = result; dir->nEntries = i; dir->nChars = maxChars + 1; closedir(dirp); return 0; } pixmap-2.6pl4.orig/SelFile/Draw.c100444 243 144 40640 5507550644 15410 0ustar joostusers/* * Copyright 1989 Software Research Associates, Inc., Tokyo, Japan * * 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 Software Research Associates not be used * in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. Software Research Associates * makes no representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * SOFTWARE RESEARCH ASSOCIATES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, * IN NO EVENT SHALL SOFTWARE RESEARCH ASSOCIATES 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. * * Author: Erik M. van der Poel * Software Research Associates, Inc., Tokyo, Japan * erik@sra.co.jp */ #include #include "SFinternal.h" #include "xstat.h" #include #include #define SF_DEFAULT_FONT "9x15" #define ABS(x) (((x) < 0) ? (-(x)) : (x)) typedef struct { char *fontname; } TextData, *textPtr; int SFcharWidth, SFcharAscent, SFcharHeight; int SFcurrentInvert[3] = { -1, -1, -1 }; static GC SFlineGC, SFscrollGC, SFinvertGC, SFtextGC; static XtResource textResources[] = { {XtNfont, XtCFont, XtRString, sizeof (char *), XtOffset(textPtr, fontname), XtRString, SF_DEFAULT_FONT}, }; static XFontStruct *SFfont; static int SFcurrentListY; static XtIntervalId SFscrollTimerId; SFinitFont() { TextData *data; data = XtNew(TextData); XtGetApplicationResources(selFileForm, (XtPointer) data, textResources, XtNumber(textResources), (Arg *) NULL, 0); SFfont = XLoadQueryFont(SFdisplay, data->fontname); if (!SFfont) { SFfont = XLoadQueryFont(SFdisplay, SF_DEFAULT_FONT); if (!SFfont) { char sbuf[256]; (void) sprintf(sbuf, "XsraSelFile: can't get font %s", SF_DEFAULT_FONT); XtAppError(SFapp, sbuf); } } SFcharWidth = (SFfont->max_bounds.width + SFfont->min_bounds.width) / 2; SFcharAscent = SFfont->max_bounds.ascent; SFcharHeight = SFcharAscent + SFfont->max_bounds.descent; } SFcreateGC() { XGCValues gcValues; XRectangle rectangles[1]; gcValues.foreground = SFfore; SFlineGC = XtGetGC( selFileLists[0], (XtGCMask) GCForeground | 0, &gcValues ); SFscrollGC = XtGetGC( selFileLists[0], (XtGCMask) 0, &gcValues ); gcValues.function = GXinvert; gcValues.plane_mask = (SFfore ^ SFback); SFinvertGC = XtGetGC( selFileLists[0], (XtGCMask) GCFunction | GCPlaneMask | 0, &gcValues ); gcValues.foreground = SFfore; gcValues.background = SFback; gcValues.font = SFfont->fid; SFtextGC = XCreateGC( SFdisplay, XtWindow(selFileLists[0]), (unsigned long) GCForeground | GCBackground | GCFont | 0, &gcValues ); rectangles[0].x = SFlineToTextH + SFbesideText; rectangles[0].y = 0; rectangles[0].width = SFcharsPerEntry * SFcharWidth; rectangles[0].height = SFupperY + 1; XSetClipRectangles( SFdisplay, SFtextGC, 0, 0, rectangles, 1, Unsorted ); } SFclearList(n, doScroll) int n; int doScroll; { SFDir *dir; SFcurrentInvert[n] = -1; XClearWindow(SFdisplay, XtWindow(selFileLists[n])); XDrawSegments(SFdisplay, XtWindow(selFileLists[n]), SFlineGC, SFsegs, 2); if (doScroll) { dir = &(SFdirs[SFdirPtr + n]); if ((SFdirPtr + n < SFdirEnd) && dir->nEntries && dir->nChars) { XawScrollbarSetThumb( selFileVScrolls[n], (float) (((double) dir->vOrigin) / dir->nEntries), (float) (((double) ((dir->nEntries < SFlistSize) ? dir->nEntries : SFlistSize)) / dir->nEntries) ); XawScrollbarSetThumb( selFileHScrolls[n], (float) (((double) dir->hOrigin) / dir->nChars), (float) (((double) ((dir->nChars < SFcharsPerEntry) ? dir->nChars : SFcharsPerEntry)) / dir->nChars) ); } else { XawScrollbarSetThumb(selFileVScrolls[n], (float) 0.0, (float) 1.0); XawScrollbarSetThumb(selFileHScrolls[n], (float) 0.0, (float) 1.0); } } } static SFdeleteEntry(dir, entry) SFDir *dir; SFEntry *entry; { register SFEntry *e; register SFEntry *end; int n; int idx; idx = entry - dir->entries; if (idx < dir->beginSelection) { dir->beginSelection--; } if (idx <= dir->endSelection) { dir->endSelection--; } if (dir->beginSelection > dir->endSelection) { dir->beginSelection = dir->endSelection = -1; } if (idx < dir->vOrigin) { dir->vOrigin--; } XtFree(entry->real); end = &(dir->entries[dir->nEntries - 1]); for (e = entry; e < end; e++) { *e = *(e + 1); } if (!(--dir->nEntries)) { return; } n = dir - &(SFdirs[SFdirPtr]); if ((n < 0) || (n > 2)) { return; } XawScrollbarSetThumb( selFileVScrolls[n], (float) (((double) dir->vOrigin) / dir->nEntries), (float) (((double) ((dir->nEntries < SFlistSize) ? dir->nEntries : SFlistSize)) / dir->nEntries) ); } static SFwriteStatChar(name, last, statBuf) char *name; int last; struct stat *statBuf; { name[last] = SFstatChar(statBuf); } static int SFstatAndCheck(dir, entry) SFDir *dir; SFEntry *entry; { struct stat statBuf; char save; int last; /* * must be restored before returning */ save = *(dir->path); *(dir->path) = 0; if (!SFchdir(SFcurrentPath)) { last = strlen(entry->real) - 1; entry->real[last] = 0; entry->statDone = 1; if ( (!stat(entry->real, &statBuf)) #ifdef S_IFLNK || (!lstat(entry->real, &statBuf)) #endif /* ndef S_IFLNK */ ) { if (SFfunc) { char *shown; shown = NULL; if (SFfunc(entry->real, &shown, &statBuf)) { if (shown) { int len; len = strlen(shown); entry->shown = XtMalloc( (unsigned) (len + 2) ); (void) strcpy(entry->shown, shown); SFwriteStatChar( entry->shown, len, &statBuf ); entry->shown[len + 1] = 0; } } else { SFdeleteEntry(dir, entry); *(dir->path) = save; return 1; } } SFwriteStatChar(entry->real, last, &statBuf); } else { entry->real[last] = ' '; } } *(dir->path) = save; return 0; } static SFdrawStrings(w, dir, from, to) register Window w; register SFDir *dir; register int from; register int to; { register int i; register SFEntry *entry; int x; x = SFtextX - dir->hOrigin * SFcharWidth; if (dir->vOrigin + to >= dir->nEntries) { to = dir->nEntries - dir->vOrigin - 1; } for (i = from; i <= to; i++) { entry = &(dir->entries[dir->vOrigin + i]); if (!(entry->statDone)) { if (SFstatAndCheck(dir, entry)) { if (dir->vOrigin + to >= dir->nEntries) { to = dir->nEntries - dir->vOrigin - 1; } i--; continue; } } XDrawImageString( SFdisplay, w, SFtextGC, x, SFtextYoffset + i * SFentryHeight, entry->shown, strlen(entry->shown) ); if (dir->vOrigin + i == dir->beginSelection) { XDrawLine( SFdisplay, w, SFlineGC, SFlineToTextH + 1, SFlowerY + i * SFentryHeight, SFlineToTextH + SFentryWidth - 2, SFlowerY + i * SFentryHeight ); } if ( (dir->vOrigin + i >= dir->beginSelection) && (dir->vOrigin + i <= dir->endSelection) ) { SFcompletionSegs[0].y1 = SFcompletionSegs[1].y1 = SFlowerY + i * SFentryHeight; SFcompletionSegs[0].y2 = SFcompletionSegs[1].y2 = SFlowerY + (i + 1) * SFentryHeight - 1; XDrawSegments( SFdisplay, w, SFlineGC, SFcompletionSegs, 2 ); } if (dir->vOrigin + i == dir->endSelection) { XDrawLine( SFdisplay, w, SFlineGC, SFlineToTextH + 1, SFlowerY + (i + 1) * SFentryHeight - 1, SFlineToTextH + SFentryWidth - 2, SFlowerY + (i + 1) * SFentryHeight - 1 ); } } } SFdrawList(n, doScroll) int n; int doScroll; { SFDir *dir; Window w; SFclearList(n, doScroll); if (SFdirPtr + n < SFdirEnd) { dir = &(SFdirs[SFdirPtr + n]); w = XtWindow(selFileLists[n]); XDrawImageString( SFdisplay, w, SFtextGC, SFtextX - dir->hOrigin * SFcharWidth, SFlineToTextV + SFaboveAndBelowText + SFcharAscent, dir->dir, strlen(dir->dir) ); SFdrawStrings(w, dir, 0, SFlistSize - 1); } } SFdrawLists(doScroll) int doScroll; { int i; for (i = 0; i < 3; i++) { SFdrawList(i, doScroll); } } static SFinvertEntry(n) register int n; { XFillRectangle( SFdisplay, XtWindow(selFileLists[n]), SFinvertGC, SFlineToTextH, SFcurrentInvert[n] * SFentryHeight + SFlowerY, SFentryWidth, SFentryHeight ); } static unsigned long SFscrollTimerInterval() { static int maxVal = 200; static int varyDist = 50; static int minDist = 50; int t; int dist; if (SFcurrentListY < SFlowerY) { dist = SFlowerY - SFcurrentListY; } else if (SFcurrentListY > SFupperY) { dist = SFcurrentListY - SFupperY; } else { return (unsigned long) 1; } t = maxVal - ((maxVal / varyDist) * (dist - minDist)); if (t < 1) { t = 1; } if (t > maxVal) { t = maxVal; } return (unsigned long) t; } static void SFscrollTimer(n) int n; { SFDir *dir; int save; dir = &(SFdirs[SFdirPtr + n]); save = dir->vOrigin; if (SFcurrentListY < SFlowerY) { if (dir->vOrigin > 0) { SFvSliderMovedCallback(selFileVScrolls[n], n, dir->vOrigin - 1); } } else if (SFcurrentListY > SFupperY) { if (dir->vOrigin < dir->nEntries - SFlistSize) { SFvSliderMovedCallback(selFileVScrolls[n], n, dir->vOrigin + 1); } } if (dir->vOrigin != save) { if (dir->nEntries) { XawScrollbarSetThumb( selFileVScrolls[n], (float) (((double) dir->vOrigin) / dir->nEntries), (float) (((double) ((dir->nEntries < SFlistSize) ? dir->nEntries : SFlistSize)) / dir->nEntries) ); } } if (SFbuttonPressed) { SFscrollTimerId = XtAppAddTimeOut(SFapp, SFscrollTimerInterval(), SFscrollTimer, (XtPointer) n); } } static int SFnewInvertEntry(n, event) register int n; register XMotionEvent *event; { register int x, y; register int new; static int SFscrollTimerAdded = 0; x = event->x; y = event->y; if (SFdirPtr + n >= SFdirEnd) { return -1; } else if ( (x >= 0) && (x <= SFupperX) && (y >= SFlowerY) && (y <= SFupperY) ) { register SFDir *dir = &(SFdirs[SFdirPtr + n]); if (SFscrollTimerAdded) { SFscrollTimerAdded = 0; XtRemoveTimeOut(SFscrollTimerId); } new = (y - SFlowerY) / SFentryHeight; if (dir->vOrigin + new >= dir->nEntries) { return -1; } return new; } else { if (SFbuttonPressed) { SFcurrentListY = y; if (!SFscrollTimerAdded) { SFscrollTimerAdded = 1; SFscrollTimerId = XtAppAddTimeOut(SFapp, SFscrollTimerInterval(), SFscrollTimer, (XtPointer) n); } } return -1; } } /* ARGSUSED */ void SFenterList(w, n, event) Widget w; register int n; register XEnterWindowEvent *event; { register int new; /* sanity */ if (SFcurrentInvert[n] != -1) { SFinvertEntry(n); SFcurrentInvert[n] = -1; } new = SFnewInvertEntry(n, (XMotionEvent *) event); if (new != -1) { SFcurrentInvert[n] = new; SFinvertEntry(n); } } /* ARGSUSED */ void SFleaveList(w, n, event) Widget w; register int n; XEvent *event; { if (SFcurrentInvert[n] != -1) { SFinvertEntry(n); SFcurrentInvert[n] = -1; } } /* ARGSUSED */ void SFmotionList(w, n, event) Widget w; register int n; register XMotionEvent *event; { register int new; new = SFnewInvertEntry(n, event); if (new != SFcurrentInvert[n]) { if (SFcurrentInvert[n] != -1) { SFinvertEntry(n); } SFcurrentInvert[n] = new; if (new != -1) { SFinvertEntry(n); } } } /* ARGSUSED */ void SFvFloatSliderMovedCallback(w, n, fnew) Widget w; int n; float *fnew; { int new; new = (*fnew) * SFdirs[SFdirPtr + n].nEntries; SFvSliderMovedCallback(w, n, new); } /* ARGSUSED */ void SFvSliderMovedCallback(w, n, new) Widget w; int n; int new; { int old; register Window win; SFDir *dir; dir = &(SFdirs[SFdirPtr + n]); old = dir->vOrigin; dir->vOrigin = new; if (old == new) { return; } win = XtWindow(selFileLists[n]); if (ABS(new - old) < SFlistSize) { if (new > old) { XCopyArea( SFdisplay, win, win, SFscrollGC, SFlineToTextH, SFlowerY + (new - old) * SFentryHeight, SFentryWidth + SFlineToTextH, (SFlistSize - (new - old)) * SFentryHeight, SFlineToTextH, SFlowerY ); XClearArea( SFdisplay, win, SFlineToTextH, SFlowerY + (SFlistSize - (new - old)) * SFentryHeight, SFentryWidth + SFlineToTextH, (new - old) * SFentryHeight, False ); SFdrawStrings(win, dir, SFlistSize - (new - old), SFlistSize - 1); } else { XCopyArea( SFdisplay, win, win, SFscrollGC, SFlineToTextH, SFlowerY, SFentryWidth + SFlineToTextH, (SFlistSize - (old - new)) * SFentryHeight, SFlineToTextH, SFlowerY + (old - new) * SFentryHeight ); XClearArea( SFdisplay, win, SFlineToTextH, SFlowerY, SFentryWidth + SFlineToTextH, (old - new) * SFentryHeight, False ); SFdrawStrings(win, dir, 0, old - new); } } else { XClearArea( SFdisplay, win, SFlineToTextH, SFlowerY, SFentryWidth + SFlineToTextH, SFlistSize * SFentryHeight, False ); SFdrawStrings(win, dir, 0, SFlistSize - 1); } } /* ARGSUSED */ void SFvAreaSelectedCallback(w, n, pnew) Widget w; int n; int pnew; { SFDir *dir; int new; dir = &(SFdirs[SFdirPtr + n]); new = dir->vOrigin + (((double) pnew) / SFvScrollHeight) * dir->nEntries; if (new > dir->nEntries - SFlistSize) { new = dir->nEntries - SFlistSize; } if (new < 0) { new = 0; } if (dir->nEntries) { float f; f = ((double) new) / dir->nEntries; XawScrollbarSetThumb( w, f, (float) (((double) ((dir->nEntries < SFlistSize) ? dir->nEntries : SFlistSize)) / dir->nEntries) ); } SFvSliderMovedCallback(w, n, new); } /* ARGSUSED */ void SFhSliderMovedCallback(w, n, new) Widget w; int n; float *new; { SFDir *dir; int save; dir = &(SFdirs[SFdirPtr + n]); save = dir->hOrigin; dir->hOrigin = (*new) * dir->nChars; if (dir->hOrigin == save) { return; } SFdrawList(n, SF_DO_NOT_SCROLL); } /* ARGSUSED */ void SFhAreaSelectedCallback(w, n, pnew) Widget w; int n; int pnew; { SFDir *dir; int new; dir = &(SFdirs[SFdirPtr + n]); new = dir->hOrigin + (((double) pnew) / SFhScrollWidth) * dir->nChars; if (new > dir->nChars - SFcharsPerEntry) { new = dir->nChars - SFcharsPerEntry; } if (new < 0) { new = 0; } if (dir->nChars) { float f; f = ((double) new) / dir->nChars; XawScrollbarSetThumb( w, f, (float) (((double) ((dir->nChars < SFcharsPerEntry) ? dir->nChars : SFcharsPerEntry)) / dir->nChars) ); SFhSliderMovedCallback(w, n, &f); } } /* ARGSUSED */ void SFpathSliderMovedCallback(w, client_data, new) Widget w; XtPointer client_data; float *new; { SFDir *dir; int n; XawTextPosition pos; int SFdirPtrSave; SFdirPtrSave = SFdirPtr; SFdirPtr = (*new) * SFdirEnd; if (SFdirPtr == SFdirPtrSave) { return; } SFdrawLists(SF_DO_SCROLL); n = 2; while (SFdirPtr + n >= SFdirEnd) { n--; } dir = &(SFdirs[SFdirPtr + n]); pos = dir->path - SFcurrentPath; if (!strncmp(SFcurrentPath, SFstartDir, strlen(SFstartDir))) { pos -= strlen(SFstartDir); if (pos < 0) { pos = 0; } } XawTextSetInsertionPoint(selFileField, pos); } /* ARGSUSED */ void SFpathAreaSelectedCallback(w, client_data, pnew) Widget w; XtPointer client_data; int pnew; { int new; float f; new = SFdirPtr + (((double) pnew) / SFpathScrollWidth) * SFdirEnd; if (new > SFdirEnd - 3) { new = SFdirEnd - 3; } if (new < 0) { new = 0; } f = ((double) new) / SFdirEnd; XawScrollbarSetThumb( w, f, (float) (((double) ((SFdirEnd < 3) ? SFdirEnd : 3)) / SFdirEnd) ); SFpathSliderMovedCallback(w, (XtPointer) NULL, &f); } Boolean SFworkProc() { register SFDir *dir; register SFEntry *entry; for (dir = &(SFdirs[SFdirEnd - 1]); dir >= SFdirs; dir--) { if (!(dir->nEntries)) { continue; } for ( entry = &(dir->entries[dir->nEntries - 1]); entry >= dir->entries; entry-- ) { if (!(entry->statDone)) { (void) SFstatAndCheck(dir, entry); return False; } } } SFworkProcAdded = 0; return True; } pixmap-2.6pl4.orig/SelFile/Path.c100444 243 144 43501 5507550645 15407 0ustar joostusers/* * Copyright 1989 Software Research Associates, Inc., Tokyo, Japan * * 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 Software Research Associates not be used * in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. Software Research Associates * makes no representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * SOFTWARE RESEARCH ASSOCIATES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, * IN NO EVENT SHALL SOFTWARE RESEARCH ASSOCIATES 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. * * Author: Erik M. van der Poel * Software Research Associates, Inc., Tokyo, Japan * erik@sra.co.jp */ #include #ifdef SEL_FILE_IGNORE_CASE #include #endif /* def SEL_FILE_IGNORE_CASE */ #include #include #include "SFinternal.h" #include "xstat.h" #include #if defined(SVR4) || defined(SYSV) || defined(USG) extern uid_t getuid(); extern void qsort(); #endif /* defined(SVR4) || defined(SYSV) || defined(USG) */ typedef struct { char *name; char *dir; } SFLogin; SFDir *SFdirs = NULL; int SFdirEnd; int SFdirPtr; int SFbuttonPressed = 0; static int SFdoNotTouchDirPtr = 0; static int SFdoNotTouchVorigin = 0; static SFDir SFrootDir, SFhomeDir; static SFLogin *SFlogins; static int SFtwiddle = 0; int SFchdir(path) char *path; { int result; result = 0; if (strcmp(path, SFcurrentDir)) { result = chdir(path); if (!result) { (void) strcpy(SFcurrentDir, path); } } return result; } static SFfree(i) int i; { register SFDir *dir; register int j; dir = &(SFdirs[i]); for (j = dir->nEntries - 1; j >= 0; j--) { if (dir->entries[j].shown != dir->entries[j].real) { XtFree(dir->entries[j].shown); } XtFree(dir->entries[j].real); } XtFree((char *) dir->entries); XtFree(dir->dir); dir->dir = NULL; } static SFunreadableDir(dir) SFDir *dir; { char *cannotOpen = " "; dir->entries = (SFEntry *) XtMalloc(sizeof(SFEntry)); dir->entries[0].statDone = 1; dir->entries[0].real = XtMalloc((unsigned) (strlen(cannotOpen) + 1)); (void) strcpy(dir->entries[0].real, cannotOpen); dir->entries[0].shown = dir->entries[0].real; dir->nEntries = 1; dir->nChars = strlen(cannotOpen); } #ifdef SEL_FILE_IGNORE_CASE static SFstrncmp(p, q, n) register char *p, *q; register int n; { register char c1, c2; char *psave, *qsave; int nsave; psave = p; qsave = q; nsave = n; c1 = *p++; if (islower(c1)) { c1 = toupper(c1); } c2 = *q++; if (islower(c2)) { c2 = toupper(c2); } while ((--n >= 0) && (c1 == c2)) { if (!c1) { return strncmp(psave, qsave, nsave); } c1 = *p++; if (islower(c1)) { c1 = toupper(c1); } c2 = *q++; if (islower(c2)) { c2 = toupper(c2); } } if (n < 0) { return strncmp(psave, qsave, nsave); } return c1 - c2; } #endif /* def SEL_FILE_IGNORE_CASE */ static SFreplaceText(dir, str) SFDir *dir; char *str; { int len; *(dir->path) = 0; len = strlen(str); if (str[len - 1] == '/') { (void) strcat(SFcurrentPath, str); } else { (void) strncat(SFcurrentPath, str, len - 1); } if (strncmp(SFcurrentPath, SFstartDir, strlen(SFstartDir))) { SFsetText(SFcurrentPath); } else { SFsetText(&(SFcurrentPath[strlen(SFstartDir)])); } SFtextChanged(); } static void SFexpand(str) char *str; { int len; int cmp; char *name, *growing; SFDir *dir; SFEntry *entry, *max; len = strlen(str); dir = &(SFdirs[SFdirEnd - 1]); if (dir->beginSelection == -1) { str = strcpy(XtMalloc((unsigned) (strlen(str) + 1)), str); SFreplaceText(dir, str); XtFree(str); return; } else if (dir->beginSelection == dir->endSelection) { SFreplaceText(dir, dir->entries[dir->beginSelection].shown); return; } max = &(dir->entries[dir->endSelection + 1]); name = dir->entries[dir->beginSelection].shown; (void) strcpy((growing = XtMalloc((unsigned) (strlen(name) + 1))), name); cmp = 0; while (!cmp) { entry = &(dir->entries[dir->beginSelection]); while (entry < max) { if (cmp = strncmp(growing, entry->shown, len)) { break; } entry++; } len++; } /* * SFreplaceText() expects filename */ growing[len - 2] = ' '; growing[len - 1] = 0; SFreplaceText(dir, growing); XtFree(growing); } static int SFfindFile(dir, str) SFDir *dir; register char *str; { register int i, last, max; register char *name, save; SFEntry *entries; int len; int begin, end; int result; len = strlen(str); if (str[len - 1] == ' ') { SFexpand(str); return 1; } else if (str[len - 1] == '/') { len--; } max = dir->nEntries; entries = dir->entries; i = 0; while (i < max) { name = entries[i].shown; last = strlen(name) - 1; save = name[last]; name[last] = 0; #ifdef SEL_FILE_IGNORE_CASE result = SFstrncmp(str, name, len); #else /* def SEL_FILE_IGNORE_CASE */ result = strncmp(str, name, len); #endif /* def SEL_FILE_IGNORE_CASE */ name[last] = save; if (result <= 0) { break; } i++; } begin = i; while (i < max) { name = entries[i].shown; last = strlen(name) - 1; save = name[last]; name[last] = 0; #ifdef SEL_FILE_IGNORE_CASE result = SFstrncmp(str, name, len); #else /* def SEL_FILE_IGNORE_CASE */ result = strncmp(str, name, len); #endif /* def SEL_FILE_IGNORE_CASE */ name[last] = save; if (result) { break; } i++; } end = i; if (begin != end) { if ( (dir->beginSelection != begin) || (dir->endSelection != end - 1) ) { dir->changed = 1; dir->beginSelection = begin; if (str[strlen(str) - 1] == '/') { dir->endSelection = begin; } else { dir->endSelection = end - 1; } } } else { if (dir->beginSelection != -1) { dir->changed = 1; dir->beginSelection = -1; dir->endSelection = -1; } } if ( SFdoNotTouchVorigin || ((begin > dir->vOrigin) && (end < dir->vOrigin + SFlistSize)) ) { SFdoNotTouchVorigin = 0; return 0; } i = begin - 1; if (i > max - SFlistSize) { i = max - SFlistSize; } if (i < 0) { i = 0; } if (dir->vOrigin != i) { dir->vOrigin = i; dir->changed = 1; } return 0; } static SFunselect() { SFDir *dir; dir = &(SFdirs[SFdirEnd - 1]); if (dir->beginSelection != -1) { dir->changed = 1; } dir->beginSelection = -1; dir->endSelection = -1; } static int SFcompareLogins(p, q) SFLogin *p, *q; { return strcmp(p->name, q->name); } static SFgetHomeDirs() { struct passwd *pw; struct stat statBuf; int alloc; int i; SFEntry *entries = NULL; #ifndef HOME_ON_DEMAND /* by Y.Kawabe */ int len; #endif /* HOME_ON_DEMAND */ int maxChars; alloc = 0; i = 0; maxChars = -1; if (pw = getpwuid((int) getuid())) { if ( (!stat(pw->pw_dir, &statBuf)) && (S_ISDIR (statBuf.st_mode)) ) { alloc = 1; i = 1; entries = (SFEntry *) XtMalloc(sizeof(SFEntry)); SFlogins = (SFLogin *) XtMalloc(sizeof(SFLogin)); entries[0].real = XtMalloc(3); (void) strcpy(entries[0].real, "~"); entries[0].shown = entries[0].real; entries[0].statDone = 1; SFlogins[0].name = ""; SFlogins[0].dir = XtMalloc((unsigned) (strlen(pw->pw_dir) + 1)); (void) strcpy(SFlogins[0].dir, pw->pw_dir); maxChars = 1; } } #ifndef HOME_ON_DEMAND /* by Y.Kawabe */ (void) setpwent(); while ((pw = getpwent()) && (*(pw->pw_name))) { if ( (!stat(pw->pw_dir, &statBuf)) && (S_ISDIR (statBuf.st_mode)) ) { if (i >= alloc) { alloc *= 2; entries = (SFEntry *) XtRealloc( (char *) entries, (unsigned) (alloc * sizeof(SFEntry)) ); SFlogins = (SFLogin *) XtRealloc( (char *) SFlogins, (unsigned) (alloc * sizeof(SFLogin)) ); } len = strlen(pw->pw_name); entries[i].real = XtMalloc((unsigned) (len + 3)); (void) strcat(strcpy(entries[i].real, "~"), pw->pw_name); entries[i].shown = entries[i].real; entries[i].statDone = 1; if (len > maxChars) { maxChars = len; } SFlogins[i].name = XtMalloc((unsigned) (strlen(pw->pw_name) + 1)); (void) strcpy(SFlogins[i].name, pw->pw_name); SFlogins[i].dir = XtMalloc((unsigned) (strlen(pw->pw_dir) + 1)); (void) strcpy(SFlogins[i].dir, pw->pw_dir); i++; } } #endif /* HOME_ON_DEMAND */ SFhomeDir.dir = XtMalloc(1) ; SFhomeDir.dir[0] = 0 ; SFhomeDir.path = SFcurrentPath ; SFhomeDir.entries = entries ; SFhomeDir.nEntries = i ; SFhomeDir.vOrigin = 0 ; /* :-) */ SFhomeDir.nChars = maxChars + 2 ; SFhomeDir.hOrigin = 0 ; SFhomeDir.changed = 1 ; SFhomeDir.beginSelection = -1 ; SFhomeDir.endSelection = -1 ; #if defined(SVR4) || defined(SYSV) || defined(USG) qsort((char *) entries, (unsigned)i, sizeof(SFEntry), SFcompareEntries); qsort((char *) SFlogins, (unsigned)i, sizeof(SFLogin), SFcompareLogins); #else /* defined(SVR4) || defined(SYSV) || defined(USG) */ qsort((char *) entries, i, sizeof(SFEntry), SFcompareEntries); qsort((char *) SFlogins, i, sizeof(SFLogin), SFcompareLogins); #endif /* defined(SVR4) || defined(SYSV) || defined(USG) */ for (i--; i >= 0; i--) { (void) strcat(entries[i].real, "/"); } } static int SFfindHomeDir(begin, end) char *begin, *end; { char save; char *theRest; int i; save = *end; *end = 0; for (i = SFhomeDir.nEntries - 1; i >= 0; i--) { if (!strcmp(SFhomeDir.entries[i].real, begin)) { *end = save; theRest = XtMalloc((unsigned) (strlen(end) + 1)); (void) strcpy(theRest, end); (void) strcat(strcat(strcpy(SFcurrentPath, SFlogins[i].dir), "/"), theRest); XtFree(theRest); SFsetText(SFcurrentPath); SFtextChanged(); return 1; } } #ifdef HOME_ON_DEMAND /* by Y.Kawabe */ if (*(++begin)) { struct passwd *pwd; char user[256]; int i = 0; while (*begin && *begin != '/' && i < sizeof(user)) user[i++] = *begin++; user[i] = '\0'; if (pwd = getpwnam(user)) { theRest = XtMalloc((unsigned) (strlen(end) + 1)); (void) strcpy(theRest, end); (void) strcat(strcat(strcpy(SFcurrentPath, pwd->pw_dir), "/"), theRest); XtFree(theRest); SFsetText(SFcurrentPath); SFtextChanged(); return 1; } } #endif /* HOME_ON_DEMAND */ *end = save; return 0; } SFupdatePath() { static int alloc; static int wasTwiddle = 0; char *begin, *end; int i, j; int len; int prevChange; int SFdirPtrSave, SFdirEndSave; SFDir *dir; if (!SFdirs) { SFdirs = (SFDir *) XtMalloc((alloc = 10) * sizeof(SFDir)); dir = &(SFdirs[0]); dir->dir = XtMalloc(2); (void) strcpy(dir->dir, "/"); (void) SFchdir("/"); (void) SFgetDir(dir); for (j = 1; j < alloc; j++) { SFdirs[j].dir = NULL; } dir->path = SFcurrentPath + 1; dir->vOrigin = 0; dir->hOrigin = 0; dir->changed = 1; dir->beginSelection = -1; dir->endSelection = -1; SFgetHomeDirs(); } SFdirEndSave = SFdirEnd; SFdirEnd = 1; SFdirPtrSave = SFdirPtr; SFdirPtr = 0; begin = NULL; if (SFcurrentPath[0] == '~') { if (!SFtwiddle) { SFtwiddle = 1; dir = &(SFdirs[0]); SFrootDir = *dir; *dir = SFhomeDir; dir->changed = 1; } end = SFcurrentPath; SFdoNotTouchDirPtr = 1; wasTwiddle = 1; } else { if (SFtwiddle) { SFtwiddle = 0; dir = &(SFdirs[0]); *dir = SFrootDir; dir->changed = 1; } end = SFcurrentPath + 1; } i = 0; prevChange = 0; while (*end) { while (*end++ == '/') { ; } end--; begin = end; while ((*end) && (*end++ != '/')) { ; } if ((end - SFcurrentPath <= SFtextPos) && (*(end - 1) == '/')) { SFdirPtr = i - 1; if (SFdirPtr < 0) { SFdirPtr = 0; } } if (*begin) { if (*(end - 1) == '/') { char save = *end; if (SFtwiddle) { if (SFfindHomeDir(begin, end)) { return; } } *end = 0; i++; SFdirEnd++; if (i >= alloc) { SFdirs = (SFDir *) XtRealloc( (char *) SFdirs, (unsigned) ((alloc *= 2) * sizeof(SFDir)) ); for (j = alloc / 2; j < alloc; j++) { SFdirs[j].dir = NULL; } } dir = &(SFdirs[i]); if ( (!(dir->dir)) || prevChange || strcmp(dir->dir, begin) ) { if (dir->dir) { SFfree(i); } prevChange = 1; len = strlen(begin) + 1; dir->dir = XtMalloc((unsigned) len); (void) strcpy(dir->dir, begin); dir->path = end; dir->vOrigin = 0; dir->hOrigin = 0; dir->changed = 1; dir->beginSelection = -1; dir->endSelection = -1; (void) SFfindFile(dir - 1, begin); if ( SFchdir(SFcurrentPath) || SFgetDir(dir) ) { SFunreadableDir(dir); break; } } *end = save; if (!save) { SFunselect(); } } else { if (SFfindFile(&(SFdirs[SFdirEnd-1]), begin)) { return; } } } else { SFunselect(); } } if ((end == SFcurrentPath + 1) && (!SFtwiddle)) { SFunselect(); } for (i = SFdirEnd; i < alloc; i++) { if (SFdirs[i].dir) { SFfree(i); } } if (SFdoNotTouchDirPtr) { if (wasTwiddle) { wasTwiddle = 0; SFdirPtr = SFdirEnd - 2; if (SFdirPtr < 0) { SFdirPtr = 0; } } else { SFdirPtr = SFdirPtrSave; } SFdoNotTouchDirPtr = 0; } if ((SFdirPtr != SFdirPtrSave) || (SFdirEnd != SFdirEndSave)) { XawScrollbarSetThumb( selFileHScroll, (float) (((double) SFdirPtr) / SFdirEnd), (float) (((double) ((SFdirEnd < 3) ? SFdirEnd : 3)) / SFdirEnd) ); } if (SFdirPtr != SFdirPtrSave) { SFdrawLists(SF_DO_SCROLL); } else { for (i = 0; i < 3; i++) { if (SFdirPtr + i < SFdirEnd) { if (SFdirs[SFdirPtr + i].changed) { SFdirs[SFdirPtr + i].changed = 0; SFdrawList(i, SF_DO_SCROLL); } } else { SFclearList(i, SF_DO_SCROLL); } } } } SFsetText(path) char *path; { XawTextBlock text; text.firstPos = 0; text.length = strlen(path); text.ptr = path; text.format = FMT8BIT; XawTextReplace(selFileField, 0, strlen(SFtextBuffer), &text); XawTextSetInsertionPoint(selFileField, strlen(SFtextBuffer)); } /* ARGSUSED */ void SFbuttonPressList(w, n, event) Widget w; int n; XButtonPressedEvent *event; { SFbuttonPressed = 1; } /* ARGSUSED */ void SFbuttonReleaseList(w, n, event) Widget w; int n; XButtonReleasedEvent *event; { SFDir *dir; SFbuttonPressed = 0; if (SFcurrentInvert[n] != -1) { if (n < 2) { SFdoNotTouchDirPtr = 1; } SFdoNotTouchVorigin = 1; dir = &(SFdirs[SFdirPtr + n]); SFreplaceText( dir, dir->entries[dir->vOrigin + SFcurrentInvert[n]].shown ); SFmotionList(w, n, event); } } static int SFcheckDir(n, dir) int n; SFDir *dir; { struct stat statBuf; int i; if ( (!stat(".", &statBuf)) && (statBuf.st_mtime != dir->mtime) ) { /* * If the pointer is currently in the window that we are about * to update, we must warp it to prevent the user from * accidentally selecting the wrong file. */ if (SFcurrentInvert[n] != -1) { XWarpPointer( SFdisplay, None, XtWindow(selFileLists[n]), 0, 0, 0, 0, 0, 0 ); } for (i = dir->nEntries - 1; i >= 0; i--) { if (dir->entries[i].shown != dir->entries[i].real) { XtFree(dir->entries[i].shown); } XtFree(dir->entries[i].real); } XtFree((char *) dir->entries); if (SFgetDir(dir)) { SFunreadableDir(dir); } if (dir->vOrigin > dir->nEntries - SFlistSize) { dir->vOrigin = dir->nEntries - SFlistSize; } if (dir->vOrigin < 0) { dir->vOrigin = 0; } if (dir->hOrigin > dir->nChars - SFcharsPerEntry) { dir->hOrigin = dir->nChars - SFcharsPerEntry; } if (dir->hOrigin < 0) { dir->hOrigin = 0; } dir->beginSelection = -1; dir->endSelection = -1; SFdoNotTouchVorigin = 1; if ((dir + 1)->dir) { (void) SFfindFile(dir, (dir + 1)->dir); } else { (void) SFfindFile(dir, dir->path); } if (!SFworkProcAdded) { (void) XtAppAddWorkProc(SFapp, SFworkProc, NULL); SFworkProcAdded = 1; } return 1; } return 0; } static int SFcheckFiles(dir) SFDir *dir; { int from, to; int result; char old, new; int i; char *str; int last; struct stat statBuf; result = 0; from = dir->vOrigin; to = dir->vOrigin + SFlistSize; if (to > dir->nEntries) { to = dir->nEntries; } for (i = from; i < to; i++) { str = dir->entries[i].real; last = strlen(str) - 1; old = str[last]; str[last] = 0; if (stat(str, &statBuf)) { new = ' '; } else { new = SFstatChar(&statBuf); } str[last] = new; if (new != old) { result = 1; } } return result; } void SFdirModTimer() { static int n = -1; static int f = 0; char save; SFDir *dir; if ((!SFtwiddle) && (SFdirPtr < SFdirEnd)) { n++; if ((n > 2) || (SFdirPtr + n >= SFdirEnd)) { n = 0; f++; if ((f > 2) || (SFdirPtr + f >= SFdirEnd)) { f = 0; } } dir = &(SFdirs[SFdirPtr + n]); save = *(dir->path); *(dir->path) = 0; if (SFchdir(SFcurrentPath)) { *(dir->path) = save; /* * force a re-read */ *(dir->dir) = 0; SFupdatePath(); } else { *(dir->path) = save; if ( SFcheckDir(n, dir) || ((f == n) && SFcheckFiles(dir)) ) { SFdrawList(n, SF_DO_SCROLL); } } } SFdirModTimerId = XtAppAddTimeOut(SFapp, (unsigned long) 1000, SFdirModTimer, (XtPointer) NULL); } /* Return a single character describing what kind of file STATBUF is. */ char SFstatChar (statBuf) struct stat *statBuf; { if (S_ISDIR (statBuf->st_mode)) { return '/'; } else if (S_ISREG (statBuf->st_mode)) { return S_ISXXX (statBuf->st_mode) ? '*' : ' '; #ifdef S_ISSOCK } else if (S_ISSOCK (statBuf->st_mode)) { return '='; #endif /* S_ISSOCK */ } else { return ' '; } } pixmap-2.6pl4.orig/SelFile/SFinternal.h100644 243 144 6566 5507550635 16560 0ustar joostusers/* * Copyright 1989 Software Research Associates, Inc., Tokyo, Japan * * 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 Software Research Associates not be used * in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. Software Research Associates * makes no representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * SOFTWARE RESEARCH ASSOCIATES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, * IN NO EVENT SHALL SOFTWARE RESEARCH ASSOCIATES 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. * * Author: Erik M. van der Poel * Software Research Associates, Inc., Tokyo, Japan * erik@sra.co.jp */ #include #include #include #include #include #define SEL_FILE_CANCEL -1 #define SEL_FILE_OK 0 #define SEL_FILE_NULL 1 #define SEL_FILE_TEXT 2 #define SF_DO_SCROLL 1 #define SF_DO_NOT_SCROLL 0 typedef struct { int statDone; char *real; char *shown; } SFEntry; typedef struct { char *dir; char *path; SFEntry *entries; int nEntries; int vOrigin; int nChars; int hOrigin; int changed; int beginSelection; int endSelection; time_t mtime; } SFDir; extern int SFstatus; extern char SFcurrentPath[], SFstartDir[], SFcurrentDir[]; extern Widget selFile, selFileCancel, selFileField, selFileForm, selFileHScroll, selFileHScrolls[], selFileLists[], selFileOK, selFilePrompt, selFileVScrolls[]; extern Display *SFdisplay; extern int SFcharWidth, SFcharHeight, SFcharAscent; extern SFDir *SFdirs; extern int SFdirEnd, SFdirPtr; extern Pixel SFfore, SFback; extern Atom SFwmDeleteWindow; extern XSegment SFsegs[], SFcompletionSegs[]; extern XawTextPosition SFtextPos; extern void SFenterList(), SFleaveList(), SFmotionList(), SFbuttonPressList(), SFbuttonReleaseList(); extern void SFvSliderMovedCallback(), SFvFloatSliderMovedCallback(), SFhSliderMovedCallback(), SFpathSliderMovedCallback(), SFvAreaSelectedCallback(), SFhAreaSelectedCallback(), SFpathAreaSelectedCallback(); extern int SFupperX, SFlowerY, SFupperY; extern int SFtextX, SFtextYoffset; extern int SFentryWidth, SFentryHeight; extern int SFlineToTextH, SFlineToTextV; extern int SFbesideText, SFaboveAndBelowText; extern int SFcharsPerEntry; extern int SFlistSize; extern int SFcurrentInvert[]; extern int SFworkProcAdded; extern Boolean SFworkProc(); extern XtAppContext SFapp; extern int SFpathScrollWidth, SFvScrollHeight, SFhScrollWidth; extern char SFtextBuffer[]; extern int SFbuttonPressed; extern int SFcompareEntries(); extern void SFdirModTimer(); extern char SFstatChar(); extern XtIntervalId SFdirModTimerId; extern int (*SFfunc)(); pixmap-2.6pl4.orig/SelFile/SelFile.c100644 243 144 51374 5507550634 16045 0ustar joostusers/* * Copyright 1989 Software Research Associates, Inc., Tokyo, Japan * * 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 Software Research Associates not be used * in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. Software Research Associates * makes no representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * SOFTWARE RESEARCH ASSOCIATES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, * IN NO EVENT SHALL SOFTWARE RESEARCH ASSOCIATES 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. * * Author: Erik M. van der Poel * Software Research Associates, Inc., Tokyo, Japan * erik@sra.co.jp */ /* * Author's address: * * erik@sra.co.jp * OR * erik%sra.co.jp@uunet.uu.net * OR * erik%sra.co.jp@mcvax.uucp * OR * try junet instead of co.jp * OR * Erik M. van der Poel * Software Research Associates, Inc. * 1-1-1 Hirakawa-cho, Chiyoda-ku * Tokyo 102 Japan. TEL +81-3-234-2692 */ #include #include /* BSD 4.3 errno.h does not declare errno */ extern int errno; extern int sys_nerr; extern char *sys_errlist[]; #include #include #include #include #include #include #include #include #include #include #include "SFinternal.h" #ifndef MAXPATHLEN #define MAXPATHLEN 1024 #endif /* ndef MAXPATHLEN */ #if !defined(SVR4) && !defined(SYSV) && !defined(USG) extern char *getwd(); #endif /* !defined(SVR4) && !defined(SYSV) && !defined(USG) */ int SFstatus = SEL_FILE_NULL; char SFstartDir[MAXPATHLEN], SFcurrentPath[MAXPATHLEN], SFcurrentDir[MAXPATHLEN]; Widget selFile, selFileCancel, selFileField, selFileForm, selFileHScroll, selFileHScrolls[3], selFileLists[3], selFileOK, selFilePrompt, selFileVScrolls[3]; Display *SFdisplay; Pixel SFfore, SFback; Atom SFwmDeleteWindow; XSegment SFsegs[2], SFcompletionSegs[2]; XawTextPosition SFtextPos; int SFupperX, SFlowerY, SFupperY; int SFtextX, SFtextYoffset; int SFentryWidth, SFentryHeight; int SFlineToTextH = 3; int SFlineToTextV = 3; int SFbesideText = 3; int SFaboveAndBelowText = 2; int SFcharsPerEntry = 15; int SFlistSize = 10; int SFworkProcAdded = 0; XtAppContext SFapp; int SFpathScrollWidth, SFvScrollHeight, SFhScrollWidth; char SFtextBuffer[MAXPATHLEN]; XtIntervalId SFdirModTimerId; int (*SFfunc)(); static char *oneLineTextEditTranslations = "\ Return: redraw-display()\n\ CtrlM: redraw-display()\n\ "; /* ARGSUSED */ static void SFexposeList(w, n, event) Widget w; int n; XExposeEvent *event; { if ((event->type == NoExpose) || event->count) { return; } SFdrawList(n, SF_DO_NOT_SCROLL); } /* ARGSUSED */ static void SFmodVerifyCallback(w, client_data, event) Widget w; XtPointer client_data; XKeyPressedEvent *event; { char buf[2]; if ( (XLookupString(event, buf, 2, NULL, NULL) == 1) && ((*buf) == '\r') ) { SFstatus = SEL_FILE_OK; } else { SFstatus = SEL_FILE_TEXT; } } /* ARGSUSED */ static void SFokCallback(w) Widget w; { SFstatus = SEL_FILE_OK; } static XtCallbackRec SFokSelect[] = { { SFokCallback, (XtPointer) NULL }, { NULL, (XtPointer) NULL }, }; /* ARGSUSED */ static void SFcancelCallback(w) Widget w; { SFstatus = SEL_FILE_CANCEL; } static XtCallbackRec SFcancelSelect[] = { { SFcancelCallback, (XtPointer) NULL }, { NULL, (XtPointer) NULL }, }; /* ARGSUSED */ static void SFdismissAction(w, event, params, num_params) Widget w; XEvent *event; String *params; Cardinal *num_params; { if (event->type == ClientMessage && event->xclient.data.l[0] != SFwmDeleteWindow) return; SFstatus = SEL_FILE_CANCEL; } static char *wmDeleteWindowTranslation = "\ WM_PROTOCOLS: SelFileDismiss()\n\ "; static XtActionsRec actions[] = { {"SelFileDismiss", SFdismissAction}, }; static void SFcreateWidgets(toplevel, prompt, ok, cancel) Widget toplevel; char *prompt; char *ok; char *cancel; { int i, n; int listWidth, listHeight; int listSpacing = 10; int scrollThickness = 15; int hScrollX, hScrollY; int vScrollX, vScrollY; Cursor xtermCursor, sbRightArrowCursor, dotCursor; Arg arglist[20]; i = 0; XtSetArg(arglist[i], XtNtransientFor, toplevel); i++; selFile = XtAppCreateShell("selFile", "SelFile", transientShellWidgetClass, SFdisplay, arglist, i); /* Add WM_DELETE_WINDOW protocol */ XtAppAddActions(XtWidgetToApplicationContext(selFile), actions, XtNumber(actions)); XtOverrideTranslations(selFile, XtParseTranslationTable(wmDeleteWindowTranslation)); i = 0; XtSetArg(arglist[i], XtNdefaultDistance, 30); i++; selFileForm = XtCreateManagedWidget("selFileForm", formWidgetClass, selFile, arglist, i); i = 0; XtSetArg(arglist[i], XtNlabel, prompt); i++; XtSetArg(arglist[i], XtNresizable, True); i++; XtSetArg(arglist[i], XtNtop, XtChainTop); i++; XtSetArg(arglist[i], XtNbottom, XtChainTop); i++; XtSetArg(arglist[i], XtNleft, XtChainLeft); i++; XtSetArg(arglist[i], XtNright, XtChainLeft); i++; XtSetArg(arglist[i], XtNborderWidth, 0); i++; selFilePrompt = XtCreateManagedWidget("selFilePrompt", labelWidgetClass, selFileForm, arglist, i); i = 0; XtSetArg(arglist[i], XtNforeground, &SFfore); i++; XtSetArg(arglist[i], XtNbackground, &SFback); i++; XtGetValues(selFilePrompt, arglist, i); SFinitFont(); SFentryWidth = SFbesideText + SFcharsPerEntry * SFcharWidth + SFbesideText; SFentryHeight = SFaboveAndBelowText + SFcharHeight + SFaboveAndBelowText; listWidth = SFlineToTextH + SFentryWidth + SFlineToTextH + 1 + scrollThickness; listHeight = SFlineToTextV + SFentryHeight + SFlineToTextV + 1 + SFlineToTextV + SFlistSize * SFentryHeight + SFlineToTextV + 1 + scrollThickness; SFpathScrollWidth = 3 * listWidth + 2 * listSpacing + 4; hScrollX = -1; hScrollY = SFlineToTextV + SFentryHeight + SFlineToTextV + 1 + SFlineToTextV + SFlistSize * SFentryHeight + SFlineToTextV; SFhScrollWidth = SFlineToTextH + SFentryWidth + SFlineToTextH; vScrollX = SFlineToTextH + SFentryWidth + SFlineToTextH; vScrollY = SFlineToTextV + SFentryHeight + SFlineToTextV; SFvScrollHeight = SFlineToTextV + SFlistSize * SFentryHeight + SFlineToTextV; SFupperX = SFlineToTextH + SFentryWidth + SFlineToTextH - 1; SFlowerY = SFlineToTextV + SFentryHeight + SFlineToTextV + 1 + SFlineToTextV; SFupperY = SFlineToTextV + SFentryHeight + SFlineToTextV + 1 + SFlineToTextV + SFlistSize * SFentryHeight - 1; SFtextX = SFlineToTextH + SFbesideText; SFtextYoffset = SFlowerY + SFaboveAndBelowText + SFcharAscent; SFsegs[0].x1 = 0; SFsegs[0].y1 = vScrollY; SFsegs[0].x2 = vScrollX - 1; SFsegs[0].y2 = vScrollY; SFsegs[1].x1 = vScrollX; SFsegs[1].y1 = 0; SFsegs[1].x2 = vScrollX; SFsegs[1].y2 = vScrollY - 1; SFcompletionSegs[0].x1 = SFcompletionSegs[0].x2 = SFlineToTextH; SFcompletionSegs[1].x1 = SFcompletionSegs[1].x2 = SFlineToTextH + SFentryWidth - 1; i = 0; XtSetArg(arglist[i], XtNwidth, 3 * listWidth + 2 * listSpacing + 4); i++; XtSetArg(arglist[i], XtNborderColor, SFfore); i++; XtSetArg(arglist[i], XtNfromVert, selFilePrompt); i++; XtSetArg(arglist[i], XtNvertDistance, 10); i++; XtSetArg(arglist[i], XtNresizable, True); i++; XtSetArg(arglist[i], XtNtop, XtChainTop); i++; XtSetArg(arglist[i], XtNbottom, XtChainTop); i++; XtSetArg(arglist[i], XtNleft, XtChainLeft); i++; XtSetArg(arglist[i], XtNright, XtChainLeft); i++; XtSetArg(arglist[i], XtNstring, SFtextBuffer); i++; XtSetArg(arglist[i], XtNlength, MAXPATHLEN); i++; XtSetArg(arglist[i], XtNeditType, XawtextEdit); i++; XtSetArg(arglist[i], XtNwrap, XawtextWrapWord); i++; XtSetArg(arglist[i], XtNresize, XawtextResizeHeight); i++; XtSetArg(arglist[i], XtNuseStringInPlace, True); i++; selFileField = XtCreateManagedWidget("selFileField", asciiTextWidgetClass, selFileForm, arglist, i); XtOverrideTranslations(selFileField, XtParseTranslationTable(oneLineTextEditTranslations)); XtSetKeyboardFocus(selFileForm, selFileField); i = 0; XtSetArg(arglist[i], XtNorientation, XtorientHorizontal); i++; XtSetArg(arglist[i], XtNwidth, SFpathScrollWidth); i++; XtSetArg(arglist[i], XtNheight, scrollThickness); i++; XtSetArg(arglist[i], XtNborderColor, SFfore); i++; XtSetArg(arglist[i], XtNfromVert, selFileField); i++; XtSetArg(arglist[i], XtNvertDistance, 30); i++; XtSetArg(arglist[i], XtNtop, XtChainTop); i++; XtSetArg(arglist[i], XtNbottom, XtChainTop); i++; XtSetArg(arglist[i], XtNleft, XtChainLeft); i++; XtSetArg(arglist[i], XtNright, XtChainLeft); i++; selFileHScroll = XtCreateManagedWidget("selFileHScroll", scrollbarWidgetClass, selFileForm, arglist, i); XtAddCallback(selFileHScroll, XtNjumpProc, SFpathSliderMovedCallback, (XtPointer) NULL); XtAddCallback(selFileHScroll, XtNscrollProc, SFpathAreaSelectedCallback, (XtPointer) NULL); i = 0; XtSetArg(arglist[i], XtNwidth, listWidth); i++; XtSetArg(arglist[i], XtNheight, listHeight); i++; XtSetArg(arglist[i], XtNborderColor, SFfore); i++; XtSetArg(arglist[i], XtNfromVert, selFileHScroll); i++; XtSetArg(arglist[i], XtNvertDistance, 10); i++; XtSetArg(arglist[i], XtNtop, XtChainTop); i++; XtSetArg(arglist[i], XtNbottom, XtChainTop); i++; XtSetArg(arglist[i], XtNleft, XtChainLeft); i++; XtSetArg(arglist[i], XtNright, XtChainLeft); i++; selFileLists[0] = XtCreateManagedWidget("selFileList1", compositeWidgetClass, selFileForm, arglist, i); i = 0; XtSetArg(arglist[i], XtNwidth, listWidth); i++; XtSetArg(arglist[i], XtNheight, listHeight); i++; XtSetArg(arglist[i], XtNborderColor, SFfore); i++; XtSetArg(arglist[i], XtNfromHoriz, selFileLists[0]); i++; XtSetArg(arglist[i], XtNfromVert, selFileHScroll); i++; XtSetArg(arglist[i], XtNhorizDistance, listSpacing); i++; XtSetArg(arglist[i], XtNvertDistance, 10); i++; XtSetArg(arglist[i], XtNtop, XtChainTop); i++; XtSetArg(arglist[i], XtNbottom, XtChainTop); i++; XtSetArg(arglist[i], XtNleft, XtChainLeft); i++; XtSetArg(arglist[i], XtNright, XtChainLeft); i++; selFileLists[1] = XtCreateManagedWidget("selFileList2", compositeWidgetClass, selFileForm, arglist, i); i = 0; XtSetArg(arglist[i], XtNwidth, listWidth); i++; XtSetArg(arglist[i], XtNheight, listHeight); i++; XtSetArg(arglist[i], XtNborderColor, SFfore); i++; XtSetArg(arglist[i], XtNfromHoriz, selFileLists[1]); i++; XtSetArg(arglist[i], XtNfromVert, selFileHScroll); i++; XtSetArg(arglist[i], XtNhorizDistance, listSpacing); i++; XtSetArg(arglist[i], XtNvertDistance, 10); i++; XtSetArg(arglist[i], XtNtop, XtChainTop); i++; XtSetArg(arglist[i], XtNbottom, XtChainTop); i++; XtSetArg(arglist[i], XtNleft, XtChainLeft); i++; XtSetArg(arglist[i], XtNright, XtChainLeft); i++; selFileLists[2] = XtCreateManagedWidget("selFileList3", compositeWidgetClass, selFileForm, arglist, i); for (n = 0; n < 3; n++) { i = 0; XtSetArg(arglist[i], XtNx, vScrollX); i++; XtSetArg(arglist[i], XtNy, vScrollY); i++; XtSetArg(arglist[i], XtNwidth, scrollThickness); i++; XtSetArg(arglist[i], XtNheight, SFvScrollHeight); i++; XtSetArg(arglist[i], XtNborderColor, SFfore); i++; selFileVScrolls[n] = XtCreateManagedWidget("selFileVScroll", scrollbarWidgetClass, selFileLists[n], arglist, i); XtAddCallback(selFileVScrolls[n], XtNjumpProc, SFvFloatSliderMovedCallback, (XtPointer) n); XtAddCallback(selFileVScrolls[n], XtNscrollProc, SFvAreaSelectedCallback, (XtPointer) n); i = 0; XtSetArg(arglist[i], XtNorientation, XtorientHorizontal); i++; XtSetArg(arglist[i], XtNx, hScrollX); i++; XtSetArg(arglist[i], XtNy, hScrollY); i++; XtSetArg(arglist[i], XtNwidth, SFhScrollWidth); i++; XtSetArg(arglist[i], XtNheight, scrollThickness); i++; XtSetArg(arglist[i], XtNborderColor, SFfore); i++; selFileHScrolls[n] = XtCreateManagedWidget("selFileHScroll", scrollbarWidgetClass, selFileLists[n], arglist, i); XtAddCallback(selFileHScrolls[n], XtNjumpProc, SFhSliderMovedCallback, (XtPointer) n); XtAddCallback(selFileHScrolls[n], XtNscrollProc, SFhAreaSelectedCallback, (XtPointer) n); } i = 0; XtSetArg(arglist[i], XtNlabel, ok); i++; XtSetArg(arglist[i], XtNresizable, True); i++; XtSetArg(arglist[i], XtNcallback, SFokSelect); i++; XtSetArg(arglist[i], XtNborderColor, SFfore); i++; XtSetArg(arglist[i], XtNfromVert, selFileLists[0]); i++; XtSetArg(arglist[i], XtNvertDistance, 30); i++; XtSetArg(arglist[i], XtNtop, XtChainTop); i++; XtSetArg(arglist[i], XtNbottom, XtChainTop); i++; XtSetArg(arglist[i], XtNleft, XtChainLeft); i++; XtSetArg(arglist[i], XtNright, XtChainLeft); i++; selFileOK = XtCreateManagedWidget("selFileOK", commandWidgetClass, selFileForm, arglist, i); i = 0; XtSetArg(arglist[i], XtNlabel, cancel); i++; XtSetArg(arglist[i], XtNresizable, True); i++; XtSetArg(arglist[i], XtNcallback, SFcancelSelect); i++; XtSetArg(arglist[i], XtNborderColor, SFfore); i++; XtSetArg(arglist[i], XtNfromHoriz, selFileOK); i++; XtSetArg(arglist[i], XtNfromVert, selFileLists[0]); i++; XtSetArg(arglist[i], XtNhorizDistance, 30); i++; XtSetArg(arglist[i], XtNvertDistance, 30); i++; XtSetArg(arglist[i], XtNtop, XtChainTop); i++; XtSetArg(arglist[i], XtNbottom, XtChainTop); i++; XtSetArg(arglist[i], XtNleft, XtChainLeft); i++; XtSetArg(arglist[i], XtNright, XtChainLeft); i++; selFileCancel = XtCreateManagedWidget("selFileCancel", commandWidgetClass, selFileForm, arglist, i); XtSetMappedWhenManaged(selFile, False); XtRealizeWidget(selFile); /* Add WM_DELETE_WINDOW protocol */ SFwmDeleteWindow = XInternAtom(SFdisplay, "WM_DELETE_WINDOW", False); XSetWMProtocols(SFdisplay, XtWindow(selFile), &SFwmDeleteWindow, 1); SFcreateGC(); xtermCursor = XCreateFontCursor(SFdisplay, XC_xterm); sbRightArrowCursor = XCreateFontCursor(SFdisplay, XC_sb_right_arrow); dotCursor = XCreateFontCursor(SFdisplay, XC_dot); XDefineCursor(SFdisplay, XtWindow(selFileForm), xtermCursor); XDefineCursor(SFdisplay, XtWindow(selFileField), xtermCursor); for (n = 0; n < 3; n++) { XDefineCursor(SFdisplay, XtWindow(selFileLists[n]), sbRightArrowCursor); } XDefineCursor(SFdisplay, XtWindow(selFileOK), dotCursor); XDefineCursor(SFdisplay, XtWindow(selFileCancel), dotCursor); for (n = 0; n < 3; n++) { XtAddEventHandler(selFileLists[n], ExposureMask, True, SFexposeList, (XtPointer) n); XtAddEventHandler(selFileLists[n], EnterWindowMask, False, SFenterList, (XtPointer) n); XtAddEventHandler(selFileLists[n], LeaveWindowMask, False, SFleaveList, (XtPointer) n); XtAddEventHandler(selFileLists[n], PointerMotionMask, False, SFmotionList, (XtPointer) n); XtAddEventHandler(selFileLists[n], ButtonPressMask, False, SFbuttonPressList, (XtPointer) n); XtAddEventHandler(selFileLists[n], ButtonReleaseMask, False, SFbuttonReleaseList, (XtPointer) n); } XtAddEventHandler(selFileField, KeyPressMask, False, SFmodVerifyCallback, (XtPointer) NULL); SFapp = XtWidgetToApplicationContext(selFile); } /* position widget under the cursor */ void SFpositionWidget(w) Widget w; { Arg args[3]; Cardinal num_args; Dimension width, height, b_width; int x, y, max_x, max_y; Window root, child; int dummyx, dummyy; unsigned int dummymask; XQueryPointer(XtDisplay(w), XtWindow(w), &root, &child, &x, &y, &dummyx, &dummyy, &dummymask); num_args = 0; XtSetArg(args[num_args], XtNwidth, &width); num_args++; XtSetArg(args[num_args], XtNheight, &height); num_args++; XtSetArg(args[num_args], XtNborderWidth, &b_width); num_args++; XtGetValues(w, args, num_args); width += 2 * b_width; height += 2 * b_width; x -= ( (Position) width/2 ); if (x < 0) x = 0; if ( x > (max_x = (Position) (XtScreen(w)->width - width)) ) x = max_x; y -= ( (Position) height/2 ); if (y < 0) y = 0; if ( y > (max_y = (Position) (XtScreen(w)->height - height)) ) y = max_y; num_args = 0; XtSetArg(args[num_args], XtNx, x); num_args++; XtSetArg(args[num_args], XtNy, y); num_args++; XtSetValues(w, args, num_args); } FILE * SFopenFile(name, mode, prompt, failed) char *name; char *mode; char *prompt; char *failed; { Arg args[1]; FILE *fp; SFchdir(SFstartDir); if ((fp = fopen(name, mode)) == NULL) { char *buf; if (errno <= sys_nerr) { buf = XtMalloc(strlen(failed) + strlen(sys_errlist[errno]) + strlen(prompt) + 2); strcpy(buf, failed); strcat(buf, sys_errlist[errno]); strcat(buf, "\n"); strcat(buf, prompt); } else { buf = XtMalloc(strlen(failed) + strlen(prompt) + 2); strcpy(buf, failed); strcat(buf, "\n"); strcat(buf, prompt); } XtSetArg(args[0], XtNlabel, buf); XtSetValues(selFilePrompt, args, 1); XtFree(buf); return NULL; } return fp; } SFtextChanged() { if ((SFtextBuffer[0] == '/') || (SFtextBuffer[0] == '~')) { (void) strcpy(SFcurrentPath, SFtextBuffer); SFtextPos = XawTextGetInsertionPoint(selFileField); } else { (void) strcat(strcpy(SFcurrentPath, SFstartDir), SFtextBuffer); SFtextPos = XawTextGetInsertionPoint(selFileField) + strlen(SFstartDir); } if (!SFworkProcAdded) { (void) XtAppAddWorkProc(SFapp, SFworkProc, NULL); SFworkProcAdded = 1; } SFupdatePath(); } static char * SFgetText() { return strcpy(XtMalloc((unsigned) (strlen(SFtextBuffer) + 1)), SFtextBuffer); } static SFprepareToReturn() { SFstatus = SEL_FILE_NULL; XtRemoveGrab(selFile); XtUnmapWidget(selFile); XtRemoveTimeOut(SFdirModTimerId); if (SFchdir(SFstartDir)) { XtAppError( SFapp, "XsraSelFile: can't return to current directory" ); } } FILE * XsraSelFile(toplevel, prompt, ok, cancel, failed, init_path, mode, show_entry, name_return) Widget toplevel; char *prompt; char *ok; char *cancel; char *failed; char *init_path; char *mode; int (*show_entry)(); char **name_return; { static int firstTime = 1; int i; Arg arglist[20]; XEvent event; FILE *fp; if (!prompt) { prompt = "Pathname:"; } if (!ok) { ok = "OK"; } if (!cancel) { cancel = "Cancel"; } if (firstTime) { firstTime = 0; SFdisplay = XtDisplay(toplevel); SFcreateWidgets(toplevel, prompt, ok, cancel); } else { i = 0; XtSetArg(arglist[i], XtNlabel, prompt); i++; XtSetValues(selFilePrompt, arglist, i); i = 0; XtSetArg(arglist[i], XtNlabel, ok); i++; XtSetValues(selFileOK, arglist, i); i = 0; XtSetArg(arglist[i], XtNlabel, cancel); i++; XtSetValues(selFileCancel, arglist, i); } SFpositionWidget(selFile); XtMapWidget(selFile); #if defined(SVR4) || defined(SYSV) || defined(USG) if (!getcwd(SFstartDir, MAXPATHLEN)) { #else /* defined(SVR4) || defined(SYSV) || defined(USG) */ if (!getwd(SFstartDir)) { #endif /* defined(SVR4) || defined(SYSV) || defined(USG) */ XtAppError(SFapp, "XsraSelFile: can't get current directory"); } (void) strcat(SFstartDir, "/"); (void) strcpy(SFcurrentDir, SFstartDir); if (init_path) { if (init_path[0] == '/') { (void) strcpy(SFcurrentPath, init_path); if (strncmp( SFcurrentPath, SFstartDir, strlen(SFstartDir) )) { SFsetText(SFcurrentPath); } else { SFsetText(&(SFcurrentPath[strlen(SFstartDir)])); } } else { (void) strcat(strcpy(SFcurrentPath, SFstartDir), init_path); SFsetText(&(SFcurrentPath[strlen(SFstartDir)])); } } else { (void) strcpy(SFcurrentPath, SFstartDir); } SFfunc = show_entry; SFtextChanged(); XtAddGrab(selFile, True, True); SFdirModTimerId = XtAppAddTimeOut(SFapp, (unsigned long) 1000, SFdirModTimer, (XtPointer) NULL); while (1) { XtAppNextEvent(SFapp, &event); XtDispatchEvent(&event); switch (SFstatus) { case SEL_FILE_TEXT: SFstatus = SEL_FILE_NULL; SFtextChanged(); break; case SEL_FILE_OK: *name_return = SFgetText(); if (fp = SFopenFile(*name_return, mode, prompt, failed)) { SFprepareToReturn(); return fp; } SFstatus = SEL_FILE_NULL; break; case SEL_FILE_CANCEL: SFprepareToReturn(); return NULL; case SEL_FILE_NULL: break; } } } pixmap-2.6pl4.orig/SelFile/xstat.h100444 243 144 772 5507550646 15627 0ustar joostusers#include #if !defined(S_ISDIR) && defined(S_IFDIR) #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) #endif #if !defined(S_ISREG) && defined(S_IFREG) #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) #endif #if !defined(S_ISSOCK) && defined(S_IFSOCK) #define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) #endif #ifndef S_IXUSR #define S_IXUSR 0100 #endif #ifndef S_IXGRP #define S_IXGRP 0010 #endif #ifndef S_IXOTH #define S_IXOTH 0001 #endif #define S_ISXXX(m) ((m) & (S_IXUSR | S_IXGRP | S_IXOTH))