1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
// Copyright (C) 1999-2016
// Smithsonian Astrophysical Observatory, Cambridge, MA, USA
// For conditions of distribution and use, see copyright notice in "copyright"
#ifndef __tkwin32_h__
#define __tkwin32_h__
#include <tcl.h>
// must define vector.h before windows.h to avoid conflicts with min,max
#include <vector.h>
//#include <Windows.h>
/*
#define DEF_DOCNAME "SAO/DS9"
#define SZ_LINE 1024
#define TYPE_FILE 1
#define TYPE_STRING 2
*/
//struct TkFont;
class TkWin32 {
private:
Tcl_Interp* interp;
/*
Tk_Window tkwin;
// print information
PRINTDLG pd;
PAGESETUPDLG psd;
HPEN hPen;
HPEN ohPen;
HBRUSH hBrush;
HBRUSH ohBrush;
int penStyle;
int penWidth;
COLORREF penColor;
DWORD dwStyleCount;
DWORD *lpStyle;
int showDialog;
// font info
TkFont* font_;
// margin info
RECT margins;
int iLeftAdjust;
int iTopAdjust;
int iRightAdjust;
int iBottomAdjust;
int iPhysWidth;
int iPhysHeight;
int iPhysOffX;
int iPhysOffY;
int iHorzRes;
int iVertRes;
int iWidth;
int iHeight;
int yChar;
// doc info
int type;
char *buf;
char *bptr;
FILE *fd;
int nline;
int maxline;
char **lines;
// scaling
double pageScale;
double fontScale;
Matrix canvasToPage;
// UINT CALLBACK QueryAbort();
UINT QueryAbort();
BOOL DocNew();
BOOL DocOpen(const char *s, int maxline, int type);
int DocNextPage();
void DocClose();
BOOL DocFree();
BOOL GetDocInfo(DOCINFO *di);
BOOL GetMarginInfo();
void SetPen(int flag);
BOOL WinPrintPageSetup();
BOOL WinPrintDialog();
BOOL WinPrintText(const char *s, int type);
BOOL WinPrintRelease();
int pmPrint(int, const char**);
int pmPrintBegin(int, const char**);
int pmPrintEnd();
int pmPrintText(int, const char**);
int pmPageSetup();
*/
public:
TkWin32(Tcl_Interp*);
~TkWin32() {};
/*
int pm(int, const char**);
double getPageScale() {return pageScale;}
const Matrix& getCanvasToPage() {return canvasToPage;}
*/
void begin();
void end();
void color(int, int, int);
void width(float);
void dash(float*,int);
void font(Tk_Font);
void clip(float, float, float, float);
void newpath();
void stroke();
void fill();
void arc(float, float, float, float, float);
void curve(float, float, float, float, float, float, float, float);
void drawText(float, float, float, const char*);
void drawLines(float*, float*, int);
void fillPolygon(float*, float*, int);
void drawArc(float, float, float, float, float);
void bitmapCreate(void*, int, int, float, float, float, float);
};
extern TkWin32* tkwin32;
#endif
|