diff options
32 files changed, 159 insertions, 103 deletions
diff --git a/tksao/colorbar/colorbar.C b/tksao/colorbar/colorbar.C index 78783b9..554dc58 100644 --- a/tksao/colorbar/colorbar.C +++ b/tksao/colorbar/colorbar.C @@ -5,7 +5,6 @@ #include <fstream> #include "util.h" -#include "tkx11.h" #include "colorbar.h" #include "ps.h" #include "psutil.h" @@ -808,6 +807,8 @@ void Colorbar::tagSaveCmd(const char* fn) } #ifdef MAC_OSX_TK +#include <macosxlib.h> + void Colorbar::macosx(float scale, int width, int height, const Vector& v, const Vector& s) { @@ -851,6 +852,8 @@ void Colorbar::macosx(float scale, int width, int height, #endif #ifdef __WIN32 +#include <win32lib.h> + void Colorbar::win32(float scale, int width, int height, const Vector& v, const Vector& s) { diff --git a/tksao/colorbar/colorbarbase.C b/tksao/colorbar/colorbarbase.C index 959b06c..c56774b 100644 --- a/tksao/colorbar/colorbarbase.C +++ b/tksao/colorbar/colorbarbase.C @@ -5,7 +5,6 @@ #include <tkInt.h> #include "util.h" -#include "tkx11.h" #include "colorbarbase.h" #include "cbgrid.h" #include "ps.h" @@ -386,7 +385,7 @@ void ColorbarBase::updateGCs() rectWindow[0].height = (int)sizeWindow[1]; // gridGC - XSetClipRectangles(display, gridGC_, 0, 0, rectWidget, 1, Unsorted); + setClipRectangles(display, gridGC_, 0, 0, rectWidget, 1, Unsorted); } void ColorbarBase::renderGrid() @@ -831,6 +830,8 @@ void ColorbarBase::setColormapLevelCmd(int cc, double* ff) // MacOSX #ifdef MAC_OSX_TK +#include <macosxlib.h> + void ColorbarBase::macosxPrintCmd() { ColorbarBaseOptions* opts = (ColorbarBaseOptions*)options; @@ -999,6 +1000,8 @@ void ColorbarBase::macosxGridAST() // WIN32 #ifdef __WIN32 +#include <win32lib.h> + void ColorbarBase::win32PrintCmd() { ColorbarBaseOptions* opts = (ColorbarBaseOptions*)options; diff --git a/tksao/colorbar/colorbarrgb.C b/tksao/colorbar/colorbarrgb.C index 3d32dde..8baadf6 100644 --- a/tksao/colorbar/colorbarrgb.C +++ b/tksao/colorbar/colorbarrgb.C @@ -3,7 +3,6 @@ // For conditions of distribution and use, see copyright notice in "copyright" #include "util.h" -#include "tkx11.h" #include "colorbarrgb.h" #include "ps.h" #include "psutil.h" @@ -333,6 +332,8 @@ void ColorbarRGB::setRGBChannelCmd(const char* c) } #ifdef MAC_OSX_TK +#include <macosxlib.h> + void ColorbarRGB::macosx(float scale, int width, int height, const Vector& v, const Vector& s) { @@ -409,6 +410,8 @@ void ColorbarRGB::macosx(float scale, int width, int height, #endif #ifdef __WIN32 +#include <win32lib.h> + void ColorbarRGB::win32(float scale, int width, int height, const Vector& v, const Vector& s) { diff --git a/tksao/configure b/tksao/configure index bb277d2..694a838 100755 --- a/tksao/configure +++ b/tksao/configure @@ -5616,7 +5616,6 @@ tkutil/gridbase.C tkutil/ps.C tkutil/psutil.C tkutil/tkutil.C -tkutil/tkx11.C widget/truecolor16.C widget/truecolor24.C widget/truecolor8.C diff --git a/tksao/configure.ac b/tksao/configure.ac index c50a738..5082f0b 100644 --- a/tksao/configure.ac +++ b/tksao/configure.ac @@ -217,7 +217,6 @@ tkutil/gridbase.C tkutil/ps.C tkutil/psutil.C tkutil/tkutil.C -tkutil/tkx11.C widget/truecolor16.C widget/truecolor24.C widget/truecolor8.C diff --git a/tksao/frame/base.C b/tksao/frame/base.C index 2bc6f45..ea088ea 100644 --- a/tksao/frame/base.C +++ b/tksao/frame/base.C @@ -5,7 +5,6 @@ #include <tkInt.h> #include "util.h" -#include "tkx11.h" // macos #include "base.h" #include "context.h" #include "fitsimage.h" @@ -1410,25 +1409,25 @@ void Base::updateGCs() XSetLineAttributes(display, pannerGC, 1, LineSolid, CapButt, JoinMiter); // highliteGC - XSetClipRectangles(display, highliteGC, 0, 0, rectWidget, 1, Unsorted); + setClipRectangles(display, highliteGC, 0, 0, rectWidget, 1, Unsorted); XSetForeground(display, highliteGC, getColor("blue")); XSetLineAttributes(display, highliteGC, 2, LineSolid, CapButt, JoinMiter); // markerGC - XSetClipRectangles(display, markerGC_, 0, 0, rectWidget, 1, Unsorted); - XSetClipRectangles(display, markerGCXOR_, 0, 0, rectWidget, 1, Unsorted); + setClipRectangles(display, markerGC_, 0, 0, rectWidget, 1, Unsorted); + setClipRectangles(display, markerGCXOR_, 0, 0, rectWidget, 1, Unsorted); XSetForeground(display, markerGCXOR_, getColor("white")); // selectGC x11Dash(selectGCXOR,1); - XSetClipRectangles(display, selectGCXOR, 0, 0, rectWidget, 1, Unsorted); + setClipRectangles(display, selectGCXOR, 0, 0, rectWidget, 1, Unsorted); XSetForeground(display, selectGCXOR, getColor("white")); // gridGC - XSetClipRectangles(display, gridGC_, 0, 0, rectWidget, 1, Unsorted); + setClipRectangles(display, gridGC_, 0, 0, rectWidget, 1, Unsorted); // contourGC - XSetClipRectangles(display, contourGC_, 0, 0, rectWidget, 1, Unsorted); + setClipRectangles(display, contourGC_, 0, 0, rectWidget, 1, Unsorted); XSetLineAttributes(display, contourGC_, 1, LineSolid, CapButt, JoinMiter); } @@ -1823,6 +1822,8 @@ void Base::ximageToPixmapMagnifier() } #ifdef MAC_OSX_TK +#include <macosxlib.h> + void Base::macosx() { // clip rect @@ -1932,6 +1933,8 @@ void Base::macosxPrintCmd() #endif #ifdef __WIN32 +#include <win32xlib.h> + void Base::win32() { // clip rect diff --git a/tksao/frame/basebox.C b/tksao/frame/basebox.C index 6699648..556dc06 100644 --- a/tksao/frame/basebox.C +++ b/tksao/frame/basebox.C @@ -2,7 +2,6 @@ // Smithsonian Astrophysical Observatory, Cambridge, MA, USA // For conditions of distribution and use, see copyright notice in "copyright" -#include "tkx11.h" #include "tkutil.h" #include "basebox.h" #include "fitsimage.h" @@ -103,6 +102,8 @@ void BaseBox::renderPSFillDraw(int ii) } #ifdef MAC_OSX_TK +#include <macosxlib.h> + void BaseBox::renderMACOSX() { renderMACOSXGC(); @@ -125,6 +126,8 @@ void BaseBox::renderMACOSXDraw(Vector* vv) #endif #ifdef __WIN32 +#include <win32lib.h> + void BaseBox::renderWIN32() { renderWIN32GC(); diff --git a/tksao/frame/baseellipse.C b/tksao/frame/baseellipse.C index d7bbb5c..7a46e43 100644 --- a/tksao/frame/baseellipse.C +++ b/tksao/frame/baseellipse.C @@ -2,7 +2,6 @@ // Smithsonian Astrophysical Observatory, Cambridge, MA, USA // For conditions of distribution and use, see copyright notice in "copyright" -#include "tkx11.h" #include "tkutil.h" #include "baseellipse.h" #include "fitsimage.h" @@ -573,6 +572,8 @@ void BaseEllipse::renderPSInclude(PSColorSpace mode) } #ifdef MAC_OSX_TK +#include <macosxlib.h> + void BaseEllipse::renderMACOSX() { Vector r = annuli_[numAnnuli_-1]; Vector z = parent->zoom(); @@ -723,6 +724,8 @@ void BaseEllipse::renderMACOSXInclude() #endif #ifdef __WIN32 +#include <win32lib.h> + void BaseEllipse::renderWIN32() { Vector r = annuli_[numAnnuli_-1]; Vector z = parent->zoom(); diff --git a/tksao/frame/box.C b/tksao/frame/box.C index 83e6e85..48ccc36 100644 --- a/tksao/frame/box.C +++ b/tksao/frame/box.C @@ -2,7 +2,6 @@ // Smithsonian Astrophysical Observatory, Cambridge, MA, USA // For conditions of distribution and use, see copyright notice in "copyright" -#include "tkx11.h" #include "box.h" #include "fitsimage.h" @@ -63,6 +62,8 @@ void Box::renderPSDraw(int ii) } #ifdef MAC_OSX_TK +#include <macosxlib.h> + void Box::renderMACOSXDraw(Vector* vv) { if (fill_) @@ -73,6 +74,8 @@ void Box::renderMACOSXDraw(Vector* vv) #endif #ifdef __WIN32 +#include <win32xlib.h> + void Box::renderWIN32Draw(Vector* vv) { if (fill_) diff --git a/tksao/frame/bpanda.C b/tksao/frame/bpanda.C index 878c8ee..866e28c 100644 --- a/tksao/frame/bpanda.C +++ b/tksao/frame/bpanda.C @@ -2,7 +2,6 @@ // Smithsonian Astrophysical Observatory, Cambridge, MA, USA // For conditions of distribution and use, see copyright notice in "copyright" -#include "tkx11.h" #include "tkutil.h" #include "bpanda.h" #include "fitsimage.h" @@ -119,6 +118,8 @@ void Bpanda::renderPS(PSColorSpace mode) } #ifdef MAC_OSX_TK +#include <macosxlib.h> + void Bpanda::renderMACOSX() { BaseBox::renderMACOSX(); @@ -138,6 +139,8 @@ void Bpanda::renderMACOSX() #endif #ifdef __WIN32 +#include <win32lib.h> + void Bpanda::renderWIN32() { BaseBox::renderWIN32(); diff --git a/tksao/frame/circle.C b/tksao/frame/circle.C index 74d9574..397b0c4 100644 --- a/tksao/frame/circle.C +++ b/tksao/frame/circle.C @@ -2,7 +2,6 @@ // Smithsonian Astrophysical Observatory, Cambridge, MA, USA // For conditions of distribution and use, see copyright notice in "copyright" -#include "tkx11.h" #include "circle.h" #include "fitsimage.h" @@ -86,6 +85,8 @@ void Circle::renderPSDraw() } #ifdef MAC_OSX_TK +#include <macosxlib.h> + void Circle::renderMACOSXDraw() { if (fill_) @@ -96,6 +97,8 @@ void Circle::renderMACOSXDraw() #endif #ifdef __WIN32 +#include <win32lib.h> + void Circle::renderWIN32Draw() { if (fill_) diff --git a/tksao/frame/compass.C b/tksao/frame/compass.C index 58af47c..94e5a01 100644 --- a/tksao/frame/compass.C +++ b/tksao/frame/compass.C @@ -3,7 +3,6 @@ // For conditions of distribution and use, see copyright notice in "copyright" #include "util.h" -#include "tkx11.h" #include "tkutil.h" #include "compass.h" #include "fitsimage.h" @@ -256,6 +255,8 @@ void Compass::renderPSGC(PSColorSpace mode) } #ifdef MAC_OSX_TK +#include <macosxlib.h> + void Compass::renderMACOSX() { renderMACOSXGC(); @@ -321,6 +322,8 @@ void Compass::renderMACOSXGC() #endif #ifdef __WIN32 +#include <win32lib.h> + void Compass::renderWIN32() { renderWIN32GC(); diff --git a/tksao/frame/contour.C b/tksao/frame/contour.C index f3d5dd3..b79200d 100644 --- a/tksao/frame/contour.C +++ b/tksao/frame/contour.C @@ -3,11 +3,18 @@ // For conditions of distribution and use, see copyright notice in "copyright" #include "util.h" -#include "tkx11.h" #include "contour.h" #include "base.h" #include "context.h" +#ifdef MAC_OSX_TK +#include <macosxlib.h> +#endif + +#ifdef __WIN32 +#include <win32lib.h> +#endif + // ContourLevel ContourLevel::ContourLevel(Base* pp, double lev, const char* cn, diff --git a/tksao/frame/coord.h b/tksao/frame/coord.h index 2cc81c1..01886a3 100644 --- a/tksao/frame/coord.h +++ b/tksao/frame/coord.h @@ -12,6 +12,8 @@ #include <iomanip> using namespace std; +#define STRCMP(which,str,cnt) (!strncmp(toConstLower(which), str, cnt) && strlen(which)==cnt) + class FitsImage; class Coord { diff --git a/tksao/frame/cpanda.C b/tksao/frame/cpanda.C index b3e399c..2d7d049 100644 --- a/tksao/frame/cpanda.C +++ b/tksao/frame/cpanda.C @@ -2,7 +2,6 @@ // Smithsonian Astrophysical Observatory, Cambridge, MA, USA // For conditions of distribution and use, see copyright notice in "copyright" -#include "tkx11.h" #include "tkutil.h" #include "cpanda.h" #include "fitsimage.h" @@ -121,6 +120,8 @@ void Cpanda::renderPS(PSColorSpace mode) } #ifdef MAC_OSX_TK +#include <macosxlib.h> + void Cpanda::renderMACOSX() { BaseEllipse::renderMACOSX(); @@ -140,6 +141,8 @@ void Cpanda::renderMACOSX() #endif #ifdef __WIN32 +#include <win32lib.h> + void Cpanda::renderWIN32() { BaseEllipse::renderWIN32(); diff --git a/tksao/frame/ellipse.C b/tksao/frame/ellipse.C index e3476ae..2ad36d0 100644 --- a/tksao/frame/ellipse.C +++ b/tksao/frame/ellipse.C @@ -2,7 +2,6 @@ // Smithsonian Astrophysical Observatory, Cambridge, MA, USA // For conditions of distribution and use, see copyright notice in "copyright" -#include "tkx11.h" #include "ellipse.h" #include "fitsimage.h" @@ -74,6 +73,8 @@ void Ellipse::renderPSDraw() } #ifdef MAC_OSX_TK +#include <macosxlib.h> + void Ellipse::renderMACOSXDraw() { if (fill_) @@ -84,6 +85,8 @@ void Ellipse::renderMACOSXDraw() #endif #ifdef __WIN32 +#include <win32lib.h> + void Ellipse::renderWIN32Draw() { if (fill_) diff --git a/tksao/frame/epanda.C b/tksao/frame/epanda.C index 9017608..29dd397 100644 --- a/tksao/frame/epanda.C +++ b/tksao/frame/epanda.C @@ -2,7 +2,6 @@ // Smithsonian Astrophysical Observatory, Cambridge, MA, USA // For conditions of distribution and use, see copyright notice in "copyright" -#include "tkx11.h" #include "tkutil.h" #include "epanda.h" #include "fitsimage.h" @@ -119,6 +118,8 @@ void Epanda::renderPS(PSColorSpace mode) } #ifdef MAC_OSX_TK +#include <macosxlib.h> + void Epanda::renderMACOSX() { BaseEllipse::renderMACOSX(); @@ -138,6 +139,8 @@ void Epanda::renderMACOSX() #endif #ifdef __WIN32 +#include <win32lib.h> + void Epanda::renderWIN32() { BaseEllipse::renderWIN32(); diff --git a/tksao/frame/frame3dbase.C b/tksao/frame/frame3dbase.C index b3ac5db..2e11361 100644 --- a/tksao/frame/frame3dbase.C +++ b/tksao/frame/frame3dbase.C @@ -5,7 +5,6 @@ #include <tkInt.h> #include "util.h" -#include "tkx11.h" #include "tkutil.h" #include "frame3dbase.h" #include "fitsimage.h" @@ -752,7 +751,7 @@ void Frame3dBase::updateGCs() threedGC = XCreateGC(display, Tk_WindowId(tkwin), 0, NULL); XSetLineAttributes(display, threedGC, 1, LineSolid, CapButt, JoinMiter); } - XSetClipRectangles(display, threedGC, 0, 0, rectWidget, 1, Unsorted); + setClipRectangles(display, threedGC, 0, 0, rectWidget, 1, Unsorted); } void Frame3dBase::updateMatrices() @@ -1242,6 +1241,8 @@ void Frame3dBase::ximageToPixmapMagnifier() } #ifdef MAC_OSX_TK +#include <macosxlib.h> + void Frame3dBase::macosxLine(Vector& ss, Vector& tt, int dd) { if (dd) @@ -1337,6 +1338,8 @@ void Frame3dBase::macosxHighlite() #endif #ifdef __WIN32 +#include <win32lib.h> + void Frame3dBase::win32Line(Vector& ss, Vector& tt, int dd) { if (dd) diff --git a/tksao/frame/line.C b/tksao/frame/line.C index daebbba..3791924 100644 --- a/tksao/frame/line.C +++ b/tksao/frame/line.C @@ -2,7 +2,6 @@ // Smithsonian Astrophysical Observatory, Cambridge, MA, USA // For conditions of distribution and use, see copyright notice in "copyright" -#include "tkx11.h" #include "line.h" #include "fitsimage.h" @@ -90,6 +89,8 @@ void Line::renderPS(PSColorSpace mode) } #ifdef MAC_OSX_TK +#include <macosxlib.h> + void Line::renderMACOSX() { renderMACOSXGC(); @@ -112,6 +113,8 @@ void Line::renderMACOSX() #endif #ifdef __WIN32 +#include <win32lib.h> + void Line::renderWIN32() { renderWIN32GC(); diff --git a/tksao/frame/marker.C b/tksao/frame/marker.C index e2e90a6..f8456c6 100644 --- a/tksao/frame/marker.C +++ b/tksao/frame/marker.C @@ -3,7 +3,6 @@ // For conditions of distribution and use, see copyright notice in "copyright" #include "util.h" -#include "tkx11.h" #include "marker.h" #include "framebase.h" #include "frame3dbase.h" @@ -474,6 +473,8 @@ void Marker::renderPSLineNoDash() } #ifdef MAC_OSX_TK +#include <macosxlib.h> + void Marker::macosx(int tt) { if (tt) @@ -553,6 +554,8 @@ void Marker::renderMACOSXLineNoDash() #endif #ifdef __WIN32 +#include <win32lib.h> + void Marker::win32(int tt) { if (tt) diff --git a/tksao/frame/point.C b/tksao/frame/point.C index 01b149d..e8560fa 100644 --- a/tksao/frame/point.C +++ b/tksao/frame/point.C @@ -3,7 +3,6 @@ // For conditions of distribution and use, see copyright notice in "copyright" #include "util.h" -#include "tkx11.h" #include "tkutil.h" #include "point.h" #include "fitsimage.h" @@ -295,6 +294,8 @@ void Point::renderPSLineDash() // MacOSX #ifdef MAC_OSX_TK +#include <macosxlib.h> + void Point::renderMACOSX() { renderMACOSXGC(); @@ -374,6 +375,8 @@ void Point::renderMACOSXLineDash() // WIN32 #ifdef __WIN32 +#include <win32lib.h> + void Point::renderWIN32() { renderWIN32GC(); diff --git a/tksao/frame/polygon.C b/tksao/frame/polygon.C index 4f8ac2c..bf78185 100644 --- a/tksao/frame/polygon.C +++ b/tksao/frame/polygon.C @@ -2,7 +2,6 @@ // Smithsonian Astrophysical Observatory, Cambridge, MA, USA // For conditions of distribution and use, see copyright notice in "copyright" -#include "tkx11.h" // macos #include "polygon.h" #include "fitsimage.h" @@ -98,6 +97,8 @@ void Polygon::renderPS(PSColorSpace mode) } #ifdef MAC_OSX_TK +#include <macosxlib.h> + void Polygon::renderMACOSX() { renderMACOSXGC(); @@ -120,6 +121,8 @@ void Polygon::renderMACOSX() #endif #ifdef __WIN32 +#include <win32lib.h> + void Polygon::renderWIN32() { renderWIN32GC(); diff --git a/tksao/frame/projection.C b/tksao/frame/projection.C index aec8aa0..4e6e5c0 100644 --- a/tksao/frame/projection.C +++ b/tksao/frame/projection.C @@ -2,7 +2,6 @@ // Smithsonian Astrophysical Observatory, Cambridge, MA, USA // For conditions of distribution and use, see copyright notice in "copyright" -#include "tkx11.h" #include "projection.h" #include "fitsimage.h" @@ -126,6 +125,8 @@ void Projection::renderPSGC(PSColorSpace mode) } #ifdef MAC_OSX_TK +#include <macosxlib.h> + void Projection::renderMACOSX() { renderMACOSXGC(); @@ -162,6 +163,8 @@ void Projection::renderMACOSXGC() #endif #ifdef __WIN32 +#include <win32lib.h> + void Projection::renderWIN32() { renderWIN32GC(); diff --git a/tksao/frame/ruler.C b/tksao/frame/ruler.C index 332e4bc..3057f0f 100644 --- a/tksao/frame/ruler.C +++ b/tksao/frame/ruler.C @@ -3,7 +3,6 @@ // For conditions of distribution and use, see copyright notice in "copyright" #include "util.h" -#include "tkx11.h" #include "ruler.h" #include "fitsimage.h" @@ -181,6 +180,8 @@ void Ruler::renderPSGC(PSColorSpace mode) } #ifdef MAC_OSX_TK +#include <macosxlib.h> + void Ruler::renderMACOSX() { renderMACOSXGC(); @@ -236,6 +237,8 @@ void Ruler::renderMACOSXGC() // WIN32 #ifdef __WIN32 +#include <win32lib.h> + void Ruler::renderWIN32() { renderWIN32GC(); diff --git a/tksao/frame/segment.C b/tksao/frame/segment.C index ac1ffa7..4a87c6c 100644 --- a/tksao/frame/segment.C +++ b/tksao/frame/segment.C @@ -2,7 +2,6 @@ // Smithsonian Astrophysical Observatory, Cambridge, MA, USA // For conditions of distribution and use, see copyright notice in "copyright" -#include "tkx11.h" #include "segment.h" #include "fitsimage.h" @@ -76,6 +75,8 @@ void Segment::renderPS(PSColorSpace mode) } #ifdef MAC_OSX_TK +#include <macosxlib.h> + void Segment::renderMACOSX() { renderMACOSXGC(); @@ -94,6 +95,8 @@ void Segment::renderMACOSX() #endif #ifdef __WIN32 +#include <win32lib.h> + void Segment::renderWIN32() { renderWIN32GC(); diff --git a/tksao/frame/text.C b/tksao/frame/text.C index d73e640..b6a4bf5 100644 --- a/tksao/frame/text.C +++ b/tksao/frame/text.C @@ -2,7 +2,6 @@ // Smithsonian Astrophysical Observatory, Cambridge, MA, USA // For conditions of distribution and use, see copyright notice in "copyright" -#include "tkx11.h" #include "tkutil.h" #include "text.h" #include "fitsimage.h" @@ -93,6 +92,8 @@ void Text::renderPS(PSColorSpace mode) } #ifdef MAC_OSX_TK +#include <macosxlib.h> + void Text::renderMACOSX() { renderMACOSXGC(); @@ -121,6 +122,8 @@ void Text::renderMACOSX() #endif #ifdef __WIN32 +#include <win32xlib.h> + void Text::renderWIN32() { renderWIN32GC(); diff --git a/tksao/tkutil/gridbase.C b/tksao/tkutil/gridbase.C index 87e846d..af795b5 100644 --- a/tksao/tkutil/gridbase.C +++ b/tksao/tkutil/gridbase.C @@ -3,7 +3,6 @@ // For conditions of distribution and use, see copyright notice in "copyright" #include "util.h" -#include "tkx11.h" #include "tkutil.h" #include "gridbase.h" #include "attribute.h" @@ -267,6 +266,8 @@ void GridBase::psColor(Attribute* attr) } #ifdef MAC_OSX_TK +#include <macosxlib.h> + int GridBase::macosxLine(int n, float* x, float* y) { if (n<2 || !x || !y) @@ -317,6 +318,8 @@ int GridBase::macosxText(const char* txt, float x, float y, #endif #ifdef __WIN32 +#include <win32lib.h> + int GridBase::win32Line(int n, float* x, float* y) { if (n<2 || !x || !y) diff --git a/tksao/tkutil/tkutil.h b/tksao/tkutil/tkutil.h index aa4560b..3a9208c 100644 --- a/tksao/tkutil/tkutil.h +++ b/tksao/tkutil/tkutil.h @@ -18,8 +18,6 @@ #include <iomanip> using namespace std; -#define STRCMP(which,str,cnt) (!strncmp(toConstLower(which), str, cnt) && strlen(which)==cnt) - #ifndef __CYGWIN__ static const double M_TWOPI = 2*M_PI; #endif diff --git a/tksao/tkutil/tkx11.C b/tksao/tkutil/tkx11.C deleted file mode 100644 index 7e87269..0000000 --- a/tksao/tkutil/tkx11.C +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (C) 1999-2020 -// Smithsonian Astrophysical Observatory, Cambridge, MA, USA -// For conditions of distribution and use, see copyright notice in "copyright" - -#include <tk.h> - -#include "tkx11.h" - -#if defined (MAC_OSX_TK) || (_WIN32) -#include <tkInt.h> - -int XSetClipRectangles(Display *d, GC gc, int clip_x_origin, int clip_y_origin, - XRectangle* rectangles, int n, int ordering) -{ - TkRegion clipRgn = TkCreateRegion(); - - while (n--) { - XRectangle rect = *rectangles; - - rect.x += clip_x_origin; - rect.y += clip_y_origin; - TkUnionRectWithRegion(&rect, clipRgn, clipRgn); - rectangles++; - } - TkSetRegion(d, gc, clipRgn); - TkDestroyRegion(clipRgn); - return 1; -} - -#endif diff --git a/tksao/tkutil/tkx11.h b/tksao/tkutil/tkx11.h deleted file mode 100644 index 7406420..0000000 --- a/tksao/tkutil/tkx11.h +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (C) 1999-2020 -// Smithsonian Astrophysical Observatory, Cambridge, MA, USA -// For conditions of distribution and use, see copyright notice in "copyright" - -// important note: needs to be included first as X11 defs are here - -#ifndef __tkx11_h__ -#define __tkx11_h__ - -#include <X11/Xlib.h> -#include <X11/Xutil.h> - -#ifdef _WIN32 -#include <win32lib.h> -#endif - -#ifdef MAC_OSX_TK -#include <macosxlib.h> -void XXWarpPointer(Display* display, Window src_w, Window dest_w, - int src_x, int src_y, - unsigned int src_width, unsigned int src_height, - int dest_x, int dest_y); -#endif - -#if defined (MAC_OSX_TK) || (_WIN32) -int XSetClipRectangles(Display *d, GC gc, int clip_x_origin, int clip_y_origin, - XRectangle* rectangles, int n, int ordering); -#endif - -#endif diff --git a/tksao/widget/widget.C b/tksao/widget/widget.C index 944700f..bb123e2 100644 --- a/tksao/widget/widget.C +++ b/tksao/widget/widget.C @@ -4,7 +4,6 @@ #include <tkInt.h> -#include "tkx11.h" #include "widget.h" // Tk Canvas Widget Functions Declaration @@ -605,17 +604,42 @@ XColor* Widget::getXColor(const char* str) return cc; }; +#if !(_WIN32 || MAC_OSX_TK) void Widget::warp(Vector& vv) { -#if !(_WIN32 || MAC_OSX_TK) XWarpPointer(display, None, None, 0, 0, 0, 0, vv[0], vv[1]); +} + +void Widget::warpTo(Vector& vv) +{ + XWarpPointer(display, None, Tk_WindowId(tkwin), 0, 0, 0, 0, vv[0], vv[1]); +} + +int Widget:setClipRectangles(Display *d, GC gc, int x, int y, + XRectangle* rects, int n, int order) +{ + XSetClipRectangles(d, gc, x, y, rects, n, order); +} #endif #ifdef MAC_OSX_TK +#include <macosxlib.h> + +void Widget::warp(Vector& vv) +{ XXWarpPointer(display, None, None, 0, 0, 0, 0, vv[0], vv[1]); +} + +void Widget::warpTo(Vector& vv) +{ + XXWarpPointer(display, None, Tk_WindowId(tkwin), 0, 0, 0, 0, vv[0], vv[1]); +} + #endif #ifdef _WIN32 +void Widget::warp(Vector& vv) +{ Window root, child; int rootx,rooty,winx,winy; unsigned int msk; @@ -626,19 +650,35 @@ void Widget::warp(Vector& vv) XWarpPointer(display, None, Tk_WindowId(tkwin), 0, 0, 0, 0, rootx-xx+vv[0], rooty-yy+vv[1]); -#endif } void Widget::warpTo(Vector& vv) { -#if !MAC_OSX_TK XWarpPointer(display, None, Tk_WindowId(tkwin), 0, 0, 0, 0, vv[0], vv[1]); +} #endif -#ifdef MAC_OSX_TK - XXWarpPointer(display, None, Tk_WindowId(tkwin), 0, 0, 0, 0, vv[0], vv[1]); -#endif +#if (_WIN32 || MAC_OSX_TK) +#include <tkInt.h> + +int Widget::setClipRectangles(Display *d, GC gc, int x, int y, + XRectangle* rects, int n, int order) +{ + TkRegion clipRgn = TkCreateRegion(); + + while (n--) { + XRectangle rect = *rects; + + rect.x += x; + rect.y += y; + TkUnionRectWithRegion(&rect, clipRgn, clipRgn); + rects++; + } + TkSetRegion(d, gc, clipRgn); + TkDestroyRegion(clipRgn); + return 1; } +#endif Vector Widget::TkCanvasPs(const Vector& v) { return Vector(v[0], Tk_CanvasPsY(canvas, v[1])); diff --git a/tksao/widget/widget.h b/tksao/widget/widget.h index 39aa6d3..d357af1 100644 --- a/tksao/widget/widget.h +++ b/tksao/widget/widget.h @@ -167,6 +167,8 @@ class Widget { void warp(Vector&); void warpTo(Vector&); + int setClipRectangles(Display *d, GC gc, int x, int y, + XRectangle* rects, int n, int order); Vector TkCanvasPs(const Vector&); void psColor(PSColorSpace mode, XColor* clr); |