[396b9dd] | 1 | /* printwin.c */ |
---|
[55b7334] | 2 | /* Device dependent part of Survex Win32 driver */ |
---|
[b7b666d] | 3 | /* Copyright (C) 1993-2002 Olly Betts |
---|
[4888f06] | 4 | * Copyright (C) 2001 Philip Underwood |
---|
[55b7334] | 5 | * |
---|
| 6 | * This program is free software; you can redistribute it and/or modify |
---|
| 7 | * it under the terms of the GNU General Public License as published by |
---|
| 8 | * the Free Software Foundation; either version 2 of the License, or |
---|
| 9 | * (at your option) any later version. |
---|
| 10 | * |
---|
| 11 | * This program is distributed in the hope that it will be useful, |
---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 14 | * GNU General Public License for more details. |
---|
| 15 | * |
---|
| 16 | * You should have received a copy of the GNU General Public License |
---|
| 17 | * along with this program; if not, write to the Free Software |
---|
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
| 19 | */ |
---|
| 20 | |
---|
| 21 | #ifdef HAVE_CONFIG_H |
---|
| 22 | # include <config.h> |
---|
| 23 | #endif |
---|
| 24 | |
---|
| 25 | #include <stdio.h> |
---|
| 26 | #include <stdlib.h> |
---|
| 27 | #include <math.h> |
---|
| 28 | #include <string.h> |
---|
| 29 | #include <time.h> |
---|
| 30 | #include <ctype.h> |
---|
| 31 | #include <float.h> |
---|
| 32 | #include <limits.h> |
---|
| 33 | |
---|
[c34796a] | 34 | #include "debug.h" /* for BUG and ASSERT */ |
---|
| 35 | #include "filelist.h" |
---|
[55b7334] | 36 | #include "filename.h" |
---|
[c34796a] | 37 | #include "ini.h" |
---|
[55b7334] | 38 | #include "message.h" |
---|
| 39 | #include "prcore.h" |
---|
[c34796a] | 40 | #include "prio.h" |
---|
| 41 | #include "useful.h" |
---|
| 42 | |
---|
[55b7334] | 43 | #include <windows.h> |
---|
| 44 | |
---|
[6974a34] | 45 | static double MarginLeft, MarginRight, MarginTop, MarginBottom; |
---|
[55b7334] | 46 | static int fontsize, fontsize_labels; |
---|
[6974a34] | 47 | static double LineWidth; |
---|
[55b7334] | 48 | |
---|
| 49 | static char *fontname, *fontname_labels; |
---|
| 50 | |
---|
| 51 | static const char *win_Name(void); |
---|
| 52 | static int win_Pre(int pagesToPrint, const char *title); |
---|
| 53 | static void win_NewPage(int pg, int pass, int pagesX, int pagesY); |
---|
[3857e321] | 54 | static char *win_Init(FILE **fh_list, const char *pth, const char *outfnm, |
---|
| 55 | double *pscX, double *pscY, bool fCalibrate); |
---|
[08e95aa] | 56 | static int win_Charset(void); |
---|
[55b7334] | 57 | static void win_MoveTo(long x, long y); |
---|
| 58 | static void win_DrawTo(long x, long y); |
---|
| 59 | static void win_DrawCross(long x, long y); |
---|
[abb82a4] | 60 | static void win_SetFont(int fontcode); |
---|
[54a5339] | 61 | static void win_SetColour(int colourcode); |
---|
[55b7334] | 62 | static void win_WriteString(const char *s); |
---|
| 63 | static void win_DrawCircle(long x, long y, long r); |
---|
| 64 | static void win_ShowPage(const char *szPageDetails); |
---|
| 65 | static void win_Quit(void); |
---|
| 66 | |
---|
| 67 | device printer = { |
---|
[a7f068f] | 68 | PR_FLAG_NOFILEOUTPUT, /* |PR_FLAG_NOINI - now read fontsize from ini file */ |
---|
[55b7334] | 69 | win_Name, |
---|
| 70 | win_Init, |
---|
[08e95aa] | 71 | win_Charset, |
---|
[55b7334] | 72 | win_Pre, |
---|
| 73 | win_NewPage, |
---|
| 74 | win_MoveTo, |
---|
| 75 | win_DrawTo, |
---|
| 76 | win_DrawCross, |
---|
[abb82a4] | 77 | win_SetFont, |
---|
[ca4058d] | 78 | win_SetColour, |
---|
[55b7334] | 79 | win_WriteString, |
---|
| 80 | win_DrawCircle, |
---|
| 81 | win_ShowPage, |
---|
[9d46af2] | 82 | NULL, /* win_Post */ |
---|
[55b7334] | 83 | win_Quit |
---|
| 84 | }; |
---|
| 85 | |
---|
[d0ffc05] | 86 | static HDC pd; /* printer context */ |
---|
[55b7334] | 87 | |
---|
[9e58834] | 88 | static TEXTMETRIC *tm, tm_labels, tm_default; /* font info */ |
---|
[55b7334] | 89 | |
---|
[ca4058d] | 90 | static COLORREF colour_leg, colour_surface_leg, colour_cross, colour_frame; |
---|
| 91 | static COLORREF colour_text, colour_labels; |
---|
[54a5339] | 92 | static HPEN pen_leg, pen_surface_leg, pen_cross, pen_frame; |
---|
[ca4058d] | 93 | |
---|
[6974a34] | 94 | static double scX, scY; |
---|
[55b7334] | 95 | |
---|
[396b9dd] | 96 | static int cur_pass; |
---|
| 97 | |
---|
[55b7334] | 98 | static border clip; |
---|
| 99 | |
---|
| 100 | static long xpPageWidth, ypPageDepth; |
---|
| 101 | |
---|
[0658e7b] | 102 | static long x_t, y_t; |
---|
| 103 | |
---|
[396b9dd] | 104 | static int |
---|
| 105 | check_intersection(long x_p, long y_p) |
---|
| 106 | { |
---|
| 107 | #define U 1 |
---|
| 108 | #define D 2 |
---|
| 109 | #define L 4 |
---|
[421b7d2] | 110 | #define R 8 |
---|
[f7cdeb2] | 111 | int mask_p = 0, mask_t = 0; |
---|
[f17dbe2] | 112 | if (x_p < 0) |
---|
[396b9dd] | 113 | mask_p = L; |
---|
[f17dbe2] | 114 | else if (x_p > xpPageWidth) |
---|
[396b9dd] | 115 | mask_p = R; |
---|
| 116 | |
---|
[f17dbe2] | 117 | if (y_p < 0) |
---|
[396b9dd] | 118 | mask_p |= D; |
---|
[f17dbe2] | 119 | else if (y_p > ypPageDepth) |
---|
[396b9dd] | 120 | mask_p |= U; |
---|
| 121 | |
---|
[f17dbe2] | 122 | if (x_t < 0) |
---|
[396b9dd] | 123 | mask_t = L; |
---|
[f17dbe2] | 124 | else if (x_t > xpPageWidth) |
---|
[396b9dd] | 125 | mask_t = R; |
---|
| 126 | |
---|
[f17dbe2] | 127 | if (y_t < 0) |
---|
[396b9dd] | 128 | mask_t |= D; |
---|
[f17dbe2] | 129 | else if (y_t > ypPageDepth) |
---|
[396b9dd] | 130 | mask_t |= U; |
---|
| 131 | |
---|
| 132 | #if 0 |
---|
| 133 | /* approximation to correct answer */ |
---|
| 134 | return !(mask_t & mask_p); |
---|
[69fde77] | 135 | #else |
---|
[396b9dd] | 136 | /* One end of the line is on the page */ |
---|
| 137 | if (!mask_t || !mask_p) return 1; |
---|
| 138 | |
---|
| 139 | /* whole line is above, left, right, or below page */ |
---|
| 140 | if (mask_t & mask_p) return 0; |
---|
| 141 | |
---|
| 142 | if (mask_t == 0) mask_t = mask_p; |
---|
| 143 | if (mask_t & U) { |
---|
[f17dbe2] | 144 | double v = (double)(y_p - ypPageDepth) / (y_p - y_t); |
---|
[396b9dd] | 145 | return v >= 0 && v <= 1; |
---|
| 146 | } |
---|
| 147 | if (mask_t & D) { |
---|
[f17dbe2] | 148 | double v = (double)y_p / (y_p - y_t); |
---|
[396b9dd] | 149 | return v >= 0 && v <= 1; |
---|
| 150 | } |
---|
| 151 | if (mask_t & R) { |
---|
[f17dbe2] | 152 | double v = (double)(x_p - xpPageWidth) / (x_p - x_t); |
---|
[396b9dd] | 153 | return v >= 0 && v <= 1; |
---|
| 154 | } |
---|
| 155 | ASSERT(mask_t & L); |
---|
| 156 | { |
---|
[f17dbe2] | 157 | double v = (double)x_p / (x_p - x_t); |
---|
[396b9dd] | 158 | return v >= 0 && v <= 1; |
---|
| 159 | } |
---|
| 160 | #endif |
---|
| 161 | #undef U |
---|
| 162 | #undef D |
---|
| 163 | #undef L |
---|
| 164 | #undef R |
---|
| 165 | } |
---|
| 166 | |
---|
[55b7334] | 167 | static const char * |
---|
| 168 | win_Name(void) |
---|
| 169 | { |
---|
| 170 | return "Win32 Printer"; |
---|
| 171 | } |
---|
| 172 | |
---|
| 173 | static void |
---|
| 174 | win_MoveTo(long x, long y) |
---|
| 175 | { |
---|
| 176 | x_t = x - clip.x_min; |
---|
| 177 | y_t = clip.y_max - y; |
---|
[396b9dd] | 178 | if (cur_pass != -1) MoveToEx(pd, x_t, y_t, NULL); |
---|
[55b7334] | 179 | } |
---|
| 180 | |
---|
| 181 | static void |
---|
| 182 | win_DrawTo(long x, long y) |
---|
| 183 | { |
---|
[396b9dd] | 184 | long x_p = x_t, y_p = y_t; |
---|
[55b7334] | 185 | x_t = x - clip.x_min; |
---|
| 186 | y_t = clip.y_max - y; |
---|
[396b9dd] | 187 | if (cur_pass != -1) { |
---|
| 188 | LineTo(pd, x_t, y_t); |
---|
| 189 | } else { |
---|
| 190 | if (check_intersection(x_p, y_p)) fBlankPage = fFalse; |
---|
| 191 | } |
---|
[55b7334] | 192 | } |
---|
| 193 | |
---|
[7be0ba8] | 194 | #define POINTS_PER_INCH 72.0 |
---|
| 195 | #define POINTS_PER_MM (POINTS_PER_INCH / MM_PER_INCH) |
---|
| 196 | #define WIN_CROSS_SIZE (2 * scX / POINTS_PER_MM) |
---|
| 197 | |
---|
[55b7334] | 198 | static void |
---|
| 199 | win_DrawCross(long x, long y) |
---|
| 200 | { |
---|
[396b9dd] | 201 | if (cur_pass != -1) { |
---|
[d3d9230] | 202 | win_MoveTo(x - WIN_CROSS_SIZE, y - WIN_CROSS_SIZE); |
---|
| 203 | win_DrawTo(x + WIN_CROSS_SIZE, y + WIN_CROSS_SIZE); |
---|
| 204 | win_MoveTo(x + WIN_CROSS_SIZE, y - WIN_CROSS_SIZE); |
---|
| 205 | win_DrawTo(x - WIN_CROSS_SIZE, y + WIN_CROSS_SIZE); |
---|
[396b9dd] | 206 | win_MoveTo(x, y); |
---|
| 207 | } else { |
---|
[39e4399a] | 208 | if ((x + WIN_CROSS_SIZE > clip.x_min && |
---|
| 209 | x - WIN_CROSS_SIZE < clip.x_max) || |
---|
| 210 | (y + WIN_CROSS_SIZE > clip.y_min && |
---|
| 211 | y - WIN_CROSS_SIZE < clip.y_max)) { |
---|
[396b9dd] | 212 | fBlankPage = fFalse; |
---|
| 213 | } |
---|
| 214 | } |
---|
[55b7334] | 215 | } |
---|
| 216 | |
---|
[b7b666d] | 217 | static HFONT font_labels, font_default, font_old; |
---|
| 218 | |
---|
[abb82a4] | 219 | static void |
---|
| 220 | win_SetFont(int fontcode) |
---|
| 221 | { |
---|
| 222 | switch (fontcode) { |
---|
| 223 | case PR_FONT_DEFAULT: |
---|
[b7b666d] | 224 | SelectObject(pd, font_default); |
---|
[9e58834] | 225 | tm = &tm_default; |
---|
[abb82a4] | 226 | break; |
---|
| 227 | case PR_FONT_LABELS: |
---|
[b7b666d] | 228 | SelectObject(pd, font_labels); |
---|
[9e58834] | 229 | tm = &tm_labels; |
---|
[abb82a4] | 230 | break; |
---|
| 231 | default: |
---|
| 232 | BUG("unknown font code"); |
---|
| 233 | } |
---|
| 234 | } |
---|
| 235 | |
---|
[ca4058d] | 236 | static void |
---|
| 237 | win_SetColour(int colourcode) |
---|
| 238 | { |
---|
| 239 | switch (colourcode) { |
---|
| 240 | case PR_COLOUR_TEXT: |
---|
[d1dcddc] | 241 | SetTextColor(colour_text); |
---|
[ca4058d] | 242 | break; |
---|
| 243 | case PR_COLOUR_LABELS: |
---|
[d1dcddc] | 244 | SetTextColor(colour_labels); |
---|
[ca4058d] | 245 | break; |
---|
| 246 | case PR_COLOUR_FRAME: |
---|
| 247 | SelectObject(pd, pen_frame); |
---|
| 248 | break; |
---|
| 249 | case PR_COLOUR_LEG: |
---|
| 250 | SelectObject(pd, pen_leg); |
---|
| 251 | break; |
---|
| 252 | case PR_COLOUR_CROSS: |
---|
| 253 | SelectObject(pd, pen_cross); |
---|
| 254 | break; |
---|
| 255 | case PR_COLOUR_SURFACE_LEG: |
---|
| 256 | SelectObject(pd, pen_surface_leg); |
---|
| 257 | break; |
---|
| 258 | default: |
---|
| 259 | BUG("unknown colour code"); |
---|
| 260 | } |
---|
| 261 | } |
---|
| 262 | |
---|
[55b7334] | 263 | static void |
---|
| 264 | win_WriteString(const char *s) |
---|
| 265 | { |
---|
[396b9dd] | 266 | if (cur_pass != -1) { |
---|
[9e58834] | 267 | TextOut(pd, x_t, y_t - tm->tmAscent, s, strlen(s)); |
---|
[396b9dd] | 268 | } else { |
---|
[9e58834] | 269 | if ((y_t + tm->tmDescent > 0 && |
---|
| 270 | y_t - tm->tmAscent < clip.y_max - clip.y_min) || |
---|
[396b9dd] | 271 | (x_t < clip.x_max - clip.x_min && |
---|
[9e58834] | 272 | x_t + strlen(s) * tm->tmAveCharWidth > 0)) { |
---|
[396b9dd] | 273 | fBlankPage = fFalse; |
---|
| 274 | } |
---|
| 275 | } |
---|
[55b7334] | 276 | } |
---|
| 277 | |
---|
| 278 | static void |
---|
| 279 | win_DrawCircle(long x, long y, long r) |
---|
| 280 | { |
---|
[396b9dd] | 281 | /* Don't need to check in first-pass - circle is only used in title box */ |
---|
| 282 | if (cur_pass != -1) { |
---|
| 283 | x_t = x - clip.x_min; |
---|
| 284 | y_t = clip.y_max - y; |
---|
| 285 | Ellipse(pd, x_t - r, y_t - r, x_t + r, y_t + r); |
---|
| 286 | } |
---|
[55b7334] | 287 | } |
---|
| 288 | |
---|
[08e95aa] | 289 | static int |
---|
| 290 | win_Charset(void) |
---|
| 291 | { |
---|
| 292 | return CHARSET_ISO_8859_1; |
---|
| 293 | } |
---|
| 294 | |
---|
[55b7334] | 295 | static int |
---|
| 296 | win_Pre(int pagesToPrint, const char *title) |
---|
| 297 | { |
---|
[5824d76] | 298 | PRINTDLGA psd; |
---|
| 299 | DOCINFO info; |
---|
[6b1901c] | 300 | int logpixelsy; |
---|
[5824d76] | 301 | |
---|
| 302 | pagesToPrint = pagesToPrint; /* suppress compiler warning */ |
---|
[9d46af2] | 303 | |
---|
[5824d76] | 304 | memset(&psd, 0, sizeof(PRINTDLGA)); |
---|
[d0ffc05] | 305 | psd.lStructSize = 66; |
---|
[5824d76] | 306 | psd.Flags = PD_RETURNDC | PD_RETURNDEFAULT; |
---|
[8bc2567] | 307 | |
---|
[5824d76] | 308 | if (!PrintDlgA(&psd)) exit(1); |
---|
[d0ffc05] | 309 | pd = psd.hDC; |
---|
[5824d76] | 310 | |
---|
[cdbfeff] | 311 | logpixelsy = GetDeviceCaps(pd, LOGPIXELSY); |
---|
[6b1901c] | 312 | font_labels = CreateFont(-MulDiv(fontsize_labels, logpixelsy, 72), |
---|
| 313 | 0, 0, 0, FW_NORMAL, 0, 0, 0, |
---|
[abb82a4] | 314 | ANSI_CHARSET, OUT_DEFAULT_PRECIS, |
---|
| 315 | CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, |
---|
[9e58834] | 316 | FF_DONTCARE | DEFAULT_PITCH, "Arial"); |
---|
[6b1901c] | 317 | font_default = CreateFont(-MulDiv(fontsize, logpixelsy, 72), |
---|
| 318 | 0, 0, 0, FW_NORMAL, 0, 0, 0, |
---|
| 319 | ANSI_CHARSET, OUT_DEFAULT_PRECIS, |
---|
| 320 | CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, |
---|
[9e58834] | 321 | FF_DONTCARE | DEFAULT_PITCH, "Arial"); |
---|
[ca4058d] | 322 | pen_leg = CreatePen(PS_SOLID, 0, colour_leg); |
---|
| 323 | pen_surface_leg = CreatePen(PS_SOLID, 0, colour_surface_leg); |
---|
| 324 | pen_cross = CreatePen(PS_SOLID, 0, colour_cross); |
---|
| 325 | pen_frame = CreatePen(PS_SOLID, 0, colour_frame); |
---|
[abb82a4] | 326 | font_old = SelectObject(pd, font_labels); |
---|
| 327 | GetTextMetrics(pd, &tm_labels); |
---|
| 328 | SelectObject(pd, font_default); |
---|
| 329 | GetTextMetrics(pd, &tm_default); |
---|
[9e58834] | 330 | |
---|
[8bc2567] | 331 | memset(&info, 0, sizeof(DOCINFO)); |
---|
[d0ffc05] | 332 | info.cbSize = sizeof(DOCINFO); |
---|
[5824d76] | 333 | info.lpszDocName = title; |
---|
| 334 | |
---|
[d0ffc05] | 335 | StartDoc(pd, &info); |
---|
| 336 | return 1; /* only need 1 pass */ |
---|
[55b7334] | 337 | } |
---|
| 338 | |
---|
| 339 | static void |
---|
| 340 | win_NewPage(int pg, int pass, int pagesX, int pagesY) |
---|
| 341 | { |
---|
| 342 | int x, y; |
---|
| 343 | |
---|
[396b9dd] | 344 | x = (pg - 1) % pagesX; |
---|
| 345 | y = pagesY - 1 - ((pg - 1) / pagesX); |
---|
| 346 | |
---|
[f17dbe2] | 347 | clip.x_min = (long)x * xpPageWidth; |
---|
| 348 | clip.y_min = (long)y * ypPageDepth; |
---|
| 349 | clip.x_max = clip.x_min + xpPageWidth; /* dm/pcl/ps had -1; */ |
---|
| 350 | clip.y_max = clip.y_min + ypPageDepth; /* dm/pcl/ps had -1; */ |
---|
| 351 | |
---|
[396b9dd] | 352 | cur_pass = pass; |
---|
[f3ed07f] | 353 | if (pass == -1) return; |
---|
[55b7334] | 354 | |
---|
| 355 | StartPage(pd); |
---|
[7be0ba8] | 356 | drawticks(clip, 9 * scX / POINTS_PER_MM, x, y); |
---|
[55b7334] | 357 | } |
---|
| 358 | |
---|
| 359 | static void |
---|
| 360 | win_ShowPage(const char *szPageDetails) |
---|
| 361 | { |
---|
[d0ffc05] | 362 | win_MoveTo((long)(6 * scX) + clip.x_min, clip.y_min - (long)(7 * scY)); |
---|
| 363 | win_WriteString(szPageDetails); |
---|
| 364 | EndPage(pd); |
---|
[55b7334] | 365 | } |
---|
| 366 | |
---|
[ca4058d] | 367 | static COLORREF |
---|
| 368 | to_rgb(const char *var, char *val) |
---|
| 369 | { |
---|
| 370 | unsigned long rgb = as_colour(var, val); |
---|
| 371 | return RGB((rgb & 0xff0000) >> 16, (rgb & 0xff00) >> 8, rgb & 0xff); |
---|
| 372 | } |
---|
| 373 | |
---|
[9d46af2] | 374 | /* Initialise printer routines */ |
---|
[3857e321] | 375 | static char * |
---|
[e1fb3cb] | 376 | win_Init(FILE **fh_list, const char *pth, const char *out_fnm, |
---|
[b7b666d] | 377 | double *pscX, double *pscY, bool fCalibrate) |
---|
[55b7334] | 378 | { |
---|
[5824d76] | 379 | PRINTDLGA psd; |
---|
[de035c3] | 380 | LPDEVNAMES dn; |
---|
[abb82a4] | 381 | static const char *vars[] = { |
---|
| 382 | "like", |
---|
| 383 | "font_size_labels", |
---|
[ca4058d] | 384 | "colour_text", |
---|
| 385 | "colour_labels", |
---|
| 386 | "colour_frame", |
---|
| 387 | "colour_legs", |
---|
| 388 | "colour_crosses", |
---|
| 389 | "colour_surface_legs", |
---|
[abb82a4] | 390 | NULL |
---|
| 391 | }; |
---|
| 392 | char **vals; |
---|
| 393 | |
---|
| 394 | fCalibrate = fCalibrate; /* suppress unused argument warning */ |
---|
[e1fb3cb] | 395 | out_fnm = out_fnm; |
---|
[c34796a] | 396 | pth = pth; |
---|
[9d46af2] | 397 | |
---|
[abb82a4] | 398 | vals = ini_read_hier(fh_list, "win", vars); |
---|
| 399 | |
---|
[3aff368] | 400 | fontsize_labels = as_int(vars[1], vals[1], 1, INT_MAX); |
---|
[abb82a4] | 401 | fontsize = 10; |
---|
| 402 | |
---|
[ca4058d] | 403 | colour_text = to_rgb(vars[2], vals[2]); |
---|
| 404 | colour_labels = to_rgb(vars[3], vals[3]); |
---|
| 405 | colour_frame = to_rgb(vars[4], vals[4]); |
---|
| 406 | colour_leg = to_rgb(vars[5], vals[5]); |
---|
| 407 | colour_cross = to_rgb(vars[6], vals[6]); |
---|
| 408 | |
---|
[5824d76] | 409 | memset(&psd, 0, sizeof(PRINTDLGA)); |
---|
[d0ffc05] | 410 | psd.lStructSize = 66; |
---|
[5824d76] | 411 | psd.Flags = PD_RETURNDC | PD_RETURNDEFAULT; |
---|
| 412 | |
---|
[421b7d2] | 413 | if (!PrintDlgA(&psd)) exit(1); |
---|
[5824d76] | 414 | |
---|
[d0ffc05] | 415 | PaperWidth = GetDeviceCaps(psd.hDC, HORZSIZE); |
---|
| 416 | PaperDepth = GetDeviceCaps(psd.hDC, VERTSIZE); |
---|
| 417 | xpPageWidth = GetDeviceCaps(psd.hDC, HORZRES); |
---|
| 418 | ypPageDepth = GetDeviceCaps(psd.hDC, VERTRES); |
---|
| 419 | MarginLeft = MarginBottom = 0; |
---|
| 420 | MarginRight = PaperWidth; |
---|
| 421 | MarginTop = PaperDepth; |
---|
| 422 | LineWidth = 0; |
---|
| 423 | scX = *pscX = xpPageWidth / PaperWidth; |
---|
| 424 | scY = *pscY = ypPageDepth / PaperDepth; |
---|
| 425 | xpPageWidth--; |
---|
| 426 | ypPageDepth = ypPageDepth - (int)(10 * *pscY); |
---|
| 427 | DeleteDC(psd.hDC); |
---|
[5757725] | 428 | |
---|
[3857e321] | 429 | dn = GlobalLock(psd.hDevNames); |
---|
| 430 | if (dn) { |
---|
| 431 | char *p = osstrdup((char *)dn + dn->wDeviceOffset); |
---|
| 432 | GlobalUnlock(psd.hDevNames); |
---|
| 433 | return p; |
---|
| 434 | } |
---|
| 435 | return NULL; |
---|
[55b7334] | 436 | } |
---|
| 437 | |
---|
| 438 | static void |
---|
| 439 | win_Quit(void) |
---|
| 440 | { |
---|
[abb82a4] | 441 | SelectObject(pd, font_old); |
---|
| 442 | DeleteObject(font_labels); |
---|
| 443 | DeleteObject(font_default); |
---|
[d0ffc05] | 444 | EndDoc(pd); |
---|
| 445 | DeleteDC(pd); |
---|
[55b7334] | 446 | } |
---|