diff options
author | dos-reis <gdr@axiomatics.org> | 2008-03-09 03:47:21 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2008-03-09 03:47:21 +0000 |
commit | 6e07ce8f0c6c77b61cfa2f8be54781160018ff91 (patch) | |
tree | 91e5069719c924bd58242e932bd585d3e676112b /src/graph/view2D | |
parent | 3f7d906f8cd6edd2597a49f629bd31914de8ca08 (diff) | |
download | open-axiom-6e07ce8f0c6c77b61cfa2f8be54781160018ff91.tar.gz |
* graph/: Depamphletize.
* include/addfile.h: Move from hyper.
* include/addfile.H1: Move external declarations into
addfile.h. Remove.
Diffstat (limited to 'src/graph/view2D')
-rw-r--r-- | src/graph/view2D/Makefile.in | 16 | ||||
-rw-r--r-- | src/graph/view2D/buttons2d.c | 718 | ||||
-rw-r--r-- | src/graph/view2D/buttons2d.c.pamphlet | 738 | ||||
-rw-r--r-- | src/graph/view2D/control2d.c (renamed from src/graph/view2D/control2d.c.pamphlet) | 412 | ||||
-rw-r--r--[-rwxr-xr-x] | src/graph/view2D/globals2.h | 62 | ||||
-rw-r--r-- | src/graph/view2D/graph2d.c (renamed from src/graph/view2D/graph2d.c.pamphlet) | 86 | ||||
-rw-r--r--[-rwxr-xr-x] | src/graph/view2D/header2.h | 62 | ||||
-rw-r--r-- | src/graph/view2D/main2d.c (renamed from src/graph/view2D/main2d.c.pamphlet) | 156 | ||||
-rw-r--r-- | src/graph/view2D/pot2d.c | 63 | ||||
-rw-r--r-- | src/graph/view2D/pot2d.c.pamphlet | 83 | ||||
-rw-r--r-- | src/graph/view2D/process2d.c | 938 | ||||
-rw-r--r-- | src/graph/view2D/process2d.c.pamphlet | 958 | ||||
-rw-r--r-- | src/graph/view2D/spadAction2d.c (renamed from src/graph/view2D/spadAction2d.c.pamphlet) | 90 | ||||
-rw-r--r-- | src/graph/view2D/stuff2d.c | 125 | ||||
-rw-r--r-- | src/graph/view2D/stuff2d.c.pamphlet | 145 | ||||
-rw-r--r-- | src/graph/view2D/viewport2D.c (renamed from src/graph/view2D/viewport2D.c.pamphlet) | 570 | ||||
-rw-r--r-- | src/graph/view2D/write2d.c (renamed from src/graph/view2D/write2d.c.pamphlet) | 110 |
17 files changed, 2564 insertions, 2768 deletions
diff --git a/src/graph/view2D/Makefile.in b/src/graph/view2D/Makefile.in index dcff96f4..905d8179 100644 --- a/src/graph/view2D/Makefile.in +++ b/src/graph/view2D/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2007, Gabriel Dos Reis. +# Copyright (C) 2007-2008, Gabriel Dos Reis. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -41,12 +41,10 @@ build_libdir = $(abs_top_builddir)/src/lib bin_PROGRAMS = view2D$(EXEEXT) -view2D_sources = buttons2d.c control2d.c graph2d.c main2d.c pot2d.c \ +view2D_SOURCES = buttons2d.c control2d.c graph2d.c main2d.c pot2d.c \ process2d.c spadAction2d.c stuff2d.c viewport2D.c write2d.c -view2D_SOURCES = $(addsuffix .pamphlet, $(view2D_sources)) - -view2D_objects = $(view2D_sources:.c=.lo) +view2D_objects = $(view2D_SOURCES:.c=.lo) Gfun_objects = ../Gdraws/Gfun.lo @@ -56,8 +54,6 @@ view2D_DEPENDENCIES = $(Gfun_objects) subdir = src/graph/view2D/ -pamphlets = Makefile.pamphlet $(view2D_SOURCES) - AXIOM_CFLAGS = ${CCF} ${AXIOM_X11_CFLAGS} -I${LINC} -I${GINC} -I$(srcdir) \ $(axiom_includes) @@ -81,7 +77,6 @@ $(axiom_target_libdir)/view2D$(EXEEXT): $(view2D_objects) $(view2D_DEPENDENCIES) $(LINK) -o $@ $(view2D_objects) $(Gfun_objects) \ $(view2D_LDADD) $(AXIOM_X11_LDFLAGS) -lm -.PRECIOUS: %.c .PRECIOUS: %.lo %.$(OBJEXT): $(HEADERS) @@ -89,13 +84,10 @@ $(axiom_target_libdir)/view2D$(EXEEXT): $(view2D_objects) $(view2D_DEPENDENCIES) %.lo: $(builddir)/%.c $(axiom_c_macros.h) $(COMPILE) -o $@ $(CFLAGS) $(AXIOM_CFLAGS) $< -%.c: $(srcdir)/%.c.pamphlet - $(axiom_build_document) --tangle --output=$@ $< - mostlyclean-local: clean-local: mostlyclean-local - @rm -f $(view2D_sources) $(view2D_objects) + @rm -f $(view2D_objects) @rm -f $(axiom_target_libdir)/view2D$(EXEEXT) distclean-local: clean-local diff --git a/src/graph/view2D/buttons2d.c b/src/graph/view2D/buttons2d.c new file mode 100644 index 00000000..3d7a4be6 --- /dev/null +++ b/src/graph/view2D/buttons2d.c @@ -0,0 +1,718 @@ +/* + Copyright (C) 1991-2002, The Numerical ALgorithms Group Ltd. + All rights reserved. + Copyright (C) 2007-2008, Gabriel Dos Reis. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of The Numerical ALgorithms Group Ltd. nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#define _BUTTONS2D_C +#include "axiom-c-macros.h" + +#include <string.h> + +#include "header2.h" +#include "buttons2d.H1" +#include "all_2d.H1" + + + + +#define bColor 98 +#define graphColor 138 + +/***************************************************** + * int initButtons(buttons) * + * * + * Creates the fields for each button window in the * + * two dimensional control panel, and returns the * + * number of buttons created. * + * * + *****************************************************/ + +int +#ifdef _NO_PROTO +initButtons (buttons) +buttonStruct *buttons; +#else +initButtons (buttonStruct *buttons) +#endif +{ + int ii, num = 0; + +/********** Scale(Zoom) and Translate Potentiometer Buttons **********/ + + /* Title: "Scale" */ + ii = scale2D; + buttons[ii].buttonX = 5; + buttons[ii].buttonY = 85; + buttons[ii].buttonWidth = 110; + buttons[ii].buttonHeight = 80; + buttons[ii].buttonKey = ii; + buttons[ii].pot = yes; /* scale is a potentiometer */ + buttons[ii].graphNum = no; + buttons[ii].graphSelect = no; + buttons[ii].mask = potMASK; + buttons[ii].textColor = 164; + buttons[ii].xHalf = buttons[ii].buttonWidth/2; + buttons[ii].yHalf = buttons[ii].buttonHeight/2; + ++num; + + /* Title: "Translate" */ + ii = translate2D; + buttons[ii].buttonX = 121; + buttons[ii].buttonY = 85; + buttons[ii].buttonWidth = 110; + buttons[ii].buttonHeight = 80; + buttons[ii].buttonKey = ii; + buttons[ii].pot = yes; /* translate is a potentiometer */ + buttons[ii].graphNum = no; + buttons[ii].graphSelect = no; + buttons[ii].mask = potMASK; + buttons[ii].textColor = 21; /* line color of translate arrow */ + buttons[ii].xHalf = buttons[ii].buttonWidth/2; + buttons[ii].yHalf = buttons[ii].buttonHeight/2; + ++num; + + /* Scale potentiometer buttons */ + + /* Scale along X axis */ + ii = zoom2Dx; + buttons[ii].buttonX = 5; + buttons[ii].buttonY = 55; + buttons[ii].buttonWidth = 53; + buttons[ii].buttonHeight = 25; + buttons[ii].buttonKey = ii; + buttons[ii].pot = no; + buttons[ii].graphNum = no; + buttons[ii].graphSelect = no; + buttons[ii].mask = buttonMASK; + strcpy(buttons[ii].text,"X On "); + buttons[ii].textColor = bColor; + buttons[ii].xHalf = buttons[ii].buttonWidth/2; + buttons[ii].yHalf = buttons[ii].buttonHeight/2; + ++num; + + + /* Scale along Y axis */ + ii = zoom2Dy; + buttons[ii].buttonX = 62; + buttons[ii].buttonY = 55; + buttons[ii].buttonWidth = 53; + buttons[ii].buttonHeight = 25; + buttons[ii].buttonKey = ii; + buttons[ii].pot = no; + buttons[ii].graphNum = no; + buttons[ii].graphSelect = no; + buttons[ii].mask = buttonMASK; + strcpy(buttons[ii].text,"Y On "); + buttons[ii].textColor = bColor; + buttons[ii].xHalf = buttons[ii].buttonWidth/2; + buttons[ii].yHalf = buttons[ii].buttonHeight/2; + ++num; + + /* Translate along X axis */ + ii = translate2Dx; + buttons[ii].buttonX = 121; + buttons[ii].buttonY = 55; + buttons[ii].buttonWidth = 53; + buttons[ii].buttonHeight = 25; + buttons[ii].buttonKey = ii; + buttons[ii].pot = no; + buttons[ii].graphNum = no; + buttons[ii].graphSelect = no; + buttons[ii].mask = buttonMASK; + strcpy(buttons[ii].text,"X On "); + buttons[ii].textColor = bColor; + buttons[ii].xHalf = buttons[ii].buttonWidth/2; + buttons[ii].yHalf = buttons[ii].buttonHeight/2; + ++num; + + + /* Translate along Y axis */ + ii = translate2Dy; + buttons[ii].buttonX = 179; + buttons[ii].buttonY = 55; + buttons[ii].buttonWidth = 53; + buttons[ii].buttonHeight = 25; + buttons[ii].buttonKey = ii; + buttons[ii].pot = no; + buttons[ii].graphNum = no; + buttons[ii].graphSelect = no; + buttons[ii].mask = buttonMASK; + strcpy(buttons[ii].text,"Y On "); + buttons[ii].textColor = bColor; + buttons[ii].xHalf = buttons[ii].buttonWidth/2; + buttons[ii].yHalf = buttons[ii].buttonHeight/2; + ++num; + + + /* Axes Turned On/Off */ + ii = axesOnOff2D; + buttons[ii].buttonX = 5; + buttons[ii].buttonY = 292; + buttons[ii].buttonWidth = 90; + buttons[ii].buttonHeight = 30; + buttons[ii].buttonKey = ii; + buttons[ii].pot = no; + buttons[ii].graphNum = no; + buttons[ii].graphSelect = no; + buttons[ii].mask = buttonMASK; + strcpy(buttons[ii].text,"Axes On "); + buttons[ii].textColor = 75; + buttons[ii].textHue = 10; + buttons[ii].textShade = 3; + buttons[ii].xHalf = buttons[ii].buttonWidth/2; + buttons[ii].yHalf = buttons[ii].buttonHeight/2; + ++num; + + /* Units Turned On/Off */ + ii = unitsOnOff2D; + buttons[ii].buttonX = 100; + buttons[ii].buttonY = 292; + buttons[ii].buttonWidth = 90; + buttons[ii].buttonHeight = 30; + buttons[ii].buttonKey = ii; + buttons[ii].pot = no; + buttons[ii].graphNum = no; + buttons[ii].graphSelect = no; + buttons[ii].mask = buttonMASK; + strcpy(buttons[ii].text,"Units Off"); + buttons[ii].textColor = 75; + buttons[ii].textHue = 10; + buttons[ii].textShade = 3; + buttons[ii].xHalf = buttons[ii].buttonWidth/2; + buttons[ii].yHalf = buttons[ii].buttonHeight/2; + ++num; + + /* Generate a Postscript file */ + ii = ps2D; + buttons[ii].buttonX = 195; + buttons[ii].buttonY = 292; + buttons[ii].buttonWidth = 36; + buttons[ii].buttonHeight = 30; + buttons[ii].buttonKey = ii; + buttons[ii].pot = no; + buttons[ii].graphNum = no; + buttons[ii].graphSelect = no; + buttons[ii].mask = buttonMASK; + strcpy(buttons[ii].text,"PS"); + buttons[ii].textColor = 35; + buttons[ii].textHue = 5; + buttons[ii].textShade = 2; + buttons[ii].xHalf = buttons[ii].buttonWidth/2; + buttons[ii].yHalf = buttons[ii].buttonHeight/2; + ++num; + + /* Bounding Rectangle On/Off */ + ii = spline2D; + buttons[ii].buttonX = 5; + buttons[ii].buttonY = 329; + buttons[ii].buttonWidth = 66; + buttons[ii].buttonHeight = 30; + buttons[ii].buttonKey = ii; + buttons[ii].pot = no; + buttons[ii].graphNum = no; + buttons[ii].graphSelect = no; + buttons[ii].mask = buttonMASK; + strcpy(buttons[ii].text,"Box Off"); + buttons[ii].textColor = 7; + buttons[ii].textHue = 26; + buttons[ii].textShade = 3; + buttons[ii].xHalf = buttons[ii].buttonWidth/2; + buttons[ii].yHalf = buttons[ii].buttonHeight/2; + ++num; + + /* Graph points On/Off */ + ii = pointsOnOff; + buttons[ii].buttonX = 75; + buttons[ii].buttonY = 329; + buttons[ii].buttonWidth = 67; + buttons[ii].buttonHeight = 30; + buttons[ii].buttonKey = ii; + buttons[ii].pot = no; + buttons[ii].graphNum = no; + buttons[ii].graphSelect = no; + buttons[ii].mask = buttonMASK; + strcpy(buttons[ii].text,"Pts On "); + buttons[ii].textColor = 7; + buttons[ii].textHue = 26; + buttons[ii].textShade = 3; + buttons[ii].xHalf = buttons[ii].buttonWidth/2; + buttons[ii].yHalf = buttons[ii].buttonHeight/2; + ++num; + + /* Graph lines On/Off */ + ii = connectOnOff; + buttons[ii].buttonX = 147; + buttons[ii].buttonY = 329; + buttons[ii].buttonWidth = 84; + buttons[ii].buttonHeight = 30; + buttons[ii].buttonKey = ii; + buttons[ii].pot = no; + buttons[ii].graphNum = no; + buttons[ii].graphSelect = no; + buttons[ii].mask = buttonMASK; + strcpy(buttons[ii].text,"Lines On "); + buttons[ii].textColor = 7; + buttons[ii].textHue = 26; + buttons[ii].textShade = 3; + buttons[ii].xHalf = buttons[ii].buttonWidth/2; + buttons[ii].yHalf = buttons[ii].buttonHeight/2; + ++num; + + /* Reset View Position Button */ + ii = reset2D; + buttons[ii].buttonX = 5; + buttons[ii].buttonY = 364; + buttons[ii].buttonWidth = 60; + buttons[ii].buttonHeight = 30; + buttons[ii].buttonKey = ii; + buttons[ii].pot = no; + buttons[ii].graphNum = no; + buttons[ii].graphSelect = no; + buttons[ii].mask = buttonMASK; + strcpy(buttons[ii].text,"Reset"); + buttons[ii].textColor = bColor; + buttons[ii].textHue = 5; + buttons[ii].textShade = 2; + buttons[ii].xHalf = buttons[ii].buttonWidth/2; + buttons[ii].yHalf = buttons[ii].buttonHeight/2; + ++num; + + /* Hide Control Panel */ + ii = hideControl2D; + buttons[ii].buttonX = 70; + buttons[ii].buttonY = 364; + buttons[ii].buttonWidth = 88; + buttons[ii].buttonHeight = 30; + buttons[ii].buttonKey = ii; + buttons[ii].pot = no; + buttons[ii].graphNum = no; + buttons[ii].graphSelect = no; + buttons[ii].mask = buttonMASK; + strcpy(buttons[ii].text,"Hide Panel"); + buttons[ii].textColor = bColor; + buttons[ii].textHue = 5; + buttons[ii].textShade = 2; + buttons[ii].xHalf = buttons[ii].buttonWidth/2; + buttons[ii].yHalf = buttons[ii].buttonHeight/2; + ++num; + + /* Exits from the viewport running */ + ii = closeAll2D; + buttons[ii].buttonX = 169; + buttons[ii].buttonY = 370; + buttons[ii].buttonWidth = 61; + buttons[ii].buttonHeight = 24; + buttons[ii].buttonKey = ii; + buttons[ii].pot = no; + buttons[ii].graphNum = no; + buttons[ii].graphSelect = no; + buttons[ii].mask = buttonMASK; + strcpy(buttons[ii].text,"Quit"); + buttons[ii].textColor = 13; + buttons[ii].textHue = 29; + buttons[ii].textShade = 2; + buttons[ii].xHalf = buttons[ii].buttonWidth/2; + buttons[ii].yHalf = buttons[ii].buttonHeight/2; + ++num; + + /* Indicates that the graph from a viewport is to be picked up. */ + ii = pick2D; + buttons[ii].buttonX = 190; + buttons[ii].buttonY = 217; + buttons[ii].buttonWidth = 40; + buttons[ii].buttonHeight = 24; + buttons[ii].buttonKey = ii; + buttons[ii].pot = no; + buttons[ii].graphNum = no; + buttons[ii].graphSelect = no; + buttons[ii].mask = buttonMASK; + strcpy(buttons[ii].text,"Pick"); + buttons[ii].textColor = 123; + buttons[ii].textHue = 19; + buttons[ii].textShade = 3; + buttons[ii].xHalf = buttons[ii].buttonWidth/2; + buttons[ii].yHalf = buttons[ii].buttonHeight/2; + ++num; + + /* Indicates that the graph from a viewport is to be dropped into a slot. */ + ii = drop2D; + buttons[ii].buttonX = 190; + buttons[ii].buttonY = 245; + buttons[ii].buttonWidth = 40; + buttons[ii].buttonHeight = 24; + buttons[ii].buttonKey = ii; + buttons[ii].pot = no; + buttons[ii].graphNum = no; + buttons[ii].graphSelect = no; + buttons[ii].mask = buttonMASK; + strcpy(buttons[ii].text,"Drop"); + buttons[ii].textColor = 123; + buttons[ii].textHue = 19; + buttons[ii].textShade = 3; + buttons[ii].xHalf = buttons[ii].buttonWidth/2; + buttons[ii].yHalf = buttons[ii].buttonHeight/2; + ++num; + + /* Indicates that the status of the graphs being displayed in the viewport + is to be cleared. */ + ii = clear2D; + buttons[ii].buttonX = 5; + buttons[ii].buttonY = 217; + buttons[ii].buttonWidth = 49; + buttons[ii].buttonHeight = 24; + buttons[ii].buttonKey = ii; + buttons[ii].pot = no; + buttons[ii].graphNum = no; + buttons[ii].graphSelect = no; + buttons[ii].mask = buttonMASK; + strcpy(buttons[ii].text,"Clear"); + buttons[ii].textColor = 123; + buttons[ii].textHue = 19; + buttons[ii].textShade = 3; + buttons[ii].xHalf = buttons[ii].buttonWidth/2; + buttons[ii].yHalf = buttons[ii].buttonHeight/2; + ++num; + + /* Asks for the scale and translation information for the specified graph. */ + ii = query2D; + buttons[ii].buttonX = 5; + buttons[ii].buttonY = 245; + buttons[ii].buttonWidth = 49; + buttons[ii].buttonHeight = 24; + buttons[ii].buttonKey = ii; + buttons[ii].pot = no; + buttons[ii].graphNum = no; + buttons[ii].graphSelect = no; + buttons[ii].mask = buttonMASK; + strcpy(buttons[ii].text,"Query"); + buttons[ii].textColor = 123; + buttons[ii].textHue = 19; + buttons[ii].textShade = 3; + buttons[ii].xHalf = buttons[ii].buttonWidth/2; + buttons[ii].yHalf = buttons[ii].buttonHeight/2; + ++num; + + /* These buttons indicate the 9 available slot numbers into which + a 2D graph can be placed, and the status of the graph, i.e. whether + it is displayed or not. */ + + ii = graph1; + buttons[ii].buttonX = graphBarLeft; + buttons[ii].buttonY = graphBarTop; + buttons[ii].buttonWidth = graphBarWidth; + buttons[ii].buttonHeight = graphBarHeight; + buttons[ii].buttonKey = ii; + buttons[ii].pot = no; + buttons[ii].graphNum = yes; + buttons[ii].graphSelect = no; + buttons[ii].mask = buttonMASK; + strcpy(buttons[ii].text,"1"); + buttons[ii].textColor = graphColor; + buttons[ii].xHalf = buttons[ii].buttonWidth/2; + buttons[ii].yHalf = buttons[ii].buttonHeight/2; + ++num; + + ii = graphSelect1; + buttons[ii].buttonX = graphBarLeft; + buttons[ii].buttonY = graphBarTop + graphBarHeight; + buttons[ii].buttonWidth = graphBarWidth; + buttons[ii].buttonHeight = graphBarHeight-2; + buttons[ii].buttonKey = ii; + buttons[ii].pot = no; /* this is a regular button */ + buttons[ii].graphNum = no; + buttons[ii].graphSelect = yes; + buttons[ii].mask = buttonMASK; + strcpy(buttons[ii].text,"^"); + buttons[ii].textColor = graphColor; + buttons[ii].xHalf = buttons[ii].buttonWidth/2; + buttons[ii].yHalf = buttons[ii].buttonHeight/2; + ++num; + + ii = graph2; + buttons[ii].buttonX = graphBarLeft + (graphBarWidth); + buttons[ii].buttonY = graphBarTop; + buttons[ii].buttonWidth = graphBarWidth; + buttons[ii].buttonHeight = graphBarHeight; + buttons[ii].buttonKey = ii; + buttons[ii].pot = no; /* this is a regular button */ + buttons[ii].graphNum = yes; + buttons[ii].graphSelect = no; + buttons[ii].mask = buttonMASK; + strcpy(buttons[ii].text,"2"); + buttons[ii].textColor = graphColor; + buttons[ii].xHalf = buttons[ii].buttonWidth/2; + buttons[ii].yHalf = buttons[ii].buttonHeight/2; + ++num; + + ii = graphSelect2; + buttons[ii].buttonX = graphBarLeft + (graphBarWidth); + buttons[ii].buttonY = graphBarTop + graphBarHeight; + buttons[ii].buttonWidth = graphBarWidth; + buttons[ii].buttonHeight = graphBarHeight-2; + buttons[ii].buttonKey = ii; + buttons[ii].pot = no; /* this is a regular button */ + buttons[ii].graphNum = no; + buttons[ii].graphSelect = yes; + buttons[ii].mask = buttonMASK; + strcpy(buttons[ii].text,"-"); + buttons[ii].textColor = graphColor; + buttons[ii].xHalf = buttons[ii].buttonWidth/2; + buttons[ii].yHalf = buttons[ii].buttonHeight/2; + ++num; + + ii = graph3; + buttons[ii].buttonX = graphBarLeft + 2*(graphBarWidth); + buttons[ii].buttonY = graphBarTop; + buttons[ii].buttonWidth = graphBarWidth; + buttons[ii].buttonHeight = graphBarHeight; + buttons[ii].buttonKey = ii; + buttons[ii].pot = no; /* this is a regular button */ + buttons[ii].graphNum = yes; + buttons[ii].graphSelect = no; + buttons[ii].mask = buttonMASK; + strcpy(buttons[ii].text,"3"); + buttons[ii].textColor = graphColor; + buttons[ii].xHalf = buttons[ii].buttonWidth/2; + buttons[ii].yHalf = buttons[ii].buttonHeight/2; + ++num; + + ii = graphSelect3; + buttons[ii].buttonX = graphBarLeft + 2*(graphBarWidth); + buttons[ii].buttonY = graphBarTop + graphBarHeight; + buttons[ii].buttonWidth = graphBarWidth; + buttons[ii].buttonHeight = graphBarHeight-2; + buttons[ii].buttonKey = ii; + buttons[ii].pot = no; /**** blend these three together ***/ + buttons[ii].graphNum = no; + buttons[ii].graphSelect = yes; + buttons[ii].mask = buttonMASK; + strcpy(buttons[ii].text,"-"); + buttons[ii].textColor = graphColor; + buttons[ii].xHalf = buttons[ii].buttonWidth/2; + buttons[ii].yHalf = buttons[ii].buttonHeight/2; + ++num; + + ii = graph4; + buttons[ii].buttonX = graphBarLeft + 3*(graphBarWidth); + buttons[ii].buttonY = graphBarTop; + buttons[ii].buttonWidth = graphBarWidth; + buttons[ii].buttonHeight = graphBarHeight; + buttons[ii].buttonKey = ii; + buttons[ii].pot = no; /* this is a regular button */ + buttons[ii].graphNum = yes; + buttons[ii].graphSelect = no; + buttons[ii].mask = buttonMASK; + strcpy(buttons[ii].text,"4"); + buttons[ii].textColor = graphColor; + buttons[ii].xHalf = buttons[ii].buttonWidth/2; + buttons[ii].yHalf = buttons[ii].buttonHeight/2; + ++num; + + ii = graphSelect4; + buttons[ii].buttonX = graphBarLeft + 3*(graphBarWidth); + buttons[ii].buttonY = graphBarTop + graphBarHeight; + buttons[ii].buttonWidth = graphBarWidth; + buttons[ii].buttonHeight = graphBarHeight-2; + buttons[ii].buttonKey = ii; + buttons[ii].pot = no; /* this is a regular button */ + buttons[ii].graphNum = no; + buttons[ii].graphSelect = yes; + buttons[ii].mask = buttonMASK; + strcpy(buttons[ii].text,"-"); + buttons[ii].textColor = graphColor; + buttons[ii].xHalf = buttons[ii].buttonWidth/2; + buttons[ii].yHalf = buttons[ii].buttonHeight/2; + ++num; + + ii = graph5; + buttons[ii].buttonX = graphBarLeft + 4*(graphBarWidth); + buttons[ii].buttonY = graphBarTop; + buttons[ii].buttonWidth = graphBarWidth; + buttons[ii].buttonHeight = graphBarHeight; + buttons[ii].buttonKey = ii; + buttons[ii].pot = no; /* this is a regular button */ + buttons[ii].graphNum = yes; + buttons[ii].graphSelect = no; + buttons[ii].mask = buttonMASK; + strcpy(buttons[ii].text,"5"); + buttons[ii].textColor = graphColor; + buttons[ii].xHalf = buttons[ii].buttonWidth/2; + buttons[ii].yHalf = buttons[ii].buttonHeight/2; + ++num; + + ii = graphSelect5; + buttons[ii].buttonX = graphBarLeft + 4*(graphBarWidth); + buttons[ii].buttonY = graphBarTop + graphBarHeight; + buttons[ii].buttonWidth = graphBarWidth; + buttons[ii].buttonHeight = graphBarHeight-2; + buttons[ii].buttonKey = ii; + buttons[ii].pot = no; /* this is a regular button */ + buttons[ii].graphNum = no; + buttons[ii].graphSelect = yes; + buttons[ii].mask = buttonMASK; + strcpy(buttons[ii].text,"-"); + buttons[ii].textColor = graphColor; + buttons[ii].xHalf = buttons[ii].buttonWidth/2; + buttons[ii].yHalf = buttons[ii].buttonHeight/2; + ++num; + + ii = graph6; + buttons[ii].buttonX = graphBarLeft + 5*(graphBarWidth); + buttons[ii].buttonY = graphBarTop; + buttons[ii].buttonWidth = graphBarWidth; + buttons[ii].buttonHeight = graphBarHeight; + buttons[ii].buttonKey = ii; + buttons[ii].pot = no; /* this is a regular button */ + buttons[ii].graphNum = yes; + buttons[ii].graphSelect = no; + buttons[ii].mask = buttonMASK; + strcpy(buttons[ii].text,"6"); + buttons[ii].textColor = graphColor; + buttons[ii].xHalf = buttons[ii].buttonWidth/2; + buttons[ii].yHalf = buttons[ii].buttonHeight/2; + ++num; + + ii = graphSelect6; + buttons[ii].buttonX = graphBarLeft + 5*(graphBarWidth); + buttons[ii].buttonY = graphBarTop + graphBarHeight; + buttons[ii].buttonWidth = graphBarWidth; + buttons[ii].buttonHeight = graphBarHeight-2; + buttons[ii].buttonKey = ii; + buttons[ii].pot = no; /* this is a regular button */ + buttons[ii].graphNum = no; + buttons[ii].graphSelect = yes; + buttons[ii].mask = buttonMASK; + strcpy(buttons[ii].text,"-"); + buttons[ii].textColor = graphColor; + buttons[ii].xHalf = buttons[ii].buttonWidth/2; + buttons[ii].yHalf = buttons[ii].buttonHeight/2; + ++num; + + ii = graph7; + buttons[ii].buttonX = graphBarLeft + 6*(graphBarWidth); + buttons[ii].buttonY = graphBarTop; + buttons[ii].buttonWidth = graphBarWidth; + buttons[ii].buttonHeight = graphBarHeight; + buttons[ii].buttonKey = ii; + buttons[ii].pot = no; /* this is a regular button */ + buttons[ii].graphNum = yes; + buttons[ii].graphSelect = no; + buttons[ii].mask = buttonMASK; + strcpy(buttons[ii].text,"7"); + buttons[ii].textColor = graphColor; + buttons[ii].xHalf = buttons[ii].buttonWidth/2; + buttons[ii].yHalf = buttons[ii].buttonHeight/2; + ++num; + + ii = graphSelect7; + buttons[ii].buttonX = graphBarLeft + 6*(graphBarWidth); + buttons[ii].buttonY = graphBarTop + graphBarHeight; + buttons[ii].buttonWidth = graphBarWidth; + buttons[ii].buttonHeight = graphBarHeight-2; + buttons[ii].buttonKey = ii; + buttons[ii].pot = no; /* this is a regular button */ + buttons[ii].graphNum = no; + buttons[ii].graphSelect = yes; + buttons[ii].mask = buttonMASK; + strcpy(buttons[ii].text,"-"); + buttons[ii].textColor = graphColor; + buttons[ii].xHalf = buttons[ii].buttonWidth/2; + buttons[ii].yHalf = buttons[ii].buttonHeight/2; + ++num; + + ii = graph8; + buttons[ii].buttonX = graphBarLeft + 7*(graphBarWidth); + buttons[ii].buttonY = graphBarTop; + buttons[ii].buttonWidth = graphBarWidth; + buttons[ii].buttonHeight = graphBarHeight; + buttons[ii].buttonKey = ii; + buttons[ii].pot = no; /* this is a regular button */ + buttons[ii].graphNum = yes; + buttons[ii].graphSelect = no; + buttons[ii].mask = buttonMASK; + strcpy(buttons[ii].text,"8"); + buttons[ii].textColor = graphColor; + buttons[ii].xHalf = buttons[ii].buttonWidth/2; + buttons[ii].yHalf = buttons[ii].buttonHeight/2; + ++num; + + ii = graphSelect8; + buttons[ii].buttonX = graphBarLeft + 7*(graphBarWidth); + buttons[ii].buttonY = graphBarTop + graphBarHeight; + buttons[ii].buttonWidth = graphBarWidth; + buttons[ii].buttonHeight = graphBarHeight-2; + buttons[ii].buttonKey = ii; + buttons[ii].pot = no; /* this is a regular button */ + buttons[ii].graphNum = no; + buttons[ii].graphSelect = yes; + buttons[ii].mask = buttonMASK; + strcpy(buttons[ii].text,"-"); + buttons[ii].textColor = graphColor; + buttons[ii].xHalf = buttons[ii].buttonWidth/2; + buttons[ii].yHalf = buttons[ii].buttonHeight/2; + ++num; + + ii = graph9; + buttons[ii].buttonX = graphBarLeft + 8*(graphBarWidth); + buttons[ii].buttonY = graphBarTop; + buttons[ii].buttonWidth = graphBarWidth; + buttons[ii].buttonHeight = graphBarHeight; + buttons[ii].buttonKey = ii; + buttons[ii].pot = no; /* this is a regular button */ + buttons[ii].graphNum = yes; + buttons[ii].graphSelect = no; + buttons[ii].mask = buttonMASK; + strcpy(buttons[ii].text,"9"); + buttons[ii].textColor = graphColor; + buttons[ii].xHalf = buttons[ii].buttonWidth/2; + buttons[ii].yHalf = buttons[ii].buttonHeight/2; + ++num; + + ii = graphSelect9; + buttons[ii].buttonX = graphBarLeft + 8*(graphBarWidth); + buttons[ii].buttonY = graphBarTop + graphBarHeight; + buttons[ii].buttonWidth = graphBarWidth; + buttons[ii].buttonHeight = graphBarHeight-2; + buttons[ii].buttonKey = ii; + buttons[ii].pot = no; /* this is a regular button */ + buttons[ii].graphNum = no; + buttons[ii].graphSelect = yes; + buttons[ii].mask = buttonMASK; + strcpy(buttons[ii].text,"*"); + buttons[ii].textColor = graphColor; + buttons[ii].xHalf = buttons[ii].buttonWidth/2; + buttons[ii].yHalf = buttons[ii].buttonHeight/2; + ++num; + + return(num); +} diff --git a/src/graph/view2D/buttons2d.c.pamphlet b/src/graph/view2D/buttons2d.c.pamphlet deleted file mode 100644 index c0c19185..00000000 --- a/src/graph/view2D/buttons2d.c.pamphlet +++ /dev/null @@ -1,738 +0,0 @@ -\documentclass{article} -\usepackage{axiom} -\begin{document} -\title{\$SPAD/src/graph/view2D buttons2d.c} -\author{The Axiom Team} -\maketitle -\begin{abstract} -\end{abstract} -\eject -\tableofcontents -\eject -\section{License} -<<license>>= -/* -Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - - Neither the name of The Numerical ALgorithms Group Ltd. nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER -OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -@ -<<*>>= -<<license>> - -#define _BUTTONS2D_C -#include "axiom-c-macros.h" - -#include <string.h> - -#include "header2.h" -#include "buttons2d.H1" -#include "all_2d.H1" - - - - -#define bColor 98 -#define graphColor 138 - -/***************************************************** - * int initButtons(buttons) * - * * - * Creates the fields for each button window in the * - * two dimensional control panel, and returns the * - * number of buttons created. * - * * - *****************************************************/ - -int -#ifdef _NO_PROTO -initButtons (buttons) -buttonStruct *buttons; -#else -initButtons (buttonStruct *buttons) -#endif -{ - int ii, num = 0; - -/********** Scale(Zoom) and Translate Potentiometer Buttons **********/ - - /* Title: "Scale" */ - ii = scale2D; - buttons[ii].buttonX = 5; - buttons[ii].buttonY = 85; - buttons[ii].buttonWidth = 110; - buttons[ii].buttonHeight = 80; - buttons[ii].buttonKey = ii; - buttons[ii].pot = yes; /* scale is a potentiometer */ - buttons[ii].graphNum = no; - buttons[ii].graphSelect = no; - buttons[ii].mask = potMASK; - buttons[ii].textColor = 164; - buttons[ii].xHalf = buttons[ii].buttonWidth/2; - buttons[ii].yHalf = buttons[ii].buttonHeight/2; - ++num; - - /* Title: "Translate" */ - ii = translate2D; - buttons[ii].buttonX = 121; - buttons[ii].buttonY = 85; - buttons[ii].buttonWidth = 110; - buttons[ii].buttonHeight = 80; - buttons[ii].buttonKey = ii; - buttons[ii].pot = yes; /* translate is a potentiometer */ - buttons[ii].graphNum = no; - buttons[ii].graphSelect = no; - buttons[ii].mask = potMASK; - buttons[ii].textColor = 21; /* line color of translate arrow */ - buttons[ii].xHalf = buttons[ii].buttonWidth/2; - buttons[ii].yHalf = buttons[ii].buttonHeight/2; - ++num; - - /* Scale potentiometer buttons */ - - /* Scale along X axis */ - ii = zoom2Dx; - buttons[ii].buttonX = 5; - buttons[ii].buttonY = 55; - buttons[ii].buttonWidth = 53; - buttons[ii].buttonHeight = 25; - buttons[ii].buttonKey = ii; - buttons[ii].pot = no; - buttons[ii].graphNum = no; - buttons[ii].graphSelect = no; - buttons[ii].mask = buttonMASK; - strcpy(buttons[ii].text,"X On "); - buttons[ii].textColor = bColor; - buttons[ii].xHalf = buttons[ii].buttonWidth/2; - buttons[ii].yHalf = buttons[ii].buttonHeight/2; - ++num; - - - /* Scale along Y axis */ - ii = zoom2Dy; - buttons[ii].buttonX = 62; - buttons[ii].buttonY = 55; - buttons[ii].buttonWidth = 53; - buttons[ii].buttonHeight = 25; - buttons[ii].buttonKey = ii; - buttons[ii].pot = no; - buttons[ii].graphNum = no; - buttons[ii].graphSelect = no; - buttons[ii].mask = buttonMASK; - strcpy(buttons[ii].text,"Y On "); - buttons[ii].textColor = bColor; - buttons[ii].xHalf = buttons[ii].buttonWidth/2; - buttons[ii].yHalf = buttons[ii].buttonHeight/2; - ++num; - - /* Translate along X axis */ - ii = translate2Dx; - buttons[ii].buttonX = 121; - buttons[ii].buttonY = 55; - buttons[ii].buttonWidth = 53; - buttons[ii].buttonHeight = 25; - buttons[ii].buttonKey = ii; - buttons[ii].pot = no; - buttons[ii].graphNum = no; - buttons[ii].graphSelect = no; - buttons[ii].mask = buttonMASK; - strcpy(buttons[ii].text,"X On "); - buttons[ii].textColor = bColor; - buttons[ii].xHalf = buttons[ii].buttonWidth/2; - buttons[ii].yHalf = buttons[ii].buttonHeight/2; - ++num; - - - /* Translate along Y axis */ - ii = translate2Dy; - buttons[ii].buttonX = 179; - buttons[ii].buttonY = 55; - buttons[ii].buttonWidth = 53; - buttons[ii].buttonHeight = 25; - buttons[ii].buttonKey = ii; - buttons[ii].pot = no; - buttons[ii].graphNum = no; - buttons[ii].graphSelect = no; - buttons[ii].mask = buttonMASK; - strcpy(buttons[ii].text,"Y On "); - buttons[ii].textColor = bColor; - buttons[ii].xHalf = buttons[ii].buttonWidth/2; - buttons[ii].yHalf = buttons[ii].buttonHeight/2; - ++num; - - - /* Axes Turned On/Off */ - ii = axesOnOff2D; - buttons[ii].buttonX = 5; - buttons[ii].buttonY = 292; - buttons[ii].buttonWidth = 90; - buttons[ii].buttonHeight = 30; - buttons[ii].buttonKey = ii; - buttons[ii].pot = no; - buttons[ii].graphNum = no; - buttons[ii].graphSelect = no; - buttons[ii].mask = buttonMASK; - strcpy(buttons[ii].text,"Axes On "); - buttons[ii].textColor = 75; - buttons[ii].textHue = 10; - buttons[ii].textShade = 3; - buttons[ii].xHalf = buttons[ii].buttonWidth/2; - buttons[ii].yHalf = buttons[ii].buttonHeight/2; - ++num; - - /* Units Turned On/Off */ - ii = unitsOnOff2D; - buttons[ii].buttonX = 100; - buttons[ii].buttonY = 292; - buttons[ii].buttonWidth = 90; - buttons[ii].buttonHeight = 30; - buttons[ii].buttonKey = ii; - buttons[ii].pot = no; - buttons[ii].graphNum = no; - buttons[ii].graphSelect = no; - buttons[ii].mask = buttonMASK; - strcpy(buttons[ii].text,"Units Off"); - buttons[ii].textColor = 75; - buttons[ii].textHue = 10; - buttons[ii].textShade = 3; - buttons[ii].xHalf = buttons[ii].buttonWidth/2; - buttons[ii].yHalf = buttons[ii].buttonHeight/2; - ++num; - - /* Generate a Postscript file */ - ii = ps2D; - buttons[ii].buttonX = 195; - buttons[ii].buttonY = 292; - buttons[ii].buttonWidth = 36; - buttons[ii].buttonHeight = 30; - buttons[ii].buttonKey = ii; - buttons[ii].pot = no; - buttons[ii].graphNum = no; - buttons[ii].graphSelect = no; - buttons[ii].mask = buttonMASK; - strcpy(buttons[ii].text,"PS"); - buttons[ii].textColor = 35; - buttons[ii].textHue = 5; - buttons[ii].textShade = 2; - buttons[ii].xHalf = buttons[ii].buttonWidth/2; - buttons[ii].yHalf = buttons[ii].buttonHeight/2; - ++num; - - /* Bounding Rectangle On/Off */ - ii = spline2D; - buttons[ii].buttonX = 5; - buttons[ii].buttonY = 329; - buttons[ii].buttonWidth = 66; - buttons[ii].buttonHeight = 30; - buttons[ii].buttonKey = ii; - buttons[ii].pot = no; - buttons[ii].graphNum = no; - buttons[ii].graphSelect = no; - buttons[ii].mask = buttonMASK; - strcpy(buttons[ii].text,"Box Off"); - buttons[ii].textColor = 7; - buttons[ii].textHue = 26; - buttons[ii].textShade = 3; - buttons[ii].xHalf = buttons[ii].buttonWidth/2; - buttons[ii].yHalf = buttons[ii].buttonHeight/2; - ++num; - - /* Graph points On/Off */ - ii = pointsOnOff; - buttons[ii].buttonX = 75; - buttons[ii].buttonY = 329; - buttons[ii].buttonWidth = 67; - buttons[ii].buttonHeight = 30; - buttons[ii].buttonKey = ii; - buttons[ii].pot = no; - buttons[ii].graphNum = no; - buttons[ii].graphSelect = no; - buttons[ii].mask = buttonMASK; - strcpy(buttons[ii].text,"Pts On "); - buttons[ii].textColor = 7; - buttons[ii].textHue = 26; - buttons[ii].textShade = 3; - buttons[ii].xHalf = buttons[ii].buttonWidth/2; - buttons[ii].yHalf = buttons[ii].buttonHeight/2; - ++num; - - /* Graph lines On/Off */ - ii = connectOnOff; - buttons[ii].buttonX = 147; - buttons[ii].buttonY = 329; - buttons[ii].buttonWidth = 84; - buttons[ii].buttonHeight = 30; - buttons[ii].buttonKey = ii; - buttons[ii].pot = no; - buttons[ii].graphNum = no; - buttons[ii].graphSelect = no; - buttons[ii].mask = buttonMASK; - strcpy(buttons[ii].text,"Lines On "); - buttons[ii].textColor = 7; - buttons[ii].textHue = 26; - buttons[ii].textShade = 3; - buttons[ii].xHalf = buttons[ii].buttonWidth/2; - buttons[ii].yHalf = buttons[ii].buttonHeight/2; - ++num; - - /* Reset View Position Button */ - ii = reset2D; - buttons[ii].buttonX = 5; - buttons[ii].buttonY = 364; - buttons[ii].buttonWidth = 60; - buttons[ii].buttonHeight = 30; - buttons[ii].buttonKey = ii; - buttons[ii].pot = no; - buttons[ii].graphNum = no; - buttons[ii].graphSelect = no; - buttons[ii].mask = buttonMASK; - strcpy(buttons[ii].text,"Reset"); - buttons[ii].textColor = bColor; - buttons[ii].textHue = 5; - buttons[ii].textShade = 2; - buttons[ii].xHalf = buttons[ii].buttonWidth/2; - buttons[ii].yHalf = buttons[ii].buttonHeight/2; - ++num; - - /* Hide Control Panel */ - ii = hideControl2D; - buttons[ii].buttonX = 70; - buttons[ii].buttonY = 364; - buttons[ii].buttonWidth = 88; - buttons[ii].buttonHeight = 30; - buttons[ii].buttonKey = ii; - buttons[ii].pot = no; - buttons[ii].graphNum = no; - buttons[ii].graphSelect = no; - buttons[ii].mask = buttonMASK; - strcpy(buttons[ii].text,"Hide Panel"); - buttons[ii].textColor = bColor; - buttons[ii].textHue = 5; - buttons[ii].textShade = 2; - buttons[ii].xHalf = buttons[ii].buttonWidth/2; - buttons[ii].yHalf = buttons[ii].buttonHeight/2; - ++num; - - /* Exits from the viewport running */ - ii = closeAll2D; - buttons[ii].buttonX = 169; - buttons[ii].buttonY = 370; - buttons[ii].buttonWidth = 61; - buttons[ii].buttonHeight = 24; - buttons[ii].buttonKey = ii; - buttons[ii].pot = no; - buttons[ii].graphNum = no; - buttons[ii].graphSelect = no; - buttons[ii].mask = buttonMASK; - strcpy(buttons[ii].text,"Quit"); - buttons[ii].textColor = 13; - buttons[ii].textHue = 29; - buttons[ii].textShade = 2; - buttons[ii].xHalf = buttons[ii].buttonWidth/2; - buttons[ii].yHalf = buttons[ii].buttonHeight/2; - ++num; - - /* Indicates that the graph from a viewport is to be picked up. */ - ii = pick2D; - buttons[ii].buttonX = 190; - buttons[ii].buttonY = 217; - buttons[ii].buttonWidth = 40; - buttons[ii].buttonHeight = 24; - buttons[ii].buttonKey = ii; - buttons[ii].pot = no; - buttons[ii].graphNum = no; - buttons[ii].graphSelect = no; - buttons[ii].mask = buttonMASK; - strcpy(buttons[ii].text,"Pick"); - buttons[ii].textColor = 123; - buttons[ii].textHue = 19; - buttons[ii].textShade = 3; - buttons[ii].xHalf = buttons[ii].buttonWidth/2; - buttons[ii].yHalf = buttons[ii].buttonHeight/2; - ++num; - - /* Indicates that the graph from a viewport is to be dropped into a slot. */ - ii = drop2D; - buttons[ii].buttonX = 190; - buttons[ii].buttonY = 245; - buttons[ii].buttonWidth = 40; - buttons[ii].buttonHeight = 24; - buttons[ii].buttonKey = ii; - buttons[ii].pot = no; - buttons[ii].graphNum = no; - buttons[ii].graphSelect = no; - buttons[ii].mask = buttonMASK; - strcpy(buttons[ii].text,"Drop"); - buttons[ii].textColor = 123; - buttons[ii].textHue = 19; - buttons[ii].textShade = 3; - buttons[ii].xHalf = buttons[ii].buttonWidth/2; - buttons[ii].yHalf = buttons[ii].buttonHeight/2; - ++num; - - /* Indicates that the status of the graphs being displayed in the viewport - is to be cleared. */ - ii = clear2D; - buttons[ii].buttonX = 5; - buttons[ii].buttonY = 217; - buttons[ii].buttonWidth = 49; - buttons[ii].buttonHeight = 24; - buttons[ii].buttonKey = ii; - buttons[ii].pot = no; - buttons[ii].graphNum = no; - buttons[ii].graphSelect = no; - buttons[ii].mask = buttonMASK; - strcpy(buttons[ii].text,"Clear"); - buttons[ii].textColor = 123; - buttons[ii].textHue = 19; - buttons[ii].textShade = 3; - buttons[ii].xHalf = buttons[ii].buttonWidth/2; - buttons[ii].yHalf = buttons[ii].buttonHeight/2; - ++num; - - /* Asks for the scale and translation information for the specified graph. */ - ii = query2D; - buttons[ii].buttonX = 5; - buttons[ii].buttonY = 245; - buttons[ii].buttonWidth = 49; - buttons[ii].buttonHeight = 24; - buttons[ii].buttonKey = ii; - buttons[ii].pot = no; - buttons[ii].graphNum = no; - buttons[ii].graphSelect = no; - buttons[ii].mask = buttonMASK; - strcpy(buttons[ii].text,"Query"); - buttons[ii].textColor = 123; - buttons[ii].textHue = 19; - buttons[ii].textShade = 3; - buttons[ii].xHalf = buttons[ii].buttonWidth/2; - buttons[ii].yHalf = buttons[ii].buttonHeight/2; - ++num; - - /* These buttons indicate the 9 available slot numbers into which - a 2D graph can be placed, and the status of the graph, i.e. whether - it is displayed or not. */ - - ii = graph1; - buttons[ii].buttonX = graphBarLeft; - buttons[ii].buttonY = graphBarTop; - buttons[ii].buttonWidth = graphBarWidth; - buttons[ii].buttonHeight = graphBarHeight; - buttons[ii].buttonKey = ii; - buttons[ii].pot = no; - buttons[ii].graphNum = yes; - buttons[ii].graphSelect = no; - buttons[ii].mask = buttonMASK; - strcpy(buttons[ii].text,"1"); - buttons[ii].textColor = graphColor; - buttons[ii].xHalf = buttons[ii].buttonWidth/2; - buttons[ii].yHalf = buttons[ii].buttonHeight/2; - ++num; - - ii = graphSelect1; - buttons[ii].buttonX = graphBarLeft; - buttons[ii].buttonY = graphBarTop + graphBarHeight; - buttons[ii].buttonWidth = graphBarWidth; - buttons[ii].buttonHeight = graphBarHeight-2; - buttons[ii].buttonKey = ii; - buttons[ii].pot = no; /* this is a regular button */ - buttons[ii].graphNum = no; - buttons[ii].graphSelect = yes; - buttons[ii].mask = buttonMASK; - strcpy(buttons[ii].text,"^"); - buttons[ii].textColor = graphColor; - buttons[ii].xHalf = buttons[ii].buttonWidth/2; - buttons[ii].yHalf = buttons[ii].buttonHeight/2; - ++num; - - ii = graph2; - buttons[ii].buttonX = graphBarLeft + (graphBarWidth); - buttons[ii].buttonY = graphBarTop; - buttons[ii].buttonWidth = graphBarWidth; - buttons[ii].buttonHeight = graphBarHeight; - buttons[ii].buttonKey = ii; - buttons[ii].pot = no; /* this is a regular button */ - buttons[ii].graphNum = yes; - buttons[ii].graphSelect = no; - buttons[ii].mask = buttonMASK; - strcpy(buttons[ii].text,"2"); - buttons[ii].textColor = graphColor; - buttons[ii].xHalf = buttons[ii].buttonWidth/2; - buttons[ii].yHalf = buttons[ii].buttonHeight/2; - ++num; - - ii = graphSelect2; - buttons[ii].buttonX = graphBarLeft + (graphBarWidth); - buttons[ii].buttonY = graphBarTop + graphBarHeight; - buttons[ii].buttonWidth = graphBarWidth; - buttons[ii].buttonHeight = graphBarHeight-2; - buttons[ii].buttonKey = ii; - buttons[ii].pot = no; /* this is a regular button */ - buttons[ii].graphNum = no; - buttons[ii].graphSelect = yes; - buttons[ii].mask = buttonMASK; - strcpy(buttons[ii].text,"-"); - buttons[ii].textColor = graphColor; - buttons[ii].xHalf = buttons[ii].buttonWidth/2; - buttons[ii].yHalf = buttons[ii].buttonHeight/2; - ++num; - - ii = graph3; - buttons[ii].buttonX = graphBarLeft + 2*(graphBarWidth); - buttons[ii].buttonY = graphBarTop; - buttons[ii].buttonWidth = graphBarWidth; - buttons[ii].buttonHeight = graphBarHeight; - buttons[ii].buttonKey = ii; - buttons[ii].pot = no; /* this is a regular button */ - buttons[ii].graphNum = yes; - buttons[ii].graphSelect = no; - buttons[ii].mask = buttonMASK; - strcpy(buttons[ii].text,"3"); - buttons[ii].textColor = graphColor; - buttons[ii].xHalf = buttons[ii].buttonWidth/2; - buttons[ii].yHalf = buttons[ii].buttonHeight/2; - ++num; - - ii = graphSelect3; - buttons[ii].buttonX = graphBarLeft + 2*(graphBarWidth); - buttons[ii].buttonY = graphBarTop + graphBarHeight; - buttons[ii].buttonWidth = graphBarWidth; - buttons[ii].buttonHeight = graphBarHeight-2; - buttons[ii].buttonKey = ii; - buttons[ii].pot = no; /**** blend these three together ***/ - buttons[ii].graphNum = no; - buttons[ii].graphSelect = yes; - buttons[ii].mask = buttonMASK; - strcpy(buttons[ii].text,"-"); - buttons[ii].textColor = graphColor; - buttons[ii].xHalf = buttons[ii].buttonWidth/2; - buttons[ii].yHalf = buttons[ii].buttonHeight/2; - ++num; - - ii = graph4; - buttons[ii].buttonX = graphBarLeft + 3*(graphBarWidth); - buttons[ii].buttonY = graphBarTop; - buttons[ii].buttonWidth = graphBarWidth; - buttons[ii].buttonHeight = graphBarHeight; - buttons[ii].buttonKey = ii; - buttons[ii].pot = no; /* this is a regular button */ - buttons[ii].graphNum = yes; - buttons[ii].graphSelect = no; - buttons[ii].mask = buttonMASK; - strcpy(buttons[ii].text,"4"); - buttons[ii].textColor = graphColor; - buttons[ii].xHalf = buttons[ii].buttonWidth/2; - buttons[ii].yHalf = buttons[ii].buttonHeight/2; - ++num; - - ii = graphSelect4; - buttons[ii].buttonX = graphBarLeft + 3*(graphBarWidth); - buttons[ii].buttonY = graphBarTop + graphBarHeight; - buttons[ii].buttonWidth = graphBarWidth; - buttons[ii].buttonHeight = graphBarHeight-2; - buttons[ii].buttonKey = ii; - buttons[ii].pot = no; /* this is a regular button */ - buttons[ii].graphNum = no; - buttons[ii].graphSelect = yes; - buttons[ii].mask = buttonMASK; - strcpy(buttons[ii].text,"-"); - buttons[ii].textColor = graphColor; - buttons[ii].xHalf = buttons[ii].buttonWidth/2; - buttons[ii].yHalf = buttons[ii].buttonHeight/2; - ++num; - - ii = graph5; - buttons[ii].buttonX = graphBarLeft + 4*(graphBarWidth); - buttons[ii].buttonY = graphBarTop; - buttons[ii].buttonWidth = graphBarWidth; - buttons[ii].buttonHeight = graphBarHeight; - buttons[ii].buttonKey = ii; - buttons[ii].pot = no; /* this is a regular button */ - buttons[ii].graphNum = yes; - buttons[ii].graphSelect = no; - buttons[ii].mask = buttonMASK; - strcpy(buttons[ii].text,"5"); - buttons[ii].textColor = graphColor; - buttons[ii].xHalf = buttons[ii].buttonWidth/2; - buttons[ii].yHalf = buttons[ii].buttonHeight/2; - ++num; - - ii = graphSelect5; - buttons[ii].buttonX = graphBarLeft + 4*(graphBarWidth); - buttons[ii].buttonY = graphBarTop + graphBarHeight; - buttons[ii].buttonWidth = graphBarWidth; - buttons[ii].buttonHeight = graphBarHeight-2; - buttons[ii].buttonKey = ii; - buttons[ii].pot = no; /* this is a regular button */ - buttons[ii].graphNum = no; - buttons[ii].graphSelect = yes; - buttons[ii].mask = buttonMASK; - strcpy(buttons[ii].text,"-"); - buttons[ii].textColor = graphColor; - buttons[ii].xHalf = buttons[ii].buttonWidth/2; - buttons[ii].yHalf = buttons[ii].buttonHeight/2; - ++num; - - ii = graph6; - buttons[ii].buttonX = graphBarLeft + 5*(graphBarWidth); - buttons[ii].buttonY = graphBarTop; - buttons[ii].buttonWidth = graphBarWidth; - buttons[ii].buttonHeight = graphBarHeight; - buttons[ii].buttonKey = ii; - buttons[ii].pot = no; /* this is a regular button */ - buttons[ii].graphNum = yes; - buttons[ii].graphSelect = no; - buttons[ii].mask = buttonMASK; - strcpy(buttons[ii].text,"6"); - buttons[ii].textColor = graphColor; - buttons[ii].xHalf = buttons[ii].buttonWidth/2; - buttons[ii].yHalf = buttons[ii].buttonHeight/2; - ++num; - - ii = graphSelect6; - buttons[ii].buttonX = graphBarLeft + 5*(graphBarWidth); - buttons[ii].buttonY = graphBarTop + graphBarHeight; - buttons[ii].buttonWidth = graphBarWidth; - buttons[ii].buttonHeight = graphBarHeight-2; - buttons[ii].buttonKey = ii; - buttons[ii].pot = no; /* this is a regular button */ - buttons[ii].graphNum = no; - buttons[ii].graphSelect = yes; - buttons[ii].mask = buttonMASK; - strcpy(buttons[ii].text,"-"); - buttons[ii].textColor = graphColor; - buttons[ii].xHalf = buttons[ii].buttonWidth/2; - buttons[ii].yHalf = buttons[ii].buttonHeight/2; - ++num; - - ii = graph7; - buttons[ii].buttonX = graphBarLeft + 6*(graphBarWidth); - buttons[ii].buttonY = graphBarTop; - buttons[ii].buttonWidth = graphBarWidth; - buttons[ii].buttonHeight = graphBarHeight; - buttons[ii].buttonKey = ii; - buttons[ii].pot = no; /* this is a regular button */ - buttons[ii].graphNum = yes; - buttons[ii].graphSelect = no; - buttons[ii].mask = buttonMASK; - strcpy(buttons[ii].text,"7"); - buttons[ii].textColor = graphColor; - buttons[ii].xHalf = buttons[ii].buttonWidth/2; - buttons[ii].yHalf = buttons[ii].buttonHeight/2; - ++num; - - ii = graphSelect7; - buttons[ii].buttonX = graphBarLeft + 6*(graphBarWidth); - buttons[ii].buttonY = graphBarTop + graphBarHeight; - buttons[ii].buttonWidth = graphBarWidth; - buttons[ii].buttonHeight = graphBarHeight-2; - buttons[ii].buttonKey = ii; - buttons[ii].pot = no; /* this is a regular button */ - buttons[ii].graphNum = no; - buttons[ii].graphSelect = yes; - buttons[ii].mask = buttonMASK; - strcpy(buttons[ii].text,"-"); - buttons[ii].textColor = graphColor; - buttons[ii].xHalf = buttons[ii].buttonWidth/2; - buttons[ii].yHalf = buttons[ii].buttonHeight/2; - ++num; - - ii = graph8; - buttons[ii].buttonX = graphBarLeft + 7*(graphBarWidth); - buttons[ii].buttonY = graphBarTop; - buttons[ii].buttonWidth = graphBarWidth; - buttons[ii].buttonHeight = graphBarHeight; - buttons[ii].buttonKey = ii; - buttons[ii].pot = no; /* this is a regular button */ - buttons[ii].graphNum = yes; - buttons[ii].graphSelect = no; - buttons[ii].mask = buttonMASK; - strcpy(buttons[ii].text,"8"); - buttons[ii].textColor = graphColor; - buttons[ii].xHalf = buttons[ii].buttonWidth/2; - buttons[ii].yHalf = buttons[ii].buttonHeight/2; - ++num; - - ii = graphSelect8; - buttons[ii].buttonX = graphBarLeft + 7*(graphBarWidth); - buttons[ii].buttonY = graphBarTop + graphBarHeight; - buttons[ii].buttonWidth = graphBarWidth; - buttons[ii].buttonHeight = graphBarHeight-2; - buttons[ii].buttonKey = ii; - buttons[ii].pot = no; /* this is a regular button */ - buttons[ii].graphNum = no; - buttons[ii].graphSelect = yes; - buttons[ii].mask = buttonMASK; - strcpy(buttons[ii].text,"-"); - buttons[ii].textColor = graphColor; - buttons[ii].xHalf = buttons[ii].buttonWidth/2; - buttons[ii].yHalf = buttons[ii].buttonHeight/2; - ++num; - - ii = graph9; - buttons[ii].buttonX = graphBarLeft + 8*(graphBarWidth); - buttons[ii].buttonY = graphBarTop; - buttons[ii].buttonWidth = graphBarWidth; - buttons[ii].buttonHeight = graphBarHeight; - buttons[ii].buttonKey = ii; - buttons[ii].pot = no; /* this is a regular button */ - buttons[ii].graphNum = yes; - buttons[ii].graphSelect = no; - buttons[ii].mask = buttonMASK; - strcpy(buttons[ii].text,"9"); - buttons[ii].textColor = graphColor; - buttons[ii].xHalf = buttons[ii].buttonWidth/2; - buttons[ii].yHalf = buttons[ii].buttonHeight/2; - ++num; - - ii = graphSelect9; - buttons[ii].buttonX = graphBarLeft + 8*(graphBarWidth); - buttons[ii].buttonY = graphBarTop + graphBarHeight; - buttons[ii].buttonWidth = graphBarWidth; - buttons[ii].buttonHeight = graphBarHeight-2; - buttons[ii].buttonKey = ii; - buttons[ii].pot = no; /* this is a regular button */ - buttons[ii].graphNum = no; - buttons[ii].graphSelect = yes; - buttons[ii].mask = buttonMASK; - strcpy(buttons[ii].text,"*"); - buttons[ii].textColor = graphColor; - buttons[ii].xHalf = buttons[ii].buttonWidth/2; - buttons[ii].yHalf = buttons[ii].buttonHeight/2; - ++num; - - return(num); -} -@ -\eject -\begin{thebibliography}{99} -\bibitem{1} nothing -\end{thebibliography} -\end{document} diff --git a/src/graph/view2D/control2d.c.pamphlet b/src/graph/view2D/control2d.c index c45ba400..5645e2ec 100644 --- a/src/graph/view2D/control2d.c.pamphlet +++ b/src/graph/view2D/control2d.c @@ -1,51 +1,37 @@ -\documentclass{article} -\usepackage{axiom} -\begin{document} -\title{\$SPAD/src/graph/view2D control2d.c} -\author{The Axiom Team} -\maketitle -\begin{abstract} -\end{abstract} -\eject -\tableofcontents -\eject -\section{License} -<<license>>= /* -Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - - Neither the name of The Numerical ALgorithms Group Ltd. nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER -OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + Copyright (C) 1991-2002, The Numerical ALgorithms Group Ltd. + All rights reserved. + Copyright (C) 2007-2008, Gabriel Dos Reis. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of The Numerical ALgorithms Group Ltd. nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -@ -<<*>>= -<<license>> #define _CONTROL2D_C #include "axiom-c-macros.h" @@ -108,8 +94,8 @@ writeControlTitle(void) XClearArea(dsply,control->controlWindow,0,0,controlWidth,potA,False); GSetForeground(anotherGC,(float)controlTitleColor,Xoption); GDrawImageString(anotherGC,control->controlWindow, - centerX(anotherGC,s,strlength,controlWidth), - 15,s,strlength,Xoption); + centerX(anotherGC,s,strlength,controlWidth), + 15,s,strlength,Xoption); } /* writeControlTitle() */ @@ -138,8 +124,8 @@ makeMessageFromData(int whichGraph) strcpy(deltaXReport,"-big"); } else { sprintf(deltaXReport,"%4.0f", - -graphStateArray[whichGraph].centerX / - graphArray[whichGraph].unitX); + -graphStateArray[whichGraph].centerX / + graphArray[whichGraph].unitX); } if ((graphStateArray[whichGraph].centerY) > 999.0) { strcpy(deltaYReport,"+big"); @@ -147,11 +133,11 @@ makeMessageFromData(int whichGraph) strcpy(deltaYReport,"-big"); } else { sprintf(deltaYReport,"%4.0f", - -graphStateArray[whichGraph].centerY / - graphArray[whichGraph].unitY); + -graphStateArray[whichGraph].centerY / + graphArray[whichGraph].unitY); } sprintf(viewport->controlPanel->message,"[%s,%s] >%d< [%s,%s]", - scaleXReport,scaleYReport,whichGraph+1,deltaXReport,deltaYReport); + scaleXReport,scaleYReport,whichGraph+1,deltaXReport,deltaYReport); } /* if haveControl */ } /* makeMessageFromData() */ @@ -164,7 +150,7 @@ writeControlMessage() writeControlMessage(void) #endif { - int strlength; + int strlength; controlPanelStruct *cp; XWindowAttributes cwInfo; @@ -175,9 +161,9 @@ writeControlMessage(void) GDrawImageString(controlMessageGC,cp->controlWindow, - centerX(globalGC1,cp->message,strlength,controlWidth), - controlMessageY + globalFont->max_bounds.ascent - 2, - cp->message,strlength,Xoption); + centerX(globalGC1,cp->message,strlength,controlWidth), + controlMessageY + globalFont->max_bounds.ascent - 2, + cp->message,strlength,Xoption); } /*********************************/ @@ -205,13 +191,13 @@ drawControlPanel(void) GSetLineAttributes(trashGC,2,LineSolid,CapButt,JoinMiter,Xoption); GDrawLine(trashGC, cp->controlWindow, 0, potB, controlWidth, potB, Xoption); GDrawLine(trashGC, cp->controlWindow, 0, messageBot, - controlWidth, messageBot, Xoption); + controlWidth, messageBot, Xoption); GDrawLine(trashGC, cp->controlWindow, 0, 286, controlWidth, 286, Xoption); /** put the line width as 1 last because used below as well **/ GSetLineAttributes(trashGC,1,LineSolid,CapButt,JoinMiter,Xoption); GDrawRectangle(trashGC,cp->controlWindow,closeLeft,closeTop, - (controlWidth-closeLeft+8),(controlHeight-closeTop+8),Xoption); + (controlWidth-closeLeft+8),(controlHeight-closeTop+8),Xoption); /* Write potentiometer titles on the control panel. */ writeControlTitle(); @@ -219,17 +205,17 @@ drawControlPanel(void) s = "Scale"; strlength = strlen(s); GDrawString(globGC,cp->controlWindow, - centerX(globGC,s,strlength, - cp->buttonQueue[scale2D].buttonWidth) + - cp->buttonQueue[scale2D].buttonX, 31+headerHeight,s,strlength,Xoption); + centerX(globGC,s,strlength, + cp->buttonQueue[scale2D].buttonWidth) + + cp->buttonQueue[scale2D].buttonX, 31+headerHeight,s,strlength,Xoption); s = "Translate"; strlength = strlen(s); GDrawString(globGC,cp->controlWindow, - centerX(globGC,s,strlength, - cp->buttonQueue[translate2D].buttonWidth) + - cp->buttonQueue[translate2D].buttonX, - 31+headerHeight,s,strlen(s),Xoption); + centerX(globGC,s,strlength, + cp->buttonQueue[translate2D].buttonWidth) + + cp->buttonQueue[translate2D].buttonX, + 31+headerHeight,s,strlen(s),Xoption); GSetForeground(globGC,(float)controlColorColor,Xoption); @@ -237,8 +223,8 @@ drawControlPanel(void) s = "Graphs"; strlength = strlen(s); GDrawString(globGC,cp->controlWindow, - centerX(globGC,s,strlength,controlWidth),graphHeaderHeight, - s,strlength,Xoption); + centerX(globGC,s,strlength,controlWidth),graphHeaderHeight, + s,strlength,Xoption); /* Write titles on regular buttons and draw pixmaps on potentiometers. */ @@ -247,142 +233,142 @@ drawControlPanel(void) GSetForeground(globalGC1,(float)buttonColor,Xoption); GDrawRectangle(globalGC1,cp->controlWindow, - (cp->buttonQueue[i]).buttonX, - (cp->buttonQueue[i]).buttonY, - (cp->buttonQueue[i]).buttonWidth, - (cp->buttonQueue[i]).buttonHeight,Xoption); + (cp->buttonQueue[i]).buttonX, + (cp->buttonQueue[i]).buttonY, + (cp->buttonQueue[i]).buttonWidth, + (cp->buttonQueue[i]).buttonHeight,Xoption); GSetForeground(trashGC, - (float)monoColor((cp->buttonQueue[i]).textColor),Xoption); + (float)monoColor((cp->buttonQueue[i]).textColor),Xoption); GDrawLine(globalGC1,cp->controlWindow, /* trashGC, */ - (cp->buttonQueue[i]).buttonX + (cp->buttonQueue[i]).xHalf, - (cp->buttonQueue[i]).buttonY, - (cp->buttonQueue[i]).buttonX + (cp->buttonQueue[i]).xHalf, - (cp->buttonQueue[i]).buttonY + 2*(cp->buttonQueue[i]).yHalf,Xoption); + (cp->buttonQueue[i]).buttonX + (cp->buttonQueue[i]).xHalf, + (cp->buttonQueue[i]).buttonY, + (cp->buttonQueue[i]).buttonX + (cp->buttonQueue[i]).xHalf, + (cp->buttonQueue[i]).buttonY + 2*(cp->buttonQueue[i]).yHalf,Xoption); GDrawLine(globalGC1,cp->controlWindow, /* trashGC, */ - (cp->buttonQueue[i]).buttonX, - (cp->buttonQueue[i]).buttonY + (cp->buttonQueue[i]).yHalf, - (cp->buttonQueue[i]).buttonX + 2*(cp->buttonQueue[i]).xHalf, - (cp->buttonQueue[i]).buttonY + (cp->buttonQueue[i]).yHalf,Xoption); + (cp->buttonQueue[i]).buttonX, + (cp->buttonQueue[i]).buttonY + (cp->buttonQueue[i]).yHalf, + (cp->buttonQueue[i]).buttonX + 2*(cp->buttonQueue[i]).xHalf, + (cp->buttonQueue[i]).buttonY + (cp->buttonQueue[i]).yHalf,Xoption); switch (i) { case scale2D: - GDrawLines(trashGC,cp->controlWindow,scaleArrow, - scaleArrowN,CoordModeOrigin,Xoption); - break; + GDrawLines(trashGC,cp->controlWindow,scaleArrow, + scaleArrowN,CoordModeOrigin,Xoption); + break; case translate2D: - GDrawLines(trashGC,cp->controlWindow,translateArrow, - translateArrowN,CoordModeOrigin,Xoption); - break; + GDrawLines(trashGC,cp->controlWindow,translateArrow, + translateArrowN,CoordModeOrigin,Xoption); + break; } /* switch i */ } else if (cp->buttonQueue[i].graphNum) { if (mono) { - if (graphStateArray[i-graphStart].showing) { - GSetForeground(graphGC,(float)backgroundColor,Xoption); - GSetBackground(graphGC,(float)foregroundColor,Xoption); - } else { - GSetForeground(graphGC,(float)foregroundColor,Xoption); - GSetBackground(graphGC,(float)backgroundColor,Xoption); - } - strlength = strlen((cp->buttonQueue[i]).text); - GDrawImageString(graphGC,cp->controlWindow, - (cp->buttonQueue[i]).buttonX + - centerX(graphGC,cp->buttonQueue[i].text, - strlength,(cp->buttonQueue[i]).buttonWidth), - (cp->buttonQueue[i]).buttonY + - centerY(graphGC,(cp->buttonQueue[i]).buttonHeight), - cp->buttonQueue[i].text,strlength,Xoption); + if (graphStateArray[i-graphStart].showing) { + GSetForeground(graphGC,(float)backgroundColor,Xoption); + GSetBackground(graphGC,(float)foregroundColor,Xoption); + } else { + GSetForeground(graphGC,(float)foregroundColor,Xoption); + GSetBackground(graphGC,(float)backgroundColor,Xoption); + } + strlength = strlen((cp->buttonQueue[i]).text); + GDrawImageString(graphGC,cp->controlWindow, + (cp->buttonQueue[i]).buttonX + + centerX(graphGC,cp->buttonQueue[i].text, + strlength,(cp->buttonQueue[i]).buttonWidth), + (cp->buttonQueue[i]).buttonY + + centerY(graphGC,(cp->buttonQueue[i]).buttonHeight), + cp->buttonQueue[i].text,strlength,Xoption); } else { - if (graphStateArray[i-graphStart].showing) - GSetForeground(graphGC,(float)graphBarShowingColor,Xoption); - else - GSetForeground(graphGC,(float)graphBarHiddenColor,Xoption); - strlength = strlen((cp->buttonQueue[i]).text); - GDrawString(graphGC,cp->controlWindow, - (cp->buttonQueue[i]).buttonX + - centerX(graphGC,cp->buttonQueue[i].text, - strlength,(cp->buttonQueue[i]).buttonWidth), - (cp->buttonQueue[i]).buttonY + - centerY(graphGC,(cp->buttonQueue[i]).buttonHeight), - cp->buttonQueue[i].text,strlength,Xoption); - } + if (graphStateArray[i-graphStart].showing) + GSetForeground(graphGC,(float)graphBarShowingColor,Xoption); + else + GSetForeground(graphGC,(float)graphBarHiddenColor,Xoption); + strlength = strlen((cp->buttonQueue[i]).text); + GDrawString(graphGC,cp->controlWindow, + (cp->buttonQueue[i]).buttonX + + centerX(graphGC,cp->buttonQueue[i].text, + strlength,(cp->buttonQueue[i]).buttonWidth), + (cp->buttonQueue[i]).buttonY + + centerY(graphGC,(cp->buttonQueue[i]).buttonHeight), + cp->buttonQueue[i].text,strlength,Xoption); + } } else if (cp->buttonQueue[i].graphSelect) { /* The select characters are defined as: "^" for on and "-" for off. */ if (graphStateArray[i-graphSelectStart].selected) { - GSetForeground(graphGC,(float)graphBarSelectColor,Xoption); - strcpy((cp->buttonQueue[i]).text,"^"); + GSetForeground(graphGC,(float)graphBarSelectColor,Xoption); + strcpy((cp->buttonQueue[i]).text,"^"); } else { - GSetForeground(graphGC,(float)graphBarNotSelectColor,Xoption); - *(cp->buttonQueue[i]).text = '-'; - strcpy((cp->buttonQueue[i]).text,"-"); + GSetForeground(graphGC,(float)graphBarNotSelectColor,Xoption); + *(cp->buttonQueue[i]).text = '-'; + strcpy((cp->buttonQueue[i]).text,"-"); } GDrawString(graphGC,cp->controlWindow, - (cp->buttonQueue[i]).buttonX + - centerX(graphGC,cp->buttonQueue[i].text, - strlength,(cp->buttonQueue[i]).buttonWidth), - (cp->buttonQueue[i]).buttonY + - centerY(graphGC,(cp->buttonQueue[i]).buttonHeight), - cp->buttonQueue[i].text,strlength,Xoption); + (cp->buttonQueue[i]).buttonX + + centerX(graphGC,cp->buttonQueue[i].text, + strlength,(cp->buttonQueue[i]).buttonWidth), + (cp->buttonQueue[i]).buttonY + + centerY(graphGC,(cp->buttonQueue[i]).buttonHeight), + cp->buttonQueue[i].text,strlength,Xoption); } else { /* a regular button */ int isOn = 1; switch(i) { - case pointsOnOff: - isOn = pointsON = graphStateArray[0].pointsOn; - if (graphStateArray[0].pointsOn) - strcpy((cp->buttonQueue[i]).text,"Pts On "); - else - strcpy((cp->buttonQueue[i]).text,"Pts Off"); - break; - - case spline2D: - isOn = splineON = graphStateArray[0].splineOn; - if (graphStateArray[0].splineOn) - strcpy((cp->buttonQueue[i]).text, "Box On "); - else - strcpy((cp->buttonQueue[i]).text, "Box Off"); - break; - - case connectOnOff: - isOn = connectON = graphStateArray[0].connectOn; - if (graphStateArray[0].connectOn) - strcpy((cp->buttonQueue[i]).text, "Lines On "); - else - strcpy((cp->buttonQueue[i]).text, "Lines Off"); - break; - - case axesOnOff2D: - isOn = axesON = graphStateArray[0].axesOn; - if (graphStateArray[0].axesOn) - strcpy((cp->buttonQueue[i]).text , "Axes On "); - else - strcpy((cp->buttonQueue[i]).text , "Axes Off"); - break; - - case unitsOnOff2D: - isOn = unitsON = graphStateArray[0].unitsOn; - if (graphStateArray[0].unitsOn) - strcpy( (cp->buttonQueue[i]).text , "Units On "); - else - strcpy( (cp->buttonQueue[i]).text , "Units Off"); - break; - case closeAll2D: - isOn = 0; - - default: - break; + case pointsOnOff: + isOn = pointsON = graphStateArray[0].pointsOn; + if (graphStateArray[0].pointsOn) + strcpy((cp->buttonQueue[i]).text,"Pts On "); + else + strcpy((cp->buttonQueue[i]).text,"Pts Off"); + break; + + case spline2D: + isOn = splineON = graphStateArray[0].splineOn; + if (graphStateArray[0].splineOn) + strcpy((cp->buttonQueue[i]).text, "Box On "); + else + strcpy((cp->buttonQueue[i]).text, "Box Off"); + break; + + case connectOnOff: + isOn = connectON = graphStateArray[0].connectOn; + if (graphStateArray[0].connectOn) + strcpy((cp->buttonQueue[i]).text, "Lines On "); + else + strcpy((cp->buttonQueue[i]).text, "Lines Off"); + break; + + case axesOnOff2D: + isOn = axesON = graphStateArray[0].axesOn; + if (graphStateArray[0].axesOn) + strcpy((cp->buttonQueue[i]).text , "Axes On "); + else + strcpy((cp->buttonQueue[i]).text , "Axes Off"); + break; + + case unitsOnOff2D: + isOn = unitsON = graphStateArray[0].unitsOn; + if (graphStateArray[0].unitsOn) + strcpy( (cp->buttonQueue[i]).text , "Units On "); + else + strcpy( (cp->buttonQueue[i]).text , "Units Off"); + break; + case closeAll2D: + isOn = 0; + + default: + break; } /* switch i */ s = (cp->buttonQueue[i]).text; strlength = strlen(s); GDrawPushButton(dsply, globalGC1, trashGC, processGC, cp->controlWindow, - (cp->buttonQueue[i]).buttonX, (cp->buttonQueue[i]).buttonY, - (cp->buttonQueue[i]).buttonWidth, (cp->buttonQueue[i]).buttonHeight, - isOn, s,buttonColor, - monoColor((cp->buttonQueue[i]).textColor), Xoption); + (cp->buttonQueue[i]).buttonX, (cp->buttonQueue[i]).buttonY, + (cp->buttonQueue[i]).buttonWidth, (cp->buttonQueue[i]).buttonHeight, + isOn, s,buttonColor, + monoColor((cp->buttonQueue[i]).textColor), Xoption); } /* else a regular button */ } /* for each button */ @@ -403,10 +389,10 @@ getControlXY(int whereDoYouWantPanel) #endif { XWindowAttributes wAttr, wAttrib; - controlXY cXY; - int tmp=1; - Window rootW, parentW, *childrenWs, tmpW; - unsigned int nChildren; + controlXY cXY; + int tmp=1; + Window rootW, parentW, *childrenWs, tmpW; + unsigned int nChildren; tmpW = viewport->titleWindow; while(tmp) { @@ -441,7 +427,7 @@ getControlXY(int whereDoYouWantPanel) cXY.putX = wAttrib.x + wAttrib.width; cXY.putY = wAttrib.y; } else if ((physicalHeight - (wAttrib.y + wAttr.height)) >= - controlHeight) { + controlHeight) { cXY.putX = wAttrib.x + (wAttr.width - controlWidth)/2; cXY.putY = wAttrib.y + wAttrib.height; } else if (wAttrib.x >= controlWidth) { @@ -450,7 +436,7 @@ getControlXY(int whereDoYouWantPanel) } else if (wAttrib.y >= controlHeight) { cXY.putX = wAttrib.x + (wAttr.width - controlWidth)/2; cXY.putY = wAttrib.y - controlHeight - borderHeight; - } else { /* put inside of viewport */ + } else { /* put inside of viewport */ cXY.putX = wAttrib.x + wAttr.width - controlWidth; cXY.putY = wAttrib.y + wAttr.height - controlHeight; } @@ -472,14 +458,14 @@ makeControlPanel(void) { Window cw; - int i,num; + int i,num; controlPanelStruct *control; - buttonStruct *buttons; - controlXY cXY; + buttonStruct *buttons; + controlXY cXY; XSetWindowAttributes cwAttrib, controlAttrib; - XSizeHints sizehints; - Pixmap mousebits,mousemask; - XColor foreColor, backColor; + XSizeHints sizehints; + Pixmap mousebits,mousemask; + XColor foreColor, backColor; if (!(control = (controlPanelStruct *)malloc(sizeof(controlPanelStruct)))) { fprintf(stderr,"Ran out of memory trying to create a control panel.\n"); @@ -490,9 +476,9 @@ makeControlPanel(void) /* Define and assign a mouse cursor. */ mousebits = XCreateBitmapFromData(dsply,rtWindow,mouseBitmap_bits, - mouseBitmap_width,mouseBitmap_height); + mouseBitmap_width,mouseBitmap_height); mousemask = XCreateBitmapFromData(dsply,rtWindow,mouseMask_bits, - mouseMask_width,mouseMask_height); + mouseMask_width,mouseMask_height); cwAttrib.background_pixel = backgroundColor; /* controlBackground; */ cwAttrib.border_pixel = foregroundColor; cwAttrib.backing_store = WhenMapped; @@ -504,17 +490,17 @@ makeControlPanel(void) backColor.pixel = controlCursorBackground; XQueryColor(dsply,colorMap,&backColor); cwAttrib.cursor = XCreatePixmapCursor(dsply,mousebits,mousemask, - &foreColor,&backColor, - mouseBitmap_x_hot,mouseBitmap_y_hot); + &foreColor,&backColor, + mouseBitmap_x_hot,mouseBitmap_y_hot); cw = XCreateWindow(dsply,rtWindow, - cXY.putX,cXY.putY,controlWidth,controlHeight,3, - CopyFromParent,InputOutput,CopyFromParent, - controlCreateMASK,&cwAttrib); + cXY.putX,cXY.putY,controlWidth,controlHeight,3, + CopyFromParent,InputOutput,CopyFromParent, + controlCreateMASK,&cwAttrib); sizehints.flags = PPosition | PSize; - sizehints.x = cXY.putX; - sizehints.y = cXY.putY; + sizehints.x = cXY.putX; + sizehints.y = cXY.putY; sizehints.width = controlWidth; sizehints.height = controlHeight; @@ -522,7 +508,7 @@ makeControlPanel(void) XSetNormalHints(dsply,cw,&sizehints); XSetStandardProperties(dsply,cw,"2D Control Panel","2D Control Panel", - None,NULL,0,&sizehints); + None,NULL,0,&sizehints); control->controlWindow = cw; num = initButtons(control->buttonQueue); @@ -532,24 +518,24 @@ makeControlPanel(void) for (i=0; i<num; i++) { controlAttrib.event_mask = (control->buttonQueue[i]).mask; (control->buttonQueue[i]).self = XCreateWindow(dsply,cw, - (control->buttonQueue[i]).buttonX, - (control->buttonQueue[i]).buttonY, - (control->buttonQueue[i]).buttonWidth, - (control->buttonQueue[i]).buttonHeight, - 0,0,InputOnly,CopyFromParent, - buttonCreateMASK,&controlAttrib); + (control->buttonQueue[i]).buttonX, + (control->buttonQueue[i]).buttonY, + (control->buttonQueue[i]).buttonWidth, + (control->buttonQueue[i]).buttonHeight, + 0,0,InputOnly,CopyFromParent, + buttonCreateMASK,&controlAttrib); XMakeAssoc(dsply,table,(control->buttonQueue[i]).self, - &((control->buttonQueue[i]).buttonKey)); + &((control->buttonQueue[i]).buttonKey)); /* Use buttonKey instead of i because buttonKey has a permanent address */ XMapWindow(dsply,(control->buttonQueue[i]).self); } - /* Create message window */ + /* Create message window */ control->messageWindow = XCreateWindow(dsply,cw,0,controlMessageY, - controlWidth,controlMessageHeight, - 0,0,InputOnly,CopyFromParent, - messageCreateMASK,&cwAttrib); + controlWidth,controlMessageHeight, + 0,0,InputOnly,CopyFromParent, + messageCreateMASK,&cwAttrib); XMapWindow(dsply,control->messageWindow); for (i=0; i<scaleArrowN; i++) { @@ -591,7 +577,7 @@ putControlPanelSomewhere(int whereDoesPanelGo) #endif { controlPanelStruct *control; - controlXY whereControl; + controlXY whereControl; control = viewport->controlPanel; whereControl = getControlXY(whereDoesPanelGo); @@ -600,7 +586,7 @@ putControlPanelSomewhere(int whereDoesPanelGo) XRaiseWindow(dsply,control->controlWindow); XMoveWindow(dsply,control->controlWindow,whereControl.putX, - whereControl.putY); + whereControl.putY); drawControlPanel(); if (viewport->justMadeControl) { @@ -629,13 +615,7 @@ clearControlMessage(void) strcpy(viewport->controlPanel->message,""); XClearArea(dsply,viewport->controlPanel->controlWindow, - 0,controlMessageY-2,controlWidth,controlMessageHeight,False); + 0,controlMessageY-2,controlWidth,controlMessageHeight,False); } -@ -\eject -\begin{thebibliography}{99} -\bibitem{1} nothing -\end{thebibliography} -\end{document} diff --git a/src/graph/view2D/globals2.h b/src/graph/view2D/globals2.h index de0d132a..1544471d 100755..100644 --- a/src/graph/view2D/globals2.h +++ b/src/graph/view2D/globals2.h @@ -1,34 +1,36 @@ /* -Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - - Neither the name of The Numerical ALgorithms Group Ltd. nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER -OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + Copyright (C) 1991-2002, The Numerical ALgorithms Group Ltd. + All rights reserved. + Copyright (C) 2007-2008, Gabriel Dos Reis. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of The Numerical ALgorithms Group Ltd. nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ extern int scrn; diff --git a/src/graph/view2D/graph2d.c.pamphlet b/src/graph/view2D/graph2d.c index add87b5b..47960cd7 100644 --- a/src/graph/view2D/graph2d.c.pamphlet +++ b/src/graph/view2D/graph2d.c @@ -1,51 +1,37 @@ -\documentclass{article} -\usepackage{axiom} -\begin{document} -\title{\$SPAD/src/graph/view2D graph2d.c} -\author{The Axiom Team} -\maketitle -\begin{abstract} -\end{abstract} -\eject -\tableofcontents -\eject -\section{License} -<<license>>= /* -Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - - Neither the name of The Numerical ALgorithms Group Ltd. nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER -OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + Copyright (C) 1991-2002, The Numerical ALgorithms Group Ltd. + All rights reserved. + Copyright (C) 2007-2008, Gabriel Dos Reis. + All right reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of The Numerical ALgorithms Group Ltd. nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -@ -<<*>>= -<<license>> #define _GRAPH2D_C #include "axiom-c-macros.h" @@ -172,7 +158,7 @@ freeGraph(int i) if (graphArray[i].key) { graphArray[i].key = 0; /* 0 means no graph */ for (j=0,llPtr=graphArray[i].listOfListsOfPoints; - j<graphArray[i].numberOfLists; j++,llPtr++) + j<graphArray[i].numberOfLists; j++,llPtr++) free(llPtr->listOfPoints); free(llPtr); free(xPointsArray[i].xPoint); @@ -180,9 +166,3 @@ freeGraph(int i) } } -@ -\eject -\begin{thebibliography}{99} -\bibitem{1} nothing -\end{thebibliography} -\end{document} diff --git a/src/graph/view2D/header2.h b/src/graph/view2D/header2.h index b6b37848..c7d63985 100755..100644 --- a/src/graph/view2D/header2.h +++ b/src/graph/view2D/header2.h @@ -1,34 +1,36 @@ /* -Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - - Neither the name of The Numerical ALgorithms Group Ltd. nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER -OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + Copyright (C) 1991-2002, The Numerical ALgorithms Group Ltd. + All rights reserved. + Copyright (C) 2007-2008, Gabriel Dos Reis. + All rights resrved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of The Numerical ALgorithms Group Ltd. nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include <X11/Xlib.h> diff --git a/src/graph/view2D/main2d.c.pamphlet b/src/graph/view2D/main2d.c index 72135f9a..8ff6b8e7 100644 --- a/src/graph/view2D/main2d.c.pamphlet +++ b/src/graph/view2D/main2d.c @@ -1,51 +1,37 @@ -\documentclass{article} -\usepackage{axiom} -\begin{document} -\title{\$SPAD/src/graph/view2D main2d.c} -\author{The Axiom Team} -\maketitle -\begin{abstract} -\end{abstract} -\eject -\tableofcontents -\eject -\section{License} -<<license>>= /* -Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. -All rights reserved. + Copyright (C) 1991-2002, The Numerical ALgorithms Group Ltd. + All rights reserved. + Copyright (C) 2007-2008, Gabriel Dos Reis. + All rights reserved. -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. - - Neither the name of The Numerical ALgorithms Group Ltd. nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. + - Neither the name of The Numerical ALgorithms Group Ltd. nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER -OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -@ -<<*>>= -<<license>> #define _MAIN2D_C #include "axiom-c-macros.h" @@ -217,10 +203,10 @@ main(void) (void) strcpy(prop, "off"); if (mono) - if (strcmp(prop,"on") == 0) { /* 0 if equal (inverse video) */ + if (strcmp(prop,"on") == 0) { /* 0 if equal (inverse video) */ foregroundColor = WhitePixel(dsply,scrn); backgroundColor = BlackPixel(dsply,scrn); - } else { /* off (no inverse video) */ + } else { /* off (no inverse video) */ foregroundColor = BlackPixel(dsply,scrn); backgroundColor = WhitePixel(dsply,scrn); } @@ -236,9 +222,9 @@ main(void) /* read default file name for postScript output */ if (XrmGetResource(rDB, - "Axiom.2D.postscriptFile", - "", - str_type, &value) == True) + "Axiom.2D.postscriptFile", + "", + str_type, &value) == True) (void) strncpy(prop,value.addr,(int)value.size); else (void) strcpy(prop, "axiom2D.ps"); @@ -252,84 +238,84 @@ main(void) serverFont = XQueryFont(dsply,XGContextFromGC(DefaultGC(dsply,scrn))); if (XrmGetResource(rDB, - "Axiom.2D.messageFont", - "Axiom.2D.Font", - str_type, &value) == True) + "Axiom.2D.messageFont", + "Axiom.2D.Font", + str_type, &value) == True) (void) strncpy(prop,value.addr,(int)value.size); else (void) strcpy(prop,messageFontDefault); if ((globalFont = XLoadQueryFont(dsply, prop)) == NULL) { fprintf(stderr, - "Warning: could not get the %s font for messageFont\n",prop); + "Warning: could not get the %s font for messageFont\n",prop); globalFont = serverFont; } if (XrmGetResource(rDB, - "Axiom.2D.buttonFont", - "Axiom.2D.Font", - str_type, &value) == True) + "Axiom.2D.buttonFont", + "Axiom.2D.Font", + str_type, &value) == True) (void) strncpy(prop,value.addr,(int)value.size); else (void) strcpy(prop,buttonFontDefault); if ((buttonFont = XLoadQueryFont(dsply, prop)) == NULL) { fprintf(stderr, - "Warning: could not get the %s font for buttonFont\n",prop); + "Warning: could not get the %s font for buttonFont\n",prop); buttonFont = serverFont; } if (XrmGetResource(rDB, - "Axiom.2D.headerFont", - "Axiom.2D.Font", - str_type, &value) == True) + "Axiom.2D.headerFont", + "Axiom.2D.Font", + str_type, &value) == True) (void) strncpy(prop,value.addr,(int)value.size); else (void) strcpy(prop,headerFontDefault); if ((headerFont = XLoadQueryFont(dsply, prop)) == NULL) { fprintf(stderr, - "Warning: could not get the %s font for headerFont\n",prop); + "Warning: could not get the %s font for headerFont\n",prop); headerFont = serverFont; } if (XrmGetResource(rDB, - "Axiom.2D.titleFont", - "Axiom.2D.Font", - str_type,&value) == True) + "Axiom.2D.titleFont", + "Axiom.2D.Font", + str_type,&value) == True) (void) strncpy(prop,value.addr,(int)value.size); else (void) strcpy(prop,titleFontDefault); if ((titleFont = XLoadQueryFont(dsply, prop)) == NULL) { fprintf(stderr, - "Warning: could not get the %s font for titleFont\n",prop); + "Warning: could not get the %s font for titleFont\n",prop); titleFont = serverFont; } if (XrmGetResource(rDB, - "Axiom.2D.graphFont", - "Axiom.2D.Font", - str_type,&value) == True) + "Axiom.2D.graphFont", + "Axiom.2D.Font", + str_type,&value) == True) (void) strncpy(prop,value.addr,(int)value.size); else (void) strcpy(prop,graphFontDefault); if ((graphFont = XLoadQueryFont(dsply, prop)) == NULL) { fprintf(stderr, - "Warning: could not get the %s font for graphFont\n",prop); + "Warning: could not get the %s font for graphFont\n",prop); graphFont = serverFont; } if (XrmGetResource(rDB, - "Axiom.2D.unitFont", - "Axiom.2D.Font", - str_type,&value) == True) + "Axiom.2D.unitFont", + "Axiom.2D.Font", + str_type,&value) == True) (void) strncpy(prop,value.addr,(int)value.size); else (void) strcpy(prop,unitFontDefault); if ((unitFont = XLoadQueryFont(dsply, prop)) == NULL) { fprintf(stderr, - "Warning: could not get the %s font for unitFont\n",prop); + "Warning: could not get the %s font for unitFont\n",prop); unitFont = serverFont; } @@ -345,19 +331,19 @@ main(void) controlGCVals.foreground = monoColor(axesColorDefault); controlGCVals.background = backgroundColor; globalGC1 = XCreateGC(dsply,rtWindow,GCForeground | GCBackground , - &controlGCVals); + &controlGCVals); carefullySetFont(globalGC1,globalFont); /* create the equivalent GCs for ps */ PSCreateContext(globalGC1, "globalGC1", psNormalWidth, psButtCap, - psMiterJoin, psWhite, psBlack); + psMiterJoin, psWhite, psBlack); /* controlMessageGC */ controlGCVals.foreground = controlMessageColor; controlMessageGC = XCreateGC(dsply,rtWindow,GCForeground | GCBackground - ,&controlGCVals); + ,&controlGCVals); carefullySetFont(controlMessageGC,globalFont); /* globalGC2 */ @@ -365,24 +351,24 @@ main(void) controlGCVals.foreground = monoColor(labelColor); controlGCVals.background = backgroundColor; globalGC2 = XCreateGC(dsply,rtWindow,GCForeground | GCBackground, - &controlGCVals); + &controlGCVals); carefullySetFont(globalGC2,buttonFont); PSCreateContext(globalGC2, "globalGC2", psNormalWidth, psButtCap, - psMiterJoin, psWhite, psBlack); + psMiterJoin, psWhite, psBlack); /* trashGC */ trashGC = XCreateGC(dsply,rtWindow,0,&controlGCVals); carefullySetFont(trashGC,buttonFont); PSCreateContext(trashGC, "trashGC", psNormalWidth, psButtCap, - psMiterJoin, psWhite, psBlack); + psMiterJoin, psWhite, psBlack); /* globGC */ globGC = XCreateGC(dsply,rtWindow,0,&controlGCVals); carefullySetFont(globGC,headerFont); PSCreateContext(globGC, "globGC", psNormalWidth, psButtCap, - psMiterJoin, psWhite, psBlack); + psMiterJoin, psWhite, psBlack); /* anotherGC */ @@ -390,7 +376,7 @@ main(void) anotherGC = XCreateGC(dsply,rtWindow,GCBackground,&controlGCVals); carefullySetFont(anotherGC,titleFont); PSCreateContext(anotherGC, "anotherGC", psNormalWidth, psButtCap, - psMiterJoin, psWhite, psBlack); + psMiterJoin, psWhite, psBlack); /* processGC */ @@ -403,14 +389,14 @@ main(void) graphGC = XCreateGC(dsply,rtWindow,GCBackground,&gcVals); carefullySetFont(graphGC,graphFont); PSCreateContext(graphGC, "graphGC", psNormalWidth, psButtCap, - psMiterJoin, psWhite, psBlack); + psMiterJoin, psWhite, psBlack); /* unitGC */ unitGC = XCreateGC(dsply,rtWindow,GCBackground ,&gcVals); carefullySetFont(unitGC,unitFont); PSCreateContext(unitGC, "unitGC", psNormalWidth, psButtCap, - psMiterJoin, psWhite, psBlack); + psMiterJoin, psWhite, psBlack); /**** Initialize Graph States ****/ @@ -443,14 +429,14 @@ main(void) if (!(viewData.title = (char *)malloc(i))) { fprintf(stderr, - "ERROR: Ran out of memory trying to receive the title.\n"); + "ERROR: Ran out of memory trying to receive the title.\n"); exitWithAck(RootWindow(dsply,scrn),Window,-1); } readViewman(viewData.title,i); for (i=0; i<maxGraphs; i++) { readViewman(&(graphArray[i].key),intSize); - if (graphArray[i].key) { /** this graph slot has data **/ + if (graphArray[i].key) { /** this graph slot has data **/ getGraphFromViewman(i); } /* if graph exists (graphArray[i].key is not zero) */ } /* for i in graphs */ @@ -515,9 +501,3 @@ mergeDatabases(void) XrmMergeDatabases(homeDB,&rDB); } -@ -\eject -\begin{thebibliography}{99} -\bibitem{1} nothing -\end{thebibliography} -\end{document} diff --git a/src/graph/view2D/pot2d.c b/src/graph/view2D/pot2d.c new file mode 100644 index 00000000..95443a4d --- /dev/null +++ b/src/graph/view2D/pot2d.c @@ -0,0 +1,63 @@ +/* + Copyright (C) 1991-2002, The Numerical ALgorithms Group Ltd. + All rights reserved. + Copyright (C) 2007-2008, Gabriel Dos Reis. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of The Numerical ALgorithms Group Ltd. nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#define _POT2D_C +#include "axiom-c-macros.h" + +#include "header2.h" + +#include "all_2d.H1" + +mouseCoord +#ifdef _NO_PROTO +getPotValue(eX,eY,xH,yH) + short eX,eY,xH,yH; +#else +getPotValue(short eX,short eY,short xH,short yH) +#endif +{ + + mouseCoord whereMouse; + float x,y; + + x = (float)eX/xH - 1; + y = -((float)eY/yH -1); + /* make non-linear potentiometer */ + whereMouse.x = x*x*x; + whereMouse.y = y*y*y; + + return(whereMouse); + +} /* getPotValue() */ diff --git a/src/graph/view2D/pot2d.c.pamphlet b/src/graph/view2D/pot2d.c.pamphlet deleted file mode 100644 index af4addb7..00000000 --- a/src/graph/view2D/pot2d.c.pamphlet +++ /dev/null @@ -1,83 +0,0 @@ -\documentclass{article} -\usepackage{axiom} -\begin{document} -\title{\$SPAD/src/graph/view2D pot2d.c} -\author{The Axiom Team} -\maketitle -\begin{abstract} -\end{abstract} -\eject -\tableofcontents -\eject -\section{License} -<<license>>= -/* -Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - - Neither the name of The Numerical ALgorithms Group Ltd. nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER -OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -@ -<<*>>= -<<license>> - -#define _POT2D_C -#include "axiom-c-macros.h" - -#include "header2.h" - -#include "all_2d.H1" - -mouseCoord -#ifdef _NO_PROTO -getPotValue(eX,eY,xH,yH) - short eX,eY,xH,yH; -#else -getPotValue(short eX,short eY,short xH,short yH) -#endif -{ - - mouseCoord whereMouse; - float x,y; - - x = (float)eX/xH - 1; - y = -((float)eY/yH -1); - /* make non-linear potentiometer */ - whereMouse.x = x*x*x; - whereMouse.y = y*y*y; - - return(whereMouse); - -} /* getPotValue() */ -@ -\eject -\begin{thebibliography}{99} -\bibitem{1} nothing -\end{thebibliography} -\end{document} diff --git a/src/graph/view2D/process2d.c b/src/graph/view2D/process2d.c new file mode 100644 index 00000000..7df82480 --- /dev/null +++ b/src/graph/view2D/process2d.c @@ -0,0 +1,938 @@ +/* + Copyright (C) 1991-2002, The Numerical ALgorithms Group Ltd. + All rights reserved. + Copyright (C) 2007-2008, Gabriel Dos Reis. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of The Numerical ALgorithms Group Ltd. nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#define _PROCESS2D_C +#include "axiom-c-macros.h" + +#include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/time.h> +#ifdef RIOSplatform +#include <sys/select.h> +#endif + +#include "header2.h" + +#include "all_2d.H1" +#include "util.H1" +#include "Gfun.H1" +#include "XSpadFill.H1" + + +static int doit=0; /* globish variable for picking/dropping/clearing - all sorts of + 2 button sequence events (command & graph #). */ + + +void +#ifdef _NO_PROTO +doPick (i,bKey) + int i,bKey; +#else +doPick (int i,int bKey) +#endif +{ + int vCommand=pick2D; + + picking = no; + /* reset indicator so that we're not in pick/drop/query mode anymore */ + doit = 0; + if (graphArray[currentGraph].key) { + check(write(Socket,&vCommand,intSize)); + check(write(Socket,&(graphArray[currentGraph].key),intSize)); + check(write(Socket,&(graphStateArray[currentGraph]), + sizeof(graphStateStruct))); + sprintf(control->message,"%s%d","Picked up graph ",currentGraph+1); + } else + sprintf(control->message,"%s","This graph is empty!"); + writeControlMessage(); + + +} + + +void +#ifdef _NO_PROTO +doDrop (i,bKey) + int i,bKey; +#else +doDrop (int i,int bKey) +#endif +{ + int vCommand=drop2D; + int viewGoAhead; + + dropping = no; + /* reset indicator so that we're not in pick/drop/query mode anymore */ + doit = 0; + check(write(Socket,&(vCommand),intSize)); + readViewman(&viewGoAhead,intSize); + if (viewGoAhead < 0) { + sprintf(control->message,"%s%d","Couldn't drop to graph ",currentGraph+1); + writeControlMessage(); + } else { + sprintf(control->message,"%s%d","Dropped onto graph ",currentGraph+1); + writeControlMessage(); + freeGraph(currentGraph); + readViewman(&(graphArray[currentGraph].key),intSize); + getGraphFromViewman(currentGraph); + /* simulate a button press to turn display number on and select on */ + /* need !yes since it will be inverted */ + graphStateArray[currentGraph].selected = no; + graphStateArray[currentGraph].showing = + !(graphStateArray[currentGraph].showing); + clickedOnGraph(currentGraph,currentGraph+graphStart); + clickedOnGraphSelect(currentGraph,currentGraph+graphSelectStart); + } +} + +void +#ifdef _NO_PROTO +clickedOnGraphSelect (i,bKey) + int i,bKey; +#else +clickedOnGraphSelect (int i,int bKey) +#endif +{ + int strlength; + + switch (doit) { + case pick2D: + currentGraph = i; + doPick(i,bKey); + break; + case drop2D: + currentGraph = i; + doDrop(i,bKey); + break; + case query2D: + queriedGraph = i; + makeMessageFromData(queriedGraph); + writeControlMessage(); + /* reset indicator so that we're not in pick/drop/query mode anymore */ + doit = 0; + break; + default: + graphStateArray[i].selected = !(graphStateArray[i].selected); + if (graphStateArray[i].selected) { + GSetForeground(graphGC,(float)graphBarSelectColor,Xoption); + strcpy(control->buttonQueue[bKey].text,"^"); + strlength = strlen(control->buttonQueue[bKey].text); + } else { + GSetForeground(graphGC,(float)graphBarNotSelectColor,Xoption); + strcpy(control->buttonQueue[bKey].text,"-"); + strlength = strlen(control->buttonQueue[bKey].text); + } + /* just to make sure the background is reset from clickedOnGraph */ + if (mono) { + GSetForeground(graphGC,(float)foregroundColor,Xoption); + GSetBackground(graphGC,(float)backgroundColor,Xoption); + } + + GDrawImageString(graphGC,control->controlWindow, + control->buttonQueue[bKey].buttonX + + centerX(graphGC, + control->buttonQueue[bKey].text,strlength, + control->buttonQueue[bKey].buttonWidth), + control->buttonQueue[bKey].buttonY + + centerY(graphGC, + control->buttonQueue[bKey].buttonHeight), + control->buttonQueue[bKey].text,strlength,Xoption); + GSetForeground(trashGC,(float)foregroundColor,Xoption); + GSetLineAttributes(trashGC,2,LineSolid,CapButt,JoinMiter,Xoption); + GDrawLine(trashGC,control->controlWindow,0,286,controlWidth,286,Xoption); + break; + } /* switch doit */ + +} + + +static void +#ifndef _NO_PROTO +drawControlPushButton(int isOn, int index) +#else + drawControlPushButton(isOn,index) + int isOn; + int index; +#endif +{ + GDrawPushButton(dsply, processGC, processGC, processGC, + control->controlWindow, + (control->buttonQueue[index]).buttonX, + (control->buttonQueue[index]).buttonY, + (control->buttonQueue[index]).buttonWidth, + (control->buttonQueue[index]).buttonHeight, + isOn, + (control->buttonQueue[index]).text, + buttonColor, + monoColor((control->buttonQueue[index]).textColor), Xoption); + XSync(dsply,False); +} + + + +void +#ifdef _NO_PROTO +buttonAction (bKey) + int bKey; +#else +buttonAction (int bKey) +#endif +{ + int i; + + switch (bKey) { + + case pick2D: + if (viewAloned) { + sprintf(control->message,"%s","Cannot pick without AXIOM!"); + writeControlMessage(); + XSync(dsply,False); + } + else { + doit = pick2D; + sprintf(control->message,"%s","Click on the graph to pick"); + writeControlMessage(); + XSync(dsply,False); + } + break; + + case drop2D: + if (viewAloned) { + sprintf(control->message,"%s","Cannot drop without AXIOM!"); + writeControlMessage(); + XSync(dsply,False); + } else { + doit = drop2D; + sprintf(control->message,"%s","Click on the graph to drop"); + writeControlMessage(); + XSync(dsply,False); + } + break; + + case query2D: + doit = query2D; + sprintf(control->message,"%s","Click on the graph to query"); + writeControlMessage(); + XSync(dsply,False); + break; + + + case zoom2Dx: + if (zoomXON) + strcpy((control->buttonQueue[zoom2Dx]).text , + "X Off"); + else + strcpy((control->buttonQueue[zoom2Dx]).text , + "X On "); + zoomXON = !zoomXON; + + drawControlPushButton(zoomXON, zoom2Dx); + XSync(dsply,False); + break; + + case zoom2Dy: + if (zoomYON) strcpy((control->buttonQueue[zoom2Dy]).text, + "Y Off"); + else strcpy((control->buttonQueue[zoom2Dy]).text , + "Y On "); + zoomYON = !zoomYON; + drawControlPushButton(zoomYON, zoom2Dy); + XSync(dsply,False); + break; + + + case translate2Dx: + if (transXON) strcpy((control->buttonQueue[translate2Dx]).text, + "X Off"); + else strcpy( (control->buttonQueue[translate2Dx]).text, + "X On "); + transXON = !transXON; + drawControlPushButton(transXON, translate2Dx); + XSync(dsply,False); + break; + + case translate2Dy: + if (transYON) strcpy((control->buttonQueue[translate2Dy]).text, + "Y Off"); + else strcpy( (control->buttonQueue[translate2Dy]).text, + "Y On"); + transYON = !transYON; + drawControlPushButton(transYON, translate2Dy); + XSync(dsply,False); + break; + + case pointsOnOff: + if (pointsON) strcpy((control->buttonQueue[pointsOnOff]).text, + "Pts Off"); + else strcpy( (control->buttonQueue[pointsOnOff]).text, + "Pts On "); + pointsON = !pointsON; + for (i=0; i<maxGraphs; i++) + if (graphStateArray[i].showing && graphStateArray[i].selected) + graphStateArray[i].pointsOn = pointsON; + + drawControlPushButton(pointsON, pointsOnOff); + drawViewport(Xoption); + break; + + case connectOnOff: + if (connectON) strcpy((control->buttonQueue[connectOnOff]).text, + "Lines Off"); + else strcpy( (control->buttonQueue[connectOnOff]).text, + "Lines On "); + connectON = !connectON; + for (i=0; i<maxGraphs; i++) + if (graphStateArray[i].showing && graphStateArray[i].selected) + graphStateArray[i].connectOn = connectON; + + drawControlPushButton(connectON, connectOnOff); + drawViewport(Xoption); + break; + + case spline2D: + if (splineON) strcpy((control->buttonQueue[spline2D]).text, + "Box Off"); + else strcpy ((control->buttonQueue[spline2D]).text , + "Box On "); + splineON = !splineON; + for (i=0; i<maxGraphs; i++) + if (graphStateArray[i].showing && graphStateArray[i].selected) + graphStateArray[i].splineOn = splineON; + + drawControlPushButton(splineON, spline2D); + drawViewport(Xoption); + break; + + case axesOnOff2D: + if (axesON) + strcpy ((control->buttonQueue[axesOnOff2D]).text, + "Axes Off"); + else + strcpy ((control->buttonQueue[axesOnOff2D]).text , + "Axes On "); + axesON = !axesON; + for (i=0; i<maxGraphs; i++) + if (graphStateArray[i].showing && graphStateArray[i].selected) + graphStateArray[i].axesOn = axesON; + + drawControlPushButton(axesON, axesOnOff2D); + drawViewport(Xoption); + break; + + case unitsOnOff2D: + if (unitsON) + strcpy( (control->buttonQueue[unitsOnOff2D]).text, + "Units Off"); + else + strcpy ((control->buttonQueue[unitsOnOff2D]).text, + "Units On "); + unitsON = !unitsON; + for (i=0; i<maxGraphs; i++) + if (graphStateArray[i].showing && graphStateArray[i].selected) + graphStateArray[i].unitsOn = unitsON; + + drawControlPushButton(unitsON, unitsOnOff2D); + drawViewport(Xoption); + break; + + case ps2D: + strcpy(control->message,"Creating postscript now ..."); + writeControlMessage(); + drawControlPushButton(1, ps2D); + + if (PSInit(viewport->viewWindow, viewport->titleWindow) == psError) { + strcpy(control->message,"Aborted: PSInit error."); + writeControlMessage(); + drawControlPushButton(0, ps2D); + XSync(dsply,False); + return; /* make new temp name for new file */ + } + + drawViewport(PSoption); /* draw picture in PS; create ps script file */ + + if (PSCreateFile(viewBorderWidth, + viewport->viewWindow, + viewport->titleWindow, + viewport->title) == psError) { + strcpy(control->message,"Aborted: PSCreateFile error."); + writeControlMessage(); + drawControlPushButton(0, ps2D); + XSync(dsply,False); + return; + } + + clearControlMessage(); + strcpy(control->message,PSfilename); + strcat(control->message," in working dir "); + writeControlMessage(); + drawControlPushButton(0, ps2D); + XSync(dsply,False); + break; + + case hideControl2D: + if (viewport->haveControl) { + viewport->haveControl = no; + XUnmapWindow(dsply,control->controlWindow); + XSync(dsply,False); + } + break; + + case reset2D: + /* reset view */ + for (i=0; i<maxGraphs; i++) + if (graphStateArray[i].showing && graphStateArray[i].selected) + graphStateArray[i] = graphStateBackupArray[i]; + + unitsON = no; + strcpy( (control->buttonQueue[unitsOnOff2D]).text,s = "Units Off"); + for (i=0; i<maxGraphs; i++) + if (graphStateArray[i].showing && graphStateArray[i].selected) + graphStateArray[i].unitsOn = no; + drawControlPushButton(unitsON, unitsOnOff2D); + + pointsON = yes; + strcpy ((control->buttonQueue[pointsOnOff]).text ,"Pts On "); + for (i=0; i<maxGraphs; i++) + if (graphStateArray[i].showing && graphStateArray[i].selected) + graphStateArray[i].pointsOn = yes; + drawControlPushButton(pointsON, pointsOnOff); + + axesON = yes; + strcpy ((control->buttonQueue[axesOnOff2D]).text,"Axes On "); + for (i=0; i<maxGraphs; i++) + if (graphStateArray[i].showing && graphStateArray[i].selected) + graphStateArray[i].axesOn = yes; + drawControlPushButton(axesON, axesOnOff2D); + + connectON = yes; + strcpy((control->buttonQueue[connectOnOff]).text,"Lines On "); + for (i=0; i<maxGraphs; i++) + if (graphStateArray[i].showing && graphStateArray[i].selected) + graphStateArray[i].connectOn = yes; + drawControlPushButton(connectON, connectOnOff); + + splineON = no; + strcpy( (control->buttonQueue[connectOnOff]).text ,"Box Off"); + for (i=0; i<maxGraphs; i++) + if (graphStateArray[i].showing && graphStateArray[i].selected) + graphStateArray[i].splineOn = splineON; + drawControlPushButton(splineON, spline2D); + drawViewport(Xoption); + + break; + + case closeAll2D: + strcpy(control->message," Click again to confirm "); + writeControlMessage(); + drawControlPushButton(1, closeAll2D); + XSync(dsply,False); + viewport->closing = yes; + break; + + case clear2D: + for (i=0; i<maxGraphs; i++) graphStateArray[i].selected = 1; + clickedOnGraphSelect(0,graphSelect1); + clickedOnGraphSelect(1,graphSelect2); + clickedOnGraphSelect(2,graphSelect3); + clickedOnGraphSelect(3,graphSelect4); + clickedOnGraphSelect(4,graphSelect5); + clickedOnGraphSelect(5,graphSelect6); + clickedOnGraphSelect(6,graphSelect7); + clickedOnGraphSelect(7,graphSelect8); + clickedOnGraphSelect(8,graphSelect9); + XSync(dsply,False); + break; + + case graph1: + case graph2: + case graph3: + case graph4: + case graph5: + case graph6: + case graph7: + case graph8: + case graph9: + clickedOnGraph(bKey-graphStart,bKey); + XSync(dsply,False); + break; + + case graphSelect1: + case graphSelect2: + case graphSelect3: + case graphSelect4: + case graphSelect5: + case graphSelect6: + case graphSelect7: + case graphSelect8: + case graphSelect9: + clickedOnGraphSelect(bKey-graphSelectStart,bKey); + XSync(dsply,False); + break; + + } /* switch (action) */ +} + +/*********************** X Event Processing ***************************/ +void +#ifdef _NO_PROTO +processEvents() +#else +processEvents(void) +#endif +{ + + XEvent *event, + tempEvent; + Window whichWindow; + XWindowAttributes graphWindowAttrib; + buttonStruct *controlButton; + mouseCoord mouseXY; + int i, + someInt, + mouseW4, + mouseH4, + toggleReady, + gotToggle = no, + checkButton = no, + firstTime = yes, + gotEvent = 0, + buttonTablePtr, + Xcon, + len, + externalControl; + fd_set rd; + + + externalControl=0; + Xcon = ConnectionNumber(dsply); + + + if (!(event = (XEvent *)malloc(sizeof(XEvent)))) { + fprintf(stderr,"Ran out of memory initializing event processing.\n"); + exitWithAck(RootWindow(dsply,scrn),Window,-1); + } + + controlButton = control->buttonQueue; + + while(1) { + + len=0; + while(len<=0) { + FD_ZERO(&rd); + if (externalControl==0) FD_SET(0, &rd); + FD_SET(Xcon,&rd); + + if (XEventsQueued(dsply, QueuedAlready)) { + len=1; + break; + } + if (!followMouse) + len=select(FD_SETSIZE,(void *) &rd,0,0,0); + else + len=1; + } + if (FD_ISSET(Xcon,&rd)|| + XEventsQueued(dsply, QueuedAfterFlush) || + followMouse) { + + if (followMouse) { + if (XPending(dsply)) + XNextEvent(dsply,event); + gotEvent++; + } else { + XNextEvent(dsply,event); + gotEvent++; + } + + if (gotToggle || !followMouse) + checkButton = no; + + if (gotEvent) { + whichWindow = ((XButtonEvent *)event)->window; + firstTime = no; + + switch(((XEvent *)event)->type) { + + case ClientMessage: + if (event->xclient.data.l[0] == wm_delete_window) { + goodbye(-1); + } + else { + fprintf(stderr,"Unknown Client Message ...\n"); + } + break; + case Expose: + if (whichWindow == viewport->titleWindow) { + /* get rid of redundant events */ + XCheckWindowEvent(dsply, + viewport->titleWindow, + ExposureMask, + &tempEvent); + writeTitle(); + XGetWindowAttributes(dsply, + whichWindow, + &graphWindowAttrib); + XResizeWindow(dsply, + viewport->viewWindow, + graphWindowAttrib.width, + graphWindowAttrib.height-titleHeight); + XSync(dsply,False); + break; + } else if (whichWindow == viewport->viewWindow) { + XCheckWindowEvent(dsply, + viewport->viewWindow, + ExposureMask, + &tempEvent); + XGetWindowAttributes(dsply, + viewport->titleWindow, + &graphWindowAttrib); + XResizeWindow(dsply, + viewport->viewWindow, + graphWindowAttrib.width, + graphWindowAttrib.height-titleHeight); + drawViewport(Xoption); + XMapWindow(dsply,whichWindow); + XSync(dsply,False); + break; + } else { /* it's gotta be the control panel */ + XGetWindowAttributes(dsply, + control->controlWindow, + &graphWindowAttrib); + /* do not allow resizing of control panel */ + if ((graphWindowAttrib.width != controlWidth) || + (graphWindowAttrib.height != controlHeight)) { + XResizeWindow(dsply, + control->controlWindow, + controlWidth, + controlHeight); + } + drawControlPanel(); + XSync(dsply,False); + break; + } + break; + + case MotionNotify: + if (followMouse) { + while (XCheckMaskEvent(dsply, + ButtonMotionMask, + event)); + mouseXY = getPotValue(((XButtonEvent *)event)->x, + ((XButtonEvent *)event)->y, + controlButton->xHalf, + controlButton->yHalf); + } + if (controlButton->pot) { + gotToggle = no; + checkButton = yes; + } + break; + + case ButtonRelease: + if (followMouse==yes) { + followMouse = no; + toggleReady = yes; + checkButton = no; + drawViewport(Xoption); + } else { + followMouse = no; + toggleReady = yes; + checkButton = no; + } + break; + + case LeaveNotify: + /* + We still follow the mouse when we leave the pots. + */ + /* + followMouse = no; + toggleReady = yes; + checkButton = no; + */ + + break; + + case ButtonPress: + if (whichWindow == viewport->viewWindow) { + + /* mouse clicked on viewport */ + + switch (((XButtonEvent *)event)->button) { + case Button3: + + /* print out (x,y) object-space coordinates in message area */ + + XGetWindowAttributes(dsply,whichWindow,&graphWindowAttrib); + sprintf(viewport->controlPanel->message, + " >%d<: [%6.2f,%6.2f] ", + queriedGraph+1, + projX((((XButtonEvent *)event)->x), + graphWindowAttrib.width,queriedGraph), + projY((((XButtonEvent *)event)->y), + graphWindowAttrib.height,queriedGraph)); + writeControlMessage(); + XFlush(dsply); + break; + default: + + /* Find where mouse is on the viewport => where to put the CP */ + + XGetWindowAttributes(dsply, + whichWindow, + &graphWindowAttrib); + mouseW4 = graphWindowAttrib.width/4; + if (((XButtonEvent *)event)->x > + (graphWindowAttrib.width - mouseW4)) + someInt = 1; + else { + mouseH4 = graphWindowAttrib.height/4; + if (((XButtonEvent *)event)->y > + (graphWindowAttrib.height - mouseH4)) + someInt = 2; + else if (((XButtonEvent *)event)->x < mouseW4) + someInt = 3; + else if (((XButtonEvent *)event)->y < mouseH4) + someInt = 4; + else someInt = 0; + } + if (viewport->haveControl) { + XUnmapWindow(dsply,control->controlWindow); + } + putControlPanelSomewhere(someInt); + XMapWindow(dsply,control->controlWindow); + XSync(dsply,False); + break; + } /* switch on mouse button */ + } else if (whichWindow == control->colormapWindow) { + + /* mouse clicked on colormap */ + + followMouse = yes; + gotToggle = no; + checkButton = yes; + firstTime = yes; + } else if (whichWindow != control->controlWindow) { + + /* mouse clicked on control window (not colormap) */ + + if (controlButton->self != whichWindow) { + buttonTablePtr = *((int *)XLookUpAssoc(dsply,table,whichWindow)); + controlButton = &(control->buttonQueue[buttonTablePtr]); + } + + if (controlButton->pot) { + /* figure out [x,y] for this button in the range [-1..1,-1..1] */ + mouseXY = getPotValue(((XButtonEvent *)event)->x, + ((XButtonEvent *)event)->y, + controlButton->xHalf, + controlButton->yHalf); + followMouse = yes; + gotToggle = no; + } else { + followMouse = no; + gotToggle = yes; /* auto-repeat on toggle buttons not allowed */ + if (toggleReady) { + toggleReady = no; + } + } + checkButton = yes; + firstTime = yes; + } + break; + + } /* switch */ + gotEvent--; + } /* if gotEvent */ + + + /* Allow repeat polling when mouse button clicked on a potentiometer. */ + + if (followMouse && !firstTime && (followMouse++ > mouseWait)) { + followMouse = yes; /* reset for next timing loop */ + checkButton = yes; + } + if (checkButton) { + if (viewport->closing && (controlButton->buttonKey == closeAll2D)) { + goodbye(-1); + } else { + clearControlMessage(); + viewport->closing = no; + drawControlPushButton(0, closeAll2D); + if ((doit) && + ((controlButton->buttonKey < graphStart) && + (controlButton->buttonKey > (graphSelectStart + maxGraphs)))) + doit = 0; + + switch(controlButton->buttonKey) { + + case translate2D: + for (i=0; i<maxGraphs; i++) { + if (graphStateArray[i].showing && graphStateArray[i].selected) { + if (transXON) { + graphStateArray[i].centerX -= mouseXY.x * 0.1; + if (graphStateArray[i].centerX > maxDelta) + graphStateArray[i].centerX = maxDelta; + else if (graphStateArray[i].centerX < -maxDelta) + graphStateArray[i].centerX = maxDelta; + } + if (transYON) { + graphStateArray[i].centerY -= mouseXY.y * 0.1; + if (graphStateArray[i].centerY > maxDelta) + graphStateArray[i].centerY = maxDelta; + else if (graphStateArray[i].centerY < -maxDelta) + graphStateArray[i].centerY = maxDelta; + } + } /* graph showing or selected */ + } /* for graphs */ + drawViewport(Xoption); + break; + + case scale2D: + for (i=0; i<maxGraphs; i++) { + if (graphStateArray[i].showing && graphStateArray[i].selected) { + if (zoomXON) { + graphStateArray[i].scaleX *= (1 - mouseXY.y * 0.3); + if (graphStateArray[i].scaleX > maxScale) + graphStateArray[i].scaleX = maxScale; + else if (graphStateArray[i].scaleX < minScale) + graphStateArray[i].scaleX = minScale; + } + if (zoomYON) { + graphStateArray[i].scaleY *= (1 - mouseXY.y * 0.3); + if (graphStateArray[i].scaleY > maxScale) + graphStateArray[i].scaleY = maxScale; + else if (graphStateArray[i].scaleY < minScale) + graphStateArray[i].scaleY = minScale; + } + } /* graph showing or selected */ + } /* for graphs */ + drawViewport(Xoption); + break; + + default: + buttonAction(controlButton->buttonKey); + } /* switch on buttonKey */ + } /* else - not closing */ + } /* if checkButton */ + } /* if FD_ISSET(Xcon.... */ + else if FD_ISSET(0,&rd) { + externalControl=spadAction(); /* returns (-1) if broken ,0 if success */ + if (spadDraw && (externalControl==0)) drawViewport(Xoption); + } + } /* while */ +} /* processEvents() */ + + + + + + +void +#ifdef _NO_PROTO +clickedOnGraph (i,bKey) + int i,bKey; +#else +clickedOnGraph (int i,int bKey) +#endif +{ + + switch (doit) { + case pick2D: + currentGraph = queriedGraph = i; + doPick(i,bKey); + break; + case drop2D: + currentGraph = queriedGraph = i; + doDrop(i,bKey); + break; + case query2D: + queriedGraph = i; + makeMessageFromData(queriedGraph); + writeControlMessage(); + /* reset indicator so that we're not in pick/drop/query mode anymore */ + doit = 0; + break; + default: + graphStateArray[i].showing = !(graphStateArray[i].showing); + if (mono) { + if (graphStateArray[i].showing) { + GSetForeground(graphGC,(float)backgroundColor,Xoption); + GSetBackground(graphGC,(float)foregroundColor,Xoption); + } else { + GSetForeground(graphGC,(float)foregroundColor,Xoption); + GSetBackground(graphGC,(float)backgroundColor,Xoption); + } + GDrawImageString(graphGC, + control->controlWindow, + (control->buttonQueue[bKey]).buttonX + + centerX(graphGC,(control->buttonQueue[bKey]).text,1, + (control->buttonQueue[bKey]).buttonWidth), + (control->buttonQueue[bKey]).buttonY + + centerY(graphGC,(control->buttonQueue[bKey]).buttonHeight), + (control->buttonQueue[bKey]).text, + 1, + Xoption); + } else { + if (graphStateArray[i].showing) + GSetForeground(graphGC,(float)graphBarShowingColor,Xoption); + else + GSetForeground(graphGC,(float)graphBarHiddenColor,Xoption); + GDrawString(graphGC, + control->controlWindow, + (control->buttonQueue[bKey]).buttonX + + centerX(graphGC,(control->buttonQueue[bKey]).text,1, + (control->buttonQueue[bKey]).buttonWidth), + (control->buttonQueue[bKey]).buttonY + + centerY(graphGC,(control->buttonQueue[bKey]).buttonHeight), + (control->buttonQueue[bKey]).text,1,Xoption); + } + drawViewport(Xoption); + break; + } /* switch doit */ + +} + + + + + + + + + diff --git a/src/graph/view2D/process2d.c.pamphlet b/src/graph/view2D/process2d.c.pamphlet deleted file mode 100644 index 11c1c34b..00000000 --- a/src/graph/view2D/process2d.c.pamphlet +++ /dev/null @@ -1,958 +0,0 @@ -\documentclass{article} -\usepackage{axiom} -\begin{document} -\title{\$SPAD/src/graph/view2D process2d.c} -\author{The Axiom Team} -\maketitle -\begin{abstract} -\end{abstract} -\eject -\tableofcontents -\eject -\section{License} -<<license>>= -/* -Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - - Neither the name of The Numerical ALgorithms Group Ltd. nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER -OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -@ -<<*>>= -<<license>> - -#define _PROCESS2D_C -#include "axiom-c-macros.h" - -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <sys/types.h> -#include <sys/time.h> -#ifdef RIOSplatform -#include <sys/select.h> -#endif - -#include "header2.h" - -#include "all_2d.H1" -#include "util.H1" -#include "Gfun.H1" -#include "XSpadFill.H1" - - -static int doit=0; /* globish variable for picking/dropping/clearing - all sorts of - 2 button sequence events (command & graph #). */ - - -void -#ifdef _NO_PROTO -doPick (i,bKey) - int i,bKey; -#else -doPick (int i,int bKey) -#endif -{ - int vCommand=pick2D; - - picking = no; - /* reset indicator so that we're not in pick/drop/query mode anymore */ - doit = 0; - if (graphArray[currentGraph].key) { - check(write(Socket,&vCommand,intSize)); - check(write(Socket,&(graphArray[currentGraph].key),intSize)); - check(write(Socket,&(graphStateArray[currentGraph]), - sizeof(graphStateStruct))); - sprintf(control->message,"%s%d","Picked up graph ",currentGraph+1); - } else - sprintf(control->message,"%s","This graph is empty!"); - writeControlMessage(); - - -} - - -void -#ifdef _NO_PROTO -doDrop (i,bKey) - int i,bKey; -#else -doDrop (int i,int bKey) -#endif -{ - int vCommand=drop2D; - int viewGoAhead; - - dropping = no; - /* reset indicator so that we're not in pick/drop/query mode anymore */ - doit = 0; - check(write(Socket,&(vCommand),intSize)); - readViewman(&viewGoAhead,intSize); - if (viewGoAhead < 0) { - sprintf(control->message,"%s%d","Couldn't drop to graph ",currentGraph+1); - writeControlMessage(); - } else { - sprintf(control->message,"%s%d","Dropped onto graph ",currentGraph+1); - writeControlMessage(); - freeGraph(currentGraph); - readViewman(&(graphArray[currentGraph].key),intSize); - getGraphFromViewman(currentGraph); - /* simulate a button press to turn display number on and select on */ - /* need !yes since it will be inverted */ - graphStateArray[currentGraph].selected = no; - graphStateArray[currentGraph].showing = - !(graphStateArray[currentGraph].showing); - clickedOnGraph(currentGraph,currentGraph+graphStart); - clickedOnGraphSelect(currentGraph,currentGraph+graphSelectStart); - } -} - -void -#ifdef _NO_PROTO -clickedOnGraphSelect (i,bKey) - int i,bKey; -#else -clickedOnGraphSelect (int i,int bKey) -#endif -{ - int strlength; - - switch (doit) { - case pick2D: - currentGraph = i; - doPick(i,bKey); - break; - case drop2D: - currentGraph = i; - doDrop(i,bKey); - break; - case query2D: - queriedGraph = i; - makeMessageFromData(queriedGraph); - writeControlMessage(); - /* reset indicator so that we're not in pick/drop/query mode anymore */ - doit = 0; - break; - default: - graphStateArray[i].selected = !(graphStateArray[i].selected); - if (graphStateArray[i].selected) { - GSetForeground(graphGC,(float)graphBarSelectColor,Xoption); - strcpy(control->buttonQueue[bKey].text,"^"); - strlength = strlen(control->buttonQueue[bKey].text); - } else { - GSetForeground(graphGC,(float)graphBarNotSelectColor,Xoption); - strcpy(control->buttonQueue[bKey].text,"-"); - strlength = strlen(control->buttonQueue[bKey].text); - } - /* just to make sure the background is reset from clickedOnGraph */ - if (mono) { - GSetForeground(graphGC,(float)foregroundColor,Xoption); - GSetBackground(graphGC,(float)backgroundColor,Xoption); - } - - GDrawImageString(graphGC,control->controlWindow, - control->buttonQueue[bKey].buttonX + - centerX(graphGC, - control->buttonQueue[bKey].text,strlength, - control->buttonQueue[bKey].buttonWidth), - control->buttonQueue[bKey].buttonY + - centerY(graphGC, - control->buttonQueue[bKey].buttonHeight), - control->buttonQueue[bKey].text,strlength,Xoption); - GSetForeground(trashGC,(float)foregroundColor,Xoption); - GSetLineAttributes(trashGC,2,LineSolid,CapButt,JoinMiter,Xoption); - GDrawLine(trashGC,control->controlWindow,0,286,controlWidth,286,Xoption); - break; - } /* switch doit */ - -} - - -static void -#ifndef _NO_PROTO -drawControlPushButton(int isOn, int index) -#else - drawControlPushButton(isOn,index) - int isOn; - int index; -#endif -{ - GDrawPushButton(dsply, processGC, processGC, processGC, - control->controlWindow, - (control->buttonQueue[index]).buttonX, - (control->buttonQueue[index]).buttonY, - (control->buttonQueue[index]).buttonWidth, - (control->buttonQueue[index]).buttonHeight, - isOn, - (control->buttonQueue[index]).text, - buttonColor, - monoColor((control->buttonQueue[index]).textColor), Xoption); - XSync(dsply,False); -} - - - -void -#ifdef _NO_PROTO -buttonAction (bKey) - int bKey; -#else -buttonAction (int bKey) -#endif -{ - int i; - - switch (bKey) { - - case pick2D: - if (viewAloned) { - sprintf(control->message,"%s","Cannot pick without AXIOM!"); - writeControlMessage(); - XSync(dsply,False); - } - else { - doit = pick2D; - sprintf(control->message,"%s","Click on the graph to pick"); - writeControlMessage(); - XSync(dsply,False); - } - break; - - case drop2D: - if (viewAloned) { - sprintf(control->message,"%s","Cannot drop without AXIOM!"); - writeControlMessage(); - XSync(dsply,False); - } else { - doit = drop2D; - sprintf(control->message,"%s","Click on the graph to drop"); - writeControlMessage(); - XSync(dsply,False); - } - break; - - case query2D: - doit = query2D; - sprintf(control->message,"%s","Click on the graph to query"); - writeControlMessage(); - XSync(dsply,False); - break; - - - case zoom2Dx: - if (zoomXON) - strcpy((control->buttonQueue[zoom2Dx]).text , - "X Off"); - else - strcpy((control->buttonQueue[zoom2Dx]).text , - "X On "); - zoomXON = !zoomXON; - - drawControlPushButton(zoomXON, zoom2Dx); - XSync(dsply,False); - break; - - case zoom2Dy: - if (zoomYON) strcpy((control->buttonQueue[zoom2Dy]).text, - "Y Off"); - else strcpy((control->buttonQueue[zoom2Dy]).text , - "Y On "); - zoomYON = !zoomYON; - drawControlPushButton(zoomYON, zoom2Dy); - XSync(dsply,False); - break; - - - case translate2Dx: - if (transXON) strcpy((control->buttonQueue[translate2Dx]).text, - "X Off"); - else strcpy( (control->buttonQueue[translate2Dx]).text, - "X On "); - transXON = !transXON; - drawControlPushButton(transXON, translate2Dx); - XSync(dsply,False); - break; - - case translate2Dy: - if (transYON) strcpy((control->buttonQueue[translate2Dy]).text, - "Y Off"); - else strcpy( (control->buttonQueue[translate2Dy]).text, - "Y On"); - transYON = !transYON; - drawControlPushButton(transYON, translate2Dy); - XSync(dsply,False); - break; - - case pointsOnOff: - if (pointsON) strcpy((control->buttonQueue[pointsOnOff]).text, - "Pts Off"); - else strcpy( (control->buttonQueue[pointsOnOff]).text, - "Pts On "); - pointsON = !pointsON; - for (i=0; i<maxGraphs; i++) - if (graphStateArray[i].showing && graphStateArray[i].selected) - graphStateArray[i].pointsOn = pointsON; - - drawControlPushButton(pointsON, pointsOnOff); - drawViewport(Xoption); - break; - - case connectOnOff: - if (connectON) strcpy((control->buttonQueue[connectOnOff]).text, - "Lines Off"); - else strcpy( (control->buttonQueue[connectOnOff]).text, - "Lines On "); - connectON = !connectON; - for (i=0; i<maxGraphs; i++) - if (graphStateArray[i].showing && graphStateArray[i].selected) - graphStateArray[i].connectOn = connectON; - - drawControlPushButton(connectON, connectOnOff); - drawViewport(Xoption); - break; - - case spline2D: - if (splineON) strcpy((control->buttonQueue[spline2D]).text, - "Box Off"); - else strcpy ((control->buttonQueue[spline2D]).text , - "Box On "); - splineON = !splineON; - for (i=0; i<maxGraphs; i++) - if (graphStateArray[i].showing && graphStateArray[i].selected) - graphStateArray[i].splineOn = splineON; - - drawControlPushButton(splineON, spline2D); - drawViewport(Xoption); - break; - - case axesOnOff2D: - if (axesON) - strcpy ((control->buttonQueue[axesOnOff2D]).text, - "Axes Off"); - else - strcpy ((control->buttonQueue[axesOnOff2D]).text , - "Axes On "); - axesON = !axesON; - for (i=0; i<maxGraphs; i++) - if (graphStateArray[i].showing && graphStateArray[i].selected) - graphStateArray[i].axesOn = axesON; - - drawControlPushButton(axesON, axesOnOff2D); - drawViewport(Xoption); - break; - - case unitsOnOff2D: - if (unitsON) - strcpy( (control->buttonQueue[unitsOnOff2D]).text, - "Units Off"); - else - strcpy ((control->buttonQueue[unitsOnOff2D]).text, - "Units On "); - unitsON = !unitsON; - for (i=0; i<maxGraphs; i++) - if (graphStateArray[i].showing && graphStateArray[i].selected) - graphStateArray[i].unitsOn = unitsON; - - drawControlPushButton(unitsON, unitsOnOff2D); - drawViewport(Xoption); - break; - - case ps2D: - strcpy(control->message,"Creating postscript now ..."); - writeControlMessage(); - drawControlPushButton(1, ps2D); - - if (PSInit(viewport->viewWindow, viewport->titleWindow) == psError) { - strcpy(control->message,"Aborted: PSInit error."); - writeControlMessage(); - drawControlPushButton(0, ps2D); - XSync(dsply,False); - return; /* make new temp name for new file */ - } - - drawViewport(PSoption); /* draw picture in PS; create ps script file */ - - if (PSCreateFile(viewBorderWidth, - viewport->viewWindow, - viewport->titleWindow, - viewport->title) == psError) { - strcpy(control->message,"Aborted: PSCreateFile error."); - writeControlMessage(); - drawControlPushButton(0, ps2D); - XSync(dsply,False); - return; - } - - clearControlMessage(); - strcpy(control->message,PSfilename); - strcat(control->message," in working dir "); - writeControlMessage(); - drawControlPushButton(0, ps2D); - XSync(dsply,False); - break; - - case hideControl2D: - if (viewport->haveControl) { - viewport->haveControl = no; - XUnmapWindow(dsply,control->controlWindow); - XSync(dsply,False); - } - break; - - case reset2D: - /* reset view */ - for (i=0; i<maxGraphs; i++) - if (graphStateArray[i].showing && graphStateArray[i].selected) - graphStateArray[i] = graphStateBackupArray[i]; - - unitsON = no; - strcpy( (control->buttonQueue[unitsOnOff2D]).text,s = "Units Off"); - for (i=0; i<maxGraphs; i++) - if (graphStateArray[i].showing && graphStateArray[i].selected) - graphStateArray[i].unitsOn = no; - drawControlPushButton(unitsON, unitsOnOff2D); - - pointsON = yes; - strcpy ((control->buttonQueue[pointsOnOff]).text ,"Pts On "); - for (i=0; i<maxGraphs; i++) - if (graphStateArray[i].showing && graphStateArray[i].selected) - graphStateArray[i].pointsOn = yes; - drawControlPushButton(pointsON, pointsOnOff); - - axesON = yes; - strcpy ((control->buttonQueue[axesOnOff2D]).text,"Axes On "); - for (i=0; i<maxGraphs; i++) - if (graphStateArray[i].showing && graphStateArray[i].selected) - graphStateArray[i].axesOn = yes; - drawControlPushButton(axesON, axesOnOff2D); - - connectON = yes; - strcpy((control->buttonQueue[connectOnOff]).text,"Lines On "); - for (i=0; i<maxGraphs; i++) - if (graphStateArray[i].showing && graphStateArray[i].selected) - graphStateArray[i].connectOn = yes; - drawControlPushButton(connectON, connectOnOff); - - splineON = no; - strcpy( (control->buttonQueue[connectOnOff]).text ,"Box Off"); - for (i=0; i<maxGraphs; i++) - if (graphStateArray[i].showing && graphStateArray[i].selected) - graphStateArray[i].splineOn = splineON; - drawControlPushButton(splineON, spline2D); - drawViewport(Xoption); - - break; - - case closeAll2D: - strcpy(control->message," Click again to confirm "); - writeControlMessage(); - drawControlPushButton(1, closeAll2D); - XSync(dsply,False); - viewport->closing = yes; - break; - - case clear2D: - for (i=0; i<maxGraphs; i++) graphStateArray[i].selected = 1; - clickedOnGraphSelect(0,graphSelect1); - clickedOnGraphSelect(1,graphSelect2); - clickedOnGraphSelect(2,graphSelect3); - clickedOnGraphSelect(3,graphSelect4); - clickedOnGraphSelect(4,graphSelect5); - clickedOnGraphSelect(5,graphSelect6); - clickedOnGraphSelect(6,graphSelect7); - clickedOnGraphSelect(7,graphSelect8); - clickedOnGraphSelect(8,graphSelect9); - XSync(dsply,False); - break; - - case graph1: - case graph2: - case graph3: - case graph4: - case graph5: - case graph6: - case graph7: - case graph8: - case graph9: - clickedOnGraph(bKey-graphStart,bKey); - XSync(dsply,False); - break; - - case graphSelect1: - case graphSelect2: - case graphSelect3: - case graphSelect4: - case graphSelect5: - case graphSelect6: - case graphSelect7: - case graphSelect8: - case graphSelect9: - clickedOnGraphSelect(bKey-graphSelectStart,bKey); - XSync(dsply,False); - break; - - } /* switch (action) */ -} - -/*********************** X Event Processing ***************************/ -void -#ifdef _NO_PROTO -processEvents() -#else -processEvents(void) -#endif -{ - - XEvent *event, - tempEvent; - Window whichWindow; - XWindowAttributes graphWindowAttrib; - buttonStruct *controlButton; - mouseCoord mouseXY; - int i, - someInt, - mouseW4, - mouseH4, - toggleReady, - gotToggle = no, - checkButton = no, - firstTime = yes, - gotEvent = 0, - buttonTablePtr, - Xcon, - len, - externalControl; - fd_set rd; - - - externalControl=0; - Xcon = ConnectionNumber(dsply); - - - if (!(event = (XEvent *)malloc(sizeof(XEvent)))) { - fprintf(stderr,"Ran out of memory initializing event processing.\n"); - exitWithAck(RootWindow(dsply,scrn),Window,-1); - } - - controlButton = control->buttonQueue; - - while(1) { - - len=0; - while(len<=0) { - FD_ZERO(&rd); - if (externalControl==0) FD_SET(0, &rd); - FD_SET(Xcon,&rd); - - if (XEventsQueued(dsply, QueuedAlready)) { - len=1; - break; - } - if (!followMouse) - len=select(FD_SETSIZE,(void *) &rd,0,0,0); - else - len=1; - } - if (FD_ISSET(Xcon,&rd)|| - XEventsQueued(dsply, QueuedAfterFlush) || - followMouse) { - - if (followMouse) { - if (XPending(dsply)) - XNextEvent(dsply,event); - gotEvent++; - } else { - XNextEvent(dsply,event); - gotEvent++; - } - - if (gotToggle || !followMouse) - checkButton = no; - - if (gotEvent) { - whichWindow = ((XButtonEvent *)event)->window; - firstTime = no; - - switch(((XEvent *)event)->type) { - - case ClientMessage: - if (event->xclient.data.l[0] == wm_delete_window) { - goodbye(-1); - } - else { - fprintf(stderr,"Unknown Client Message ...\n"); - } - break; - case Expose: - if (whichWindow == viewport->titleWindow) { - /* get rid of redundant events */ - XCheckWindowEvent(dsply, - viewport->titleWindow, - ExposureMask, - &tempEvent); - writeTitle(); - XGetWindowAttributes(dsply, - whichWindow, - &graphWindowAttrib); - XResizeWindow(dsply, - viewport->viewWindow, - graphWindowAttrib.width, - graphWindowAttrib.height-titleHeight); - XSync(dsply,False); - break; - } else if (whichWindow == viewport->viewWindow) { - XCheckWindowEvent(dsply, - viewport->viewWindow, - ExposureMask, - &tempEvent); - XGetWindowAttributes(dsply, - viewport->titleWindow, - &graphWindowAttrib); - XResizeWindow(dsply, - viewport->viewWindow, - graphWindowAttrib.width, - graphWindowAttrib.height-titleHeight); - drawViewport(Xoption); - XMapWindow(dsply,whichWindow); - XSync(dsply,False); - break; - } else { /* it's gotta be the control panel */ - XGetWindowAttributes(dsply, - control->controlWindow, - &graphWindowAttrib); - /* do not allow resizing of control panel */ - if ((graphWindowAttrib.width != controlWidth) || - (graphWindowAttrib.height != controlHeight)) { - XResizeWindow(dsply, - control->controlWindow, - controlWidth, - controlHeight); - } - drawControlPanel(); - XSync(dsply,False); - break; - } - break; - - case MotionNotify: - if (followMouse) { - while (XCheckMaskEvent(dsply, - ButtonMotionMask, - event)); - mouseXY = getPotValue(((XButtonEvent *)event)->x, - ((XButtonEvent *)event)->y, - controlButton->xHalf, - controlButton->yHalf); - } - if (controlButton->pot) { - gotToggle = no; - checkButton = yes; - } - break; - - case ButtonRelease: - if (followMouse==yes) { - followMouse = no; - toggleReady = yes; - checkButton = no; - drawViewport(Xoption); - } else { - followMouse = no; - toggleReady = yes; - checkButton = no; - } - break; - - case LeaveNotify: - /* - We still follow the mouse when we leave the pots. - */ - /* - followMouse = no; - toggleReady = yes; - checkButton = no; - */ - - break; - - case ButtonPress: - if (whichWindow == viewport->viewWindow) { - - /* mouse clicked on viewport */ - - switch (((XButtonEvent *)event)->button) { - case Button3: - - /* print out (x,y) object-space coordinates in message area */ - - XGetWindowAttributes(dsply,whichWindow,&graphWindowAttrib); - sprintf(viewport->controlPanel->message, - " >%d<: [%6.2f,%6.2f] ", - queriedGraph+1, - projX((((XButtonEvent *)event)->x), - graphWindowAttrib.width,queriedGraph), - projY((((XButtonEvent *)event)->y), - graphWindowAttrib.height,queriedGraph)); - writeControlMessage(); - XFlush(dsply); - break; - default: - - /* Find where mouse is on the viewport => where to put the CP */ - - XGetWindowAttributes(dsply, - whichWindow, - &graphWindowAttrib); - mouseW4 = graphWindowAttrib.width/4; - if (((XButtonEvent *)event)->x > - (graphWindowAttrib.width - mouseW4)) - someInt = 1; - else { - mouseH4 = graphWindowAttrib.height/4; - if (((XButtonEvent *)event)->y > - (graphWindowAttrib.height - mouseH4)) - someInt = 2; - else if (((XButtonEvent *)event)->x < mouseW4) - someInt = 3; - else if (((XButtonEvent *)event)->y < mouseH4) - someInt = 4; - else someInt = 0; - } - if (viewport->haveControl) { - XUnmapWindow(dsply,control->controlWindow); - } - putControlPanelSomewhere(someInt); - XMapWindow(dsply,control->controlWindow); - XSync(dsply,False); - break; - } /* switch on mouse button */ - } else if (whichWindow == control->colormapWindow) { - - /* mouse clicked on colormap */ - - followMouse = yes; - gotToggle = no; - checkButton = yes; - firstTime = yes; - } else if (whichWindow != control->controlWindow) { - - /* mouse clicked on control window (not colormap) */ - - if (controlButton->self != whichWindow) { - buttonTablePtr = *((int *)XLookUpAssoc(dsply,table,whichWindow)); - controlButton = &(control->buttonQueue[buttonTablePtr]); - } - - if (controlButton->pot) { - /* figure out [x,y] for this button in the range [-1..1,-1..1] */ - mouseXY = getPotValue(((XButtonEvent *)event)->x, - ((XButtonEvent *)event)->y, - controlButton->xHalf, - controlButton->yHalf); - followMouse = yes; - gotToggle = no; - } else { - followMouse = no; - gotToggle = yes; /* auto-repeat on toggle buttons not allowed */ - if (toggleReady) { - toggleReady = no; - } - } - checkButton = yes; - firstTime = yes; - } - break; - - } /* switch */ - gotEvent--; - } /* if gotEvent */ - - - /* Allow repeat polling when mouse button clicked on a potentiometer. */ - - if (followMouse && !firstTime && (followMouse++ > mouseWait)) { - followMouse = yes; /* reset for next timing loop */ - checkButton = yes; - } - if (checkButton) { - if (viewport->closing && (controlButton->buttonKey == closeAll2D)) { - goodbye(-1); - } else { - clearControlMessage(); - viewport->closing = no; - drawControlPushButton(0, closeAll2D); - if ((doit) && - ((controlButton->buttonKey < graphStart) && - (controlButton->buttonKey > (graphSelectStart + maxGraphs)))) - doit = 0; - - switch(controlButton->buttonKey) { - - case translate2D: - for (i=0; i<maxGraphs; i++) { - if (graphStateArray[i].showing && graphStateArray[i].selected) { - if (transXON) { - graphStateArray[i].centerX -= mouseXY.x * 0.1; - if (graphStateArray[i].centerX > maxDelta) - graphStateArray[i].centerX = maxDelta; - else if (graphStateArray[i].centerX < -maxDelta) - graphStateArray[i].centerX = maxDelta; - } - if (transYON) { - graphStateArray[i].centerY -= mouseXY.y * 0.1; - if (graphStateArray[i].centerY > maxDelta) - graphStateArray[i].centerY = maxDelta; - else if (graphStateArray[i].centerY < -maxDelta) - graphStateArray[i].centerY = maxDelta; - } - } /* graph showing or selected */ - } /* for graphs */ - drawViewport(Xoption); - break; - - case scale2D: - for (i=0; i<maxGraphs; i++) { - if (graphStateArray[i].showing && graphStateArray[i].selected) { - if (zoomXON) { - graphStateArray[i].scaleX *= (1 - mouseXY.y * 0.3); - if (graphStateArray[i].scaleX > maxScale) - graphStateArray[i].scaleX = maxScale; - else if (graphStateArray[i].scaleX < minScale) - graphStateArray[i].scaleX = minScale; - } - if (zoomYON) { - graphStateArray[i].scaleY *= (1 - mouseXY.y * 0.3); - if (graphStateArray[i].scaleY > maxScale) - graphStateArray[i].scaleY = maxScale; - else if (graphStateArray[i].scaleY < minScale) - graphStateArray[i].scaleY = minScale; - } - } /* graph showing or selected */ - } /* for graphs */ - drawViewport(Xoption); - break; - - default: - buttonAction(controlButton->buttonKey); - } /* switch on buttonKey */ - } /* else - not closing */ - } /* if checkButton */ - } /* if FD_ISSET(Xcon.... */ - else if FD_ISSET(0,&rd) { - externalControl=spadAction(); /* returns (-1) if broken ,0 if success */ - if (spadDraw && (externalControl==0)) drawViewport(Xoption); - } - } /* while */ -} /* processEvents() */ - - - - - - -void -#ifdef _NO_PROTO -clickedOnGraph (i,bKey) - int i,bKey; -#else -clickedOnGraph (int i,int bKey) -#endif -{ - - switch (doit) { - case pick2D: - currentGraph = queriedGraph = i; - doPick(i,bKey); - break; - case drop2D: - currentGraph = queriedGraph = i; - doDrop(i,bKey); - break; - case query2D: - queriedGraph = i; - makeMessageFromData(queriedGraph); - writeControlMessage(); - /* reset indicator so that we're not in pick/drop/query mode anymore */ - doit = 0; - break; - default: - graphStateArray[i].showing = !(graphStateArray[i].showing); - if (mono) { - if (graphStateArray[i].showing) { - GSetForeground(graphGC,(float)backgroundColor,Xoption); - GSetBackground(graphGC,(float)foregroundColor,Xoption); - } else { - GSetForeground(graphGC,(float)foregroundColor,Xoption); - GSetBackground(graphGC,(float)backgroundColor,Xoption); - } - GDrawImageString(graphGC, - control->controlWindow, - (control->buttonQueue[bKey]).buttonX + - centerX(graphGC,(control->buttonQueue[bKey]).text,1, - (control->buttonQueue[bKey]).buttonWidth), - (control->buttonQueue[bKey]).buttonY + - centerY(graphGC,(control->buttonQueue[bKey]).buttonHeight), - (control->buttonQueue[bKey]).text, - 1, - Xoption); - } else { - if (graphStateArray[i].showing) - GSetForeground(graphGC,(float)graphBarShowingColor,Xoption); - else - GSetForeground(graphGC,(float)graphBarHiddenColor,Xoption); - GDrawString(graphGC, - control->controlWindow, - (control->buttonQueue[bKey]).buttonX + - centerX(graphGC,(control->buttonQueue[bKey]).text,1, - (control->buttonQueue[bKey]).buttonWidth), - (control->buttonQueue[bKey]).buttonY + - centerY(graphGC,(control->buttonQueue[bKey]).buttonHeight), - (control->buttonQueue[bKey]).text,1,Xoption); - } - drawViewport(Xoption); - break; - } /* switch doit */ - -} - - - - - - - - - -@ -\eject -\begin{thebibliography}{99} -\bibitem{1} nothing -\end{thebibliography} -\end{document} diff --git a/src/graph/view2D/spadAction2d.c.pamphlet b/src/graph/view2D/spadAction2d.c index 69ed10bb..900d4358 100644 --- a/src/graph/view2D/spadAction2d.c.pamphlet +++ b/src/graph/view2D/spadAction2d.c @@ -1,51 +1,37 @@ -\documentclass{article} -\usepackage{axiom} -\begin{document} -\title{\$SPAD/src/graph/view2D spadAction2d.c} -\author{The Axiom Team} -\maketitle -\begin{abstract} -\end{abstract} -\eject -\tableofcontents -\eject -\section{License} -<<license>>= /* -Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - - Neither the name of The Numerical ALgorithms Group Ltd. nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER -OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + Copyright (C) 1991-2002, The Numerical ALgorithms Group Ltd. + All rights reserved. + Copyright (C) 2007-2008, Gabriel Dos Reis. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of The Numerical ALgorithms Group Ltd. nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -@ -<<*>>= -<<license>> #define _SPADACTION2D_C #include "axiom-c-macros.h" @@ -76,7 +62,7 @@ readViewman(void * info,int size) int mold = 0; sprintf(errorStr,"%s %d %s","read of ",size, - " bytes from viewport manager\n"); + " bytes from viewport manager\n"); mold = check(read(0,info,size)); return(mold); @@ -273,8 +259,8 @@ spadAction(void) break; case putGraph: - readViewman(&i1,intSize); /* key of graph to get */ - readViewman(&i2,intSize); /* slot to drop graph onto 0..8*/ + readViewman(&i1,intSize); /* key of graph to get */ + readViewman(&i2,intSize); /* slot to drop graph onto 0..8*/ readViewman(&viewGoAhead,intSize); if (viewGoAhead < 0) { sprintf(control->message,"%s%d","Couldn't put into graph ",i2+1); @@ -311,9 +297,3 @@ spadAction(void) } -@ -\eject -\begin{thebibliography}{99} -\bibitem{1} nothing -\end{thebibliography} -\end{document} diff --git a/src/graph/view2D/stuff2d.c b/src/graph/view2D/stuff2d.c new file mode 100644 index 00000000..1d5d75a5 --- /dev/null +++ b/src/graph/view2D/stuff2d.c @@ -0,0 +1,125 @@ +/* + Copyright (C) 1991-2002, The Numerical ALgorithms Group Ltd. + All rights reserved. + Copyright (C) 2007-2008, Gabriel Dos Reis. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of The Numerical ALgorithms Group Ltd. nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#define _STUFF2D_C +#include "axiom-c-macros.h" + +#include <unistd.h> +#include <stdlib.h> + +#include "header2.h" + +#include "all_2d.H1" +#include "Gfun.H1" +#include "util.H1" + + +/**************************/ +/*** float absolute(x) ***/ +/**************************/ + +float +#ifdef _NO_PROTO +absolute(x) + float x; +#else +absolute(float x) +#endif +{ + if (x<0.0) { + return(-x); + } else { + return(x); + } +} + + + +/************************/ +/*** void goodbye() ***/ +/************************/ + +void +#ifdef _NO_PROTO +goodbye(sig) +int sig; +#else +goodbye(int sig) +#endif +{ + int Command,i; + +#ifdef DEBUG + fprintf(stderr,"view2D: Tidying up and exiting\n"); +#endif + PSClose(); /* free PS file and data structure space */ + + XFreeGC(dsply,globalGC1); + XFreeGC(dsply,globalGC2); + XFreeGC(dsply,globGC); + XFreeGC(dsply,trashGC); + XFreeGC(dsply,anotherGC); + XFreeGC(dsply,controlMessageGC); + XFreeGC(dsply,graphGC); + XFreeGC(dsply,unitGC); + + XFreeFont(dsply,globalFont); + XFreeFont(dsply,buttonFont); + XFreeFont(dsply,headerFont); + XFreeFont(dsply,titleFont); + XFreeFont(dsply,graphFont); + XFreeFont(dsply,unitFont); + + XFreeColormap(dsply,colorMap); + + /** send off the current graphs to viewport manager **/ + + Command = viewportClosing; + check(write(Socket,&Command,intSize)); + + for (i=0; i<maxGraphs;i++) { + check(write(Socket,&graphArray[i].key,intSize)); + } + close(Socket); + XCloseDisplay(dsply); + exit(0); + +} + + + + + + diff --git a/src/graph/view2D/stuff2d.c.pamphlet b/src/graph/view2D/stuff2d.c.pamphlet deleted file mode 100644 index d4e3d4ed..00000000 --- a/src/graph/view2D/stuff2d.c.pamphlet +++ /dev/null @@ -1,145 +0,0 @@ -\documentclass{article} -\usepackage{axiom} -\begin{document} -\title{\$SPAD/src/graph/view2D stuff2d.c} -\author{The Axiom Team} -\maketitle -\begin{abstract} -\end{abstract} -\eject -\tableofcontents -\eject -\section{License} -<<license>>= -/* -Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - - Neither the name of The Numerical ALgorithms Group Ltd. nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER -OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -@ -<<*>>= -<<license>> - -#define _STUFF2D_C -#include "axiom-c-macros.h" - -#include <unistd.h> -#include <stdlib.h> - -#include "header2.h" - -#include "all_2d.H1" -#include "Gfun.H1" -#include "util.H1" - - -/**************************/ -/*** float absolute(x) ***/ -/**************************/ - -float -#ifdef _NO_PROTO -absolute(x) - float x; -#else -absolute(float x) -#endif -{ - if (x<0.0) { - return(-x); - } else { - return(x); - } -} - - - -/************************/ -/*** void goodbye() ***/ -/************************/ - -void -#ifdef _NO_PROTO -goodbye(sig) -int sig; -#else -goodbye(int sig) -#endif -{ - int Command,i; - -#ifdef DEBUG - fprintf(stderr,"view2D: Tidying up and exiting\n"); -#endif - PSClose(); /* free PS file and data structure space */ - - XFreeGC(dsply,globalGC1); - XFreeGC(dsply,globalGC2); - XFreeGC(dsply,globGC); - XFreeGC(dsply,trashGC); - XFreeGC(dsply,anotherGC); - XFreeGC(dsply,controlMessageGC); - XFreeGC(dsply,graphGC); - XFreeGC(dsply,unitGC); - - XFreeFont(dsply,globalFont); - XFreeFont(dsply,buttonFont); - XFreeFont(dsply,headerFont); - XFreeFont(dsply,titleFont); - XFreeFont(dsply,graphFont); - XFreeFont(dsply,unitFont); - - XFreeColormap(dsply,colorMap); - - /** send off the current graphs to viewport manager **/ - - Command = viewportClosing; - check(write(Socket,&Command,intSize)); - - for (i=0; i<maxGraphs;i++) { - check(write(Socket,&graphArray[i].key,intSize)); - } - close(Socket); - XCloseDisplay(dsply); - exit(0); - -} - - - - - - -@ -\eject -\begin{thebibliography}{99} -\bibitem{1} nothing -\end{thebibliography} -\end{document} diff --git a/src/graph/view2D/viewport2D.c.pamphlet b/src/graph/view2D/viewport2D.c index c1632984..a0a06aa9 100644 --- a/src/graph/view2D/viewport2D.c.pamphlet +++ b/src/graph/view2D/viewport2D.c @@ -1,51 +1,37 @@ -\documentclass{article} -\usepackage{axiom} -\begin{document} -\title{\$SPAD/src/graph/view2D viewport2D} -\author{The Axiom Team} -\maketitle -\begin{abstract} -\end{abstract} -\eject -\tableofcontents -\eject -\section{License} -<<license>>= /* -Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - - Neither the name of The Numerical ALgorithms Group Ltd. nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER -OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + Copyright (C) 1991-2002, The Numerical ALgorithms Group Ltd. + All rights reserved. + Copyright (C) 2007-2008, Gabriel Dos Reis. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of The Numerical ALgorithms Group Ltd. nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -@ -<<*>>= -<<license>> #define _VIEWPORT2D_C #include "axiom-c-macros.h" @@ -60,8 +46,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <X11/Xutil.h> #include <limits.h> -#define NotPoint (SHRT_MAX) -#define eqNANQ(x) (x == NotPoint) +#define NotPoint (SHRT_MAX) +#define eqNANQ(x) (x == NotPoint) #include "header2.h" @@ -159,33 +145,33 @@ drawTheViewport(int dFlag) graphArray[i].yNorm = 1.0/((graphArray[i].ymax-graphArray[i].ymin) * aspectR); graphArray[i].originY = -graphArray[i].ymin*graphArray[i].yNorm - - 0.5/aspectR; + - 0.5/aspectR; graphArray[i].unitY = graphArray[i].spadUnitY*graphArray[i].yNorm; xAxis = rint(vwInfo.width * - ((graphArray[0].originX - graphStateArray[0].centerX) * - graphStateArray[0].scaleX + 0.5)); + ((graphArray[0].originX - graphStateArray[0].centerX) * + graphStateArray[0].scaleX + 0.5)); yAxis= rint(vwInfo.height * aspectR * - (1 - ((graphArray[0].originY*aspectR - - graphStateArray[0].centerY) * - graphStateArray[0].scaleY + 0.5*aspectR ))); + (1 - ((graphArray[0].originY*aspectR - + graphStateArray[0].centerY) * + graphStateArray[0].scaleY + 0.5*aspectR ))); if (graphStateArray[i].axesOn) { if (dFlag==Xoption) /* do only for X, ps uses default of black */ GSetForeground(globalGC1, - (float)monoColor(graphStateArray[i].axesColor), - dFlag); - - if ((yAxis >=0) && (yAxis <= vwInfo.height)) + (float)monoColor(graphStateArray[i].axesColor), + dFlag); + + if ((yAxis >=0) && (yAxis <= vwInfo.height)) GDrawLine(globalGC1,vw, - 0,yAxis, - vwInfo.width,yAxis, - dFlag); - if ((xAxis >=0) && (xAxis <= vwInfo.width)) - GDrawLine(globalGC1,vw, - xAxis,0, - xAxis,vwInfo.height, - dFlag); + 0,yAxis, + vwInfo.width,yAxis, + dFlag); + if ((xAxis >=0) && (xAxis <= vwInfo.width)) + GDrawLine(globalGC1,vw, + xAxis,0, + xAxis,vwInfo.height, + dFlag); } @@ -209,48 +195,48 @@ drawTheViewport(int dFlag) if (isNaN(aPoint->x)) { anXPoint->x = anX10Point->x = NotPoint; } - else { + else { diffX = graphArray[i].xmax-graphArray[i].xmin; anXPoint->x = anX10Point->x = vwInfo.width * ((aPoint->x * diffX/(graphArray[0].xmax-graphArray[0].xmin) - + (graphArray[0].originX - graphArray[i].originX*diffX / - (graphArray[0].xmax-graphArray[0].xmin)) - - graphStateArray[0].centerX)*graphStateArray[i].scaleX+0.5); + + (graphArray[0].originX - graphArray[i].originX*diffX / + (graphArray[0].xmax-graphArray[0].xmin)) + - graphStateArray[0].centerX)*graphStateArray[i].scaleX+0.5); } if (isNaN(aPoint->y)) { anXPoint->y = anX10Point->y = NotPoint; - } + } else { diffY = graphArray[i].ymax-graphArray[i].ymin; anXPoint->y = anX10Point->y = vwInfo.height * aspectR * - (1 - ((aPoint->y * diffY/(graphArray[0].ymax-graphArray[0].ymin) - + (graphArray[0].originY - graphArray[i].originY* diffY/ - (graphArray[0].ymax-graphArray[0].ymin))*aspectR - - graphStateArray[0].centerY) * - graphStateArray[i].scaleY + 0.5*aspectR)); + (1 - ((aPoint->y * diffY/(graphArray[0].ymax-graphArray[0].ymin) + + (graphArray[0].originY - graphArray[i].originY* diffY/ + (graphArray[0].ymax-graphArray[0].ymin))*aspectR + - graphStateArray[0].centerY) * + graphStateArray[i].scaleY + 0.5*aspectR)); } } else { if (isNaN(aPoint->x)) { anXPoint->x = anX10Point->x = NotPoint; } - else { + else { anXPoint->x = anX10Point->x = vwInfo.width * ((aPoint->x - graphStateArray[i].centerX) * - graphStateArray[i].scaleX + 0.5); + graphStateArray[i].scaleX + 0.5); } if (isNaN(aPoint->y)) { anXPoint->y = anX10Point->y = NotPoint; - } - else { + } + else { anXPoint->y = anX10Point->y = vwInfo.height * aspectR * (1 - ((aPoint->y - graphStateArray[i].centerY) * - graphStateArray[i].scaleY + 0.5*aspectR)); + graphStateArray[i].scaleY + 0.5*aspectR)); } } /* first or last point */ if (k == 0 || k == (aList->numberOfPoints - 1)) { - anX10Point->flags = 0; + anX10Point->flags = 0; } else { anX10Point->flags = VertexCurved; } @@ -260,108 +246,108 @@ drawTheViewport(int dFlag) anXarc++; } /* for aPoint in pointList */ - aPoint--; /* make it legal, the last one*/ + aPoint--; /* make it legal, the last one*/ if (graphStateArray[i].connectOn || graphStateArray[i].pointsOn) { halfSize = aList->pointSize/2; ptX = tempXpt->x; ptY = tempXpt->y; clipped = ptX > vwInfo.x && ptX < vwInfo.width && - ptY > 0 && ptY < vwInfo.height; + ptY > 0 && ptY < vwInfo.height; if (graphStateArray[i].pointsOn) { if (dFlag==Xoption) { if (mono) { GSetForeground(globalGC1, - (float)monoColor((int)(aPoint->hue)), - dFlag); + (float)monoColor((int)(aPoint->hue)), + dFlag); } else { GSetForeground(globalGC1, - (float)XSolidColor((int)(aPoint->hue), - (int)(aPoint->shade)), - dFlag); + (float)XSolidColor((int)(aPoint->hue), + (int)(aPoint->shade)), + dFlag); } } if (clipped && !eqNANQ(ptX) && !eqNANQ(ptY)) GFillArc(globalGC1,vw,ptX-halfSize, - ptY-halfSize,aList->pointSize,aList->pointSize, - 0,360*64, dFlag); + ptY-halfSize,aList->pointSize,aList->pointSize, + 0,360*64, dFlag); } /* if points on */ for (ii=0, aPoint=aList->listOfPoints; - ii<aList->numberOfPoints; - ++ii, ++tempXpt, ++aPoint) { + ii<aList->numberOfPoints; + ++ii, ++tempXpt, ++aPoint) { ptX1 = tempXpt->x; ptY1 = tempXpt->y; clipped1 = ptX1 > vwInfo.x && ptX1 < vwInfo.width && - ptY1 > 0 && ptY1 < vwInfo.height; + ptY1 > 0 && ptY1 < vwInfo.height; if (graphStateArray[i].connectOn) { if (dFlag==Xoption) { if (mono) { GSetForeground(globalGC1, - (float)monoColor((int)(aList->lineColor-1)/5), - dFlag); + (float)monoColor((int)(aList->lineColor-1)/5), + dFlag); } else { GSetForeground(globalGC1, - (float)XSolidColor((int)(aList->lineColor-1)/5, - (int)((aList->lineColor-1)%5)/2), - dFlag); + (float)XSolidColor((int)(aList->lineColor-1)/5, + (int)((aList->lineColor-1)%5)/2), + dFlag); } - } /* if X */ + } /* if X */ if ((clipped || clipped1) && !eqNANQ(ptX) && !eqNANQ(ptY) && - !eqNANQ(ptX1) && !eqNANQ(ptY1)) + !eqNANQ(ptX1) && !eqNANQ(ptY1)) GDrawLine(globalGC1,vw, - ptX,ptY,ptX1,ptY1, - dFlag); + ptX,ptY,ptX1,ptY1, + dFlag); } /* if lines on */ if (graphStateArray[i].pointsOn) { if (dFlag==Xoption) { if (mono) { GSetForeground(globalGC1, - (float)monoColor((int)(aPoint->hue)), - dFlag); + (float)monoColor((int)(aPoint->hue)), + dFlag); } else { GSetForeground(globalGC1, - (float)XSolidColor((int)(aPoint->hue), - (int)(aPoint->shade)), - dFlag); + (float)XSolidColor((int)(aPoint->hue), + (int)(aPoint->shade)), + dFlag); } } if (clipped1 && !eqNANQ(ptX1) && !eqNANQ(ptY1)) GFillArc(globalGC1,vw,ptX1-halfSize, - ptY1-halfSize,aList->pointSize,aList->pointSize, - 0,360*64, dFlag); + ptY1-halfSize,aList->pointSize,aList->pointSize, + 0,360*64, dFlag); } /* if points on */ ptX = ptX1; ptY = ptY1; clipped = clipped1; } /* for all points */ - } /* if points or lines on */ + } /* if points or lines on */ if (graphStateArray[i].splineOn) { /* need spline color as well */ if (dFlag==Xoption) /* do only for X, ps uses default of black */ - GSetForeground(globalGC1, - (float)monoColor(148), - dFlag); + GSetForeground(globalGC1, + (float)monoColor(148), + dFlag); boxX = vwInfo.width * - ((-0.5 - graphStateArray[i].centerX)* - graphStateArray[i].scaleX + 0.5); + ((-0.5 - graphStateArray[i].centerX)* + graphStateArray[i].scaleX + 0.5); boxY = vwInfo.height * aspectR * - (1 - ((0.5 - graphStateArray[i].centerY)* - graphStateArray[i].scaleY + 0.5*aspectR)); + (1 - ((0.5 - graphStateArray[i].centerY)* + graphStateArray[i].scaleY + 0.5*aspectR)); boxW = graphStateArray[i].scaleX * vwInfo.width + 1; boxH = graphStateArray[i].scaleY * vwInfo.height * aspectR + 1; GDrawRectangle(globalGC1,vw, - boxX,boxY,boxW,boxH, - dFlag); + boxX,boxY,boxW,boxH, + dFlag); } tempXpt = anXPoint; } /* for a aList in listofListsOfPoints */ if (graphStateArray[i].unitsOn) { - /* do only for X, ps uses default of black */ + /* do only for X, ps uses default of black */ if (dFlag==Xoption) GSetForeground(unitGC, - (float)monoColor(graphStateArray[i].unitsColor), - dFlag); + (float)monoColor(graphStateArray[i].unitsColor), + dFlag); tickStart = calcUnitX(0); @@ -372,70 +358,70 @@ drawTheViewport(int dFlag) unitWidth = 5*overall.width; /* limit on acceptable separation : 5 chars */ k = floor(unitWidth/oneTickUnit) +1; /* get skipping integer */ for (ii=0, jj = tickStart; - jj < vwInfo.width; - ii=ii+k,jj =jj+k* oneTickUnit) { - if (jj >= 0) { - - /* ticks stuck to viewport*/ - GDrawLine(unitGC,vw, - (int)rint(jj),vwInfo.height-8,(int)rint(jj),vwInfo.height-4, - dFlag); - - sprintf(aunit,"%0.3g",ii*graphArray[0].spadUnitX); - strlength=strlen(aunit); - halflength=XTextWidth(unitFont,aunit,strlength)/2; - - if (dFlag == Xoption) GDrawImageString(unitGC, - vw, - (int)rint(jj) - halflength, - vwInfo.height -8 -descent, - aunit, - strlength, - dFlag); - if (dFlag == PSoption) GDrawImageString(unitGC, - vw, - (int)rint(jj) -(strlength*3) , - vwInfo.height -14, - aunit, - strlength, - dFlag); - /* these are "eyeball" parameters for the given PS font */ + jj < vwInfo.width; + ii=ii+k,jj =jj+k* oneTickUnit) { + if (jj >= 0) { + + /* ticks stuck to viewport*/ + GDrawLine(unitGC,vw, + (int)rint(jj),vwInfo.height-8,(int)rint(jj),vwInfo.height-4, + dFlag); + + sprintf(aunit,"%0.3g",ii*graphArray[0].spadUnitX); + strlength=strlen(aunit); + halflength=XTextWidth(unitFont,aunit,strlength)/2; + + if (dFlag == Xoption) GDrawImageString(unitGC, + vw, + (int)rint(jj) - halflength, + vwInfo.height -8 -descent, + aunit, + strlength, + dFlag); + if (dFlag == PSoption) GDrawImageString(unitGC, + vw, + (int)rint(jj) -(strlength*3) , + vwInfo.height -14, + aunit, + strlength, + dFlag); + /* these are "eyeball" parameters for the given PS font */ - } + } - } + } /* ticks along the negative X axis */ for (ii=-k,jj=tickStart - k*oneTickUnit; - jj > 0; - ii=ii-k,jj = jj-k*oneTickUnit) { - if (jj <= vwInfo.width) { - - /* ticks stuck to viewport*/ - GDrawLine(unitGC,vw, - (int)rint(jj),vwInfo.height-8,(int)rint(jj),vwInfo.height-4, - dFlag); - - sprintf(aunit,"%0.3g",ii*graphArray[0].spadUnitX); - strlength=strlen(aunit); - halflength=XTextWidth(unitFont,aunit,strlength)/2; - - if (dFlag == Xoption) GDrawImageString(unitGC, - vw, - (int)rint(jj) - halflength, - vwInfo.height -8 -descent, - aunit, - strlength, - dFlag); - if (dFlag == PSoption) GDrawImageString(unitGC, - vw, - (int)rint(jj) -(strlength*3) , - vwInfo.height -14, - aunit, - strlength, - dFlag); - /* these are "eyeball" parameters for the given PS font */ - } - } + jj > 0; + ii=ii-k,jj = jj-k*oneTickUnit) { + if (jj <= vwInfo.width) { + + /* ticks stuck to viewport*/ + GDrawLine(unitGC,vw, + (int)rint(jj),vwInfo.height-8,(int)rint(jj),vwInfo.height-4, + dFlag); + + sprintf(aunit,"%0.3g",ii*graphArray[0].spadUnitX); + strlength=strlen(aunit); + halflength=XTextWidth(unitFont,aunit,strlength)/2; + + if (dFlag == Xoption) GDrawImageString(unitGC, + vw, + (int)rint(jj) - halflength, + vwInfo.height -8 -descent, + aunit, + strlength, + dFlag); + if (dFlag == PSoption) GDrawImageString(unitGC, + vw, + (int)rint(jj) -(strlength*3) , + vwInfo.height -14, + aunit, + strlength, + dFlag); + /* these are "eyeball" parameters for the given PS font */ + } + } tickStart = calcUnitY(0); oneTickUnit = calcUnitY(1) - tickStart; @@ -444,117 +430,117 @@ drawTheViewport(int dFlag) unitWidth = 2*(ascent+descent); /* limit of acceptable separation */ k = floor(unitWidth/fabs(oneTickUnit)) +1; /* get skipping integer */ for (ii=0,jj = tickStart; - jj > 0; - ii=ii+k,jj =jj+k*oneTickUnit ) { - if (jj < vwInfo.height) { + jj > 0; + ii=ii+k,jj =jj+k*oneTickUnit ) { + if (jj < vwInfo.height) { - /* ticks stuck to viewport*/ - /* on the right */ - /* + /* ticks stuck to viewport*/ + /* on the right */ + /* GDrawLine(unitGC,vw, - vwInfo.width-6,(int)rint(jj), - vwInfo.width-2,(int)rint(jj),dFlag); - */ - /* on the left */ - GDrawLine(unitGC,vw, - 2,(int)rint(jj), - 6,(int)rint(jj), - dFlag); - sprintf(aunit,"%0.3g",ii*graphArray[0].spadUnitY); - strlength=strlen(aunit); - XTextExtents(unitFont,aunit,strlength,&dummyInt, - &ascent,&descent,&overall); - halflength=overall.width; /* let's reuse that variable */ - - if(dFlag == Xoption){ + vwInfo.width-6,(int)rint(jj), + vwInfo.width-2,(int)rint(jj),dFlag); + */ + /* on the left */ + GDrawLine(unitGC,vw, + 2,(int)rint(jj), + 6,(int)rint(jj), + dFlag); + sprintf(aunit,"%0.3g",ii*graphArray[0].spadUnitY); + strlength=strlen(aunit); + XTextExtents(unitFont,aunit,strlength,&dummyInt, + &ascent,&descent,&overall); + halflength=overall.width; /* let's reuse that variable */ + + if(dFlag == Xoption){ /* on the right */ - /* - GDrawImageString(unitGC, vw, - vwInfo.width-halflength -6-descent, - (int)rint(jj)+ascent/2 , - aunit, strlength, dFlag); - */ + /* + GDrawImageString(unitGC, vw, + vwInfo.width-halflength -6-descent, + (int)rint(jj)+ascent/2 , + aunit, strlength, dFlag); + */ /* on the left */ - GDrawImageString(unitGC, vw, - 8 + charlength/2, - (int)rint(jj)+ascent/2 , - aunit, strlength, dFlag); - } - if(dFlag == PSoption){ + GDrawImageString(unitGC, vw, + 8 + charlength/2, + (int)rint(jj)+ascent/2 , + aunit, strlength, dFlag); + } + if(dFlag == PSoption){ /* on the right */ - /* - GDrawImageString(unitGC, vw, - vwInfo.width - 6 - (strlength*6), - (int)rint(jj)+4, - aunit, strlength, dFlag); - */ + /* + GDrawImageString(unitGC, vw, + vwInfo.width - 6 - (strlength*6), + (int)rint(jj)+4, + aunit, strlength, dFlag); + */ /* on the left */ - GDrawImageString(unitGC, vw, - 8,(int)rint(jj)+4, - aunit, strlength, dFlag); - /* these are "eyeball" parameters for the given PS font */ - } - } - } + GDrawImageString(unitGC, vw, + 8,(int)rint(jj)+4, + aunit, strlength, dFlag); + /* these are "eyeball" parameters for the given PS font */ + } + } + } /* ticks along the negative Y axis */ for (ii=(-k),jj = tickStart - k*oneTickUnit; - jj < vwInfo.height; - ii=ii-k,jj =jj-k*oneTickUnit) { - if (jj > 0) { + jj < vwInfo.height; + ii=ii-k,jj =jj-k*oneTickUnit) { + if (jj > 0) { - /* ticks stuck to viewport*/ - /* on the right */ - /* + /* ticks stuck to viewport*/ + /* on the right */ + /* GDrawLine(unitGC,vw, - vwInfo.width-6,(int)rint(jj), - vwInfo.width-2,(int)rint(jj), - dFlag); - */ - /* on the left */ - GDrawLine(unitGC,vw, - 2,(int)rint(jj), - 6,(int)rint(jj), - dFlag); - - sprintf(aunit,"%0.3g",ii*graphArray[0].spadUnitY); - strlength=strlen(aunit); - XTextExtents(unitFont,aunit,strlength,&dummyInt, - &ascent,&descent,&overall); - halflength=overall.width; /* let's reuse that variable */ - - if(dFlag == Xoption){ + vwInfo.width-6,(int)rint(jj), + vwInfo.width-2,(int)rint(jj), + dFlag); + */ + /* on the left */ + GDrawLine(unitGC,vw, + 2,(int)rint(jj), + 6,(int)rint(jj), + dFlag); + + sprintf(aunit,"%0.3g",ii*graphArray[0].spadUnitY); + strlength=strlen(aunit); + XTextExtents(unitFont,aunit,strlength,&dummyInt, + &ascent,&descent,&overall); + halflength=overall.width; /* let's reuse that variable */ + + if(dFlag == Xoption){ /* on the right */ - /* - GDrawImageString(unitGC, vw, - vwInfo.width-halflength -6-descent, - (int)rint(jj)+ascent/2 , - aunit, strlength, dFlag); - */ + /* + GDrawImageString(unitGC, vw, + vwInfo.width-halflength -6-descent, + (int)rint(jj)+ascent/2 , + aunit, strlength, dFlag); + */ /* on the left */ - GDrawImageString(unitGC, vw, - 8 + charlength/2, - (int)rint(jj)+ascent/2 , - aunit, strlength, dFlag); - } - if(dFlag == PSoption){ + GDrawImageString(unitGC, vw, + 8 + charlength/2, + (int)rint(jj)+ascent/2 , + aunit, strlength, dFlag); + } + if(dFlag == PSoption){ /* on the right */ - /* - GDrawImageString(unitGC, vw, - vwInfo.width -6 -(strlength*6), - (int)rint(jj)+4 , - aunit, strlength, dFlag); - */ + /* + GDrawImageString(unitGC, vw, + vwInfo.width -6 -(strlength*6), + (int)rint(jj)+4 , + aunit, strlength, dFlag); + */ /* on the left */ - GDrawImageString(unitGC, vw, - 8, - (int)rint(jj)+4 , - aunit, strlength, dFlag); - /* these are "eyeball" parameters for the given PS font */ - } - } - } + GDrawImageString(unitGC, vw, + 8, + (int)rint(jj)+4 , + aunit, strlength, dFlag); + /* these are "eyeball" parameters for the given PS font */ + } + } + } } /* if unitsOn */ } /* if graph i exists and is showing */ @@ -635,7 +621,7 @@ makeViewport(char *title,int vX,int vY,int vW,int vH,int showCP) XQueryColor(dsply,colorMap,&foreColor); XQueryColor(dsply,colorMap,&backColor); viewAttrib.cursor = XCreatePixmapCursor(dsply,spadbits,spadmask, - &foreColor,&backColor,spadBitmap_x_hot,spadBitmap_y_hot); + &foreColor,&backColor,spadBitmap_x_hot,spadBitmap_y_hot); viewAttrib.event_mask = titleMASK; if (vW) { @@ -651,16 +637,16 @@ makeViewport(char *title,int vX,int vY,int vW,int vH,int showCP) } viewTitleWindow = XCreateWindow(dsply,rtWindow,vX,vY,vW,vH, - viewBorderWidth, - CopyFromParent,InputOutput,CopyFromParent, - viewportTitleCreateMASK,&viewAttrib); + viewBorderWidth, + CopyFromParent,InputOutput,CopyFromParent, + viewportTitleCreateMASK,&viewAttrib); wm_delete_window = XInternAtom(dsply, "WM_DELETE_WINDOW", False); (void) XSetWMProtocols(dsply, viewTitleWindow, &wm_delete_window, 1); XSetNormalHints(dsply,viewTitleWindow,&titleSizeHints); XSetStandardProperties(dsply,viewTitleWindow,"AXIOM 2D",viewport->title, - None,NULL,0,&titleSizeHints); + None,NULL,0,&titleSizeHints); viewport->titleWindow = viewTitleWindow; viewAttrib.event_mask = viewportMASK; @@ -671,14 +657,14 @@ makeViewport(char *title,int vX,int vY,int vW,int vH,int showCP) viewSizeHints.height = titleSizeHints.height - (titleHeight + appendixHeight); viewGraphWindow = XCreateWindow(dsply,viewTitleWindow, - viewSizeHints.x,viewSizeHints.y, - viewSizeHints.width,viewSizeHints.height, - viewBorderWidth, - CopyFromParent,InputOutput,CopyFromParent, - viewportCreateMASK,&viewAttrib); + viewSizeHints.x,viewSizeHints.y, + viewSizeHints.width,viewSizeHints.height, + viewBorderWidth, + CopyFromParent,InputOutput,CopyFromParent, + viewportCreateMASK,&viewAttrib); XSetNormalHints(dsply,viewGraphWindow,&viewSizeHints); XSetStandardProperties(dsply,viewGraphWindow,"2D Viewport","2D Viewport", - None,NULL,0,&viewSizeHints); + None,NULL,0,&viewSizeHints); viewport->viewWindow = viewGraphWindow; @@ -725,9 +711,3 @@ makeView2D(view2DStruct *viewdata) } /* makeView2D */ -@ -\eject -\begin{thebibliography}{99} -\bibitem{1} nothing -\end{thebibliography} -\end{document} diff --git a/src/graph/view2D/write2d.c.pamphlet b/src/graph/view2D/write2d.c index 66eafe26..7a00fc68 100644 --- a/src/graph/view2D/write2d.c.pamphlet +++ b/src/graph/view2D/write2d.c @@ -1,51 +1,37 @@ -\documentclass{article} -\usepackage{axiom} -\begin{document} -\title{\$SPAD/src/graph/view2D write2d.c} -\author{The Axiom Team} -\maketitle -\begin{abstract} -\end{abstract} -\eject -\tableofcontents -\eject -\section{License} -<<license>>= /* -Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - - Neither the name of The Numerical ALgorithms Group Ltd. nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER -OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + Copyright (C) 1991-2002, The Numerical ALgorithms Group Ltd. + All rights reserved. + Copyright (C) 2007-2008, Gabriel Dos Reis. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of The Numerical ALgorithms Group Ltd. nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -@ -<<*>>= -<<license>> #define _WRITE2D_C #include "axiom-c-macros.h" @@ -100,7 +86,7 @@ writeViewport(int thingsToWrite) fprintf(viewDataFile,"%d\n",view2DType); fprintf(viewDataFile,"%s\n",viewport->title); fprintf(viewDataFile,"%d %d %d %d\n",vwInfo.x,vwInfo.y, - vwInfo.width,vwInfo.height); + vwInfo.width,vwInfo.height); for (i=0; i<maxGraphs; i++) { fprintf(viewDataFile,"%d\n",graphArray[i].key); fprintf(viewDataFile,"%g %g\n", @@ -128,7 +114,7 @@ writeViewport(int thingsToWrite) } else { fprintf(viewDataFile,"%g %g %g %g\n", graphArray[i].xmin,graphArray[i].ymin, - graphArray[i].xmax,graphArray[i].ymax); + graphArray[i].xmax,graphArray[i].ymax); fprintf(viewDataFile,"%g %g\n", graphArray[i].xNorm,graphArray[i].yNorm); fprintf(viewDataFile,"%g %g\n", @@ -165,16 +151,16 @@ writeViewport(int thingsToWrite) sprintf(viewBitmapFilename,"%s%s",viewDirName,"/image.xpm"); XGetWindowAttributes(dsply,viewport->viewWindow,&vwInfo); write_pixmap_file(dsply,scrn,viewBitmapFilename, - viewport->titleWindow,0,0,vwInfo.width, - vwInfo.height+titleHeight); + viewport->titleWindow,0,0,vwInfo.width, + vwInfo.height+titleHeight); break; case Bitmap: /*** Create the bitmap (bitmaps need leaf name) ***/ sprintf(viewBitmapFilename,"%s%s",viewDirName,"/image.bm"); XGetWindowAttributes(dsply,viewport->viewWindow,&vwInfo); code = XWriteBitmapFile(dsply,viewBitmapFilename, - viewport->titleWindow,vwInfo.width, - vwInfo.height+vwInfo.border_width+20,-1,-1); + viewport->titleWindow,vwInfo.width, + vwInfo.height+vwInfo.border_width+20,-1,-1); break; case Image: /*** Create the pixmap (bitmaps need leaf name) ***/ @@ -185,16 +171,16 @@ writeViewport(int thingsToWrite) drawViewport(Xoption); writeTitle(); write_pixmap_file(dsply,scrn,viewBitmapFilename, - viewport->titleWindow,0,0,vwInfo.width, - vwInfo.height+titleHeight); + viewport->titleWindow,0,0,vwInfo.width, + vwInfo.height+titleHeight); /*** Create the bitmap (bitmaps need leaf name) ***/ mono = 1; drawViewport(Xoption); writeTitle(); sprintf(viewBitmapFilename,"%s%s%s",viewDirName,"/","image.bm"); code = XWriteBitmapFile(dsply,viewBitmapFilename, - viewport->titleWindow,vwInfo.width, - vwInfo.height+vwInfo.border_width+20,-1,-1); + viewport->titleWindow,vwInfo.width, + vwInfo.height+vwInfo.border_width+20,-1,-1); mono = 0; break; @@ -202,11 +188,11 @@ writeViewport(int thingsToWrite) /*** Create postscript output for viewport (in axiom2D.ps) ***/ sprintf(PSfilename,"%s%s",viewDirName,"/axiom2D.ps"); if (PSInit(viewport->viewWindow,viewport->titleWindow) == psError) - return (-1); + return (-1); drawViewport(PSoption); /* write new script file in /tmp */ if (PSCreateFile(viewBorderWidth,viewport->viewWindow, - viewport->titleWindow, viewport->title) == psError) - return(-1); /* concat script & proc into axiom2D.ps */ + viewport->titleWindow, viewport->title) == psError) + return(-1); /* concat script & proc into axiom2D.ps */ break; } /* switch on ii */ @@ -217,9 +203,3 @@ writeViewport(int thingsToWrite) } /* else create directory okay */ } -@ -\eject -\begin{thebibliography}{99} -\bibitem{1} nothing -\end{thebibliography} -\end{document} |