WinPrinterContext.st
author fm
Wed, 25 Apr 2007 12:25:38 +0200
changeset 2327 32f68e607e13
parent 2326 82077cd59898
child 2328 90f481d446bc
permissions -rw-r--r--
+ displayString supports color
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 2006 by eXept Software AG
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
     3
              All Rights Reserved
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
"{ Package: 'stx:libview2' }"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
2301
135f21a3d127 refactorred OS-independent stuff
Claus Gittinger <cg@exept.de>
parents: 2299
diff changeset
    14
PrinterContext subclass:#WinPrinterContext
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
    15
        instanceVariableNames:'deviceFonts'
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
    16
        classVariableNames:''
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
    17
        poolDictionaries:''
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
    18
        category:'Interface-Printing'
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
!
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    21
!WinPrinterContext primitiveDefinitions!
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    22
%{
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    23
#undef INT
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    24
#define INT WIN_INT
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    25
#undef Array
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    26
#define Array WIN_Array
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    27
#undef Number
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    28
#define Number WIN_Number
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    29
#undef Method
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    30
#define Method WIN_Method
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    31
#undef Point
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    32
#define Point WIN_Point
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    33
#undef Rectangle
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    34
/* #define Rectangle WIN_Rectangle */
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    35
#undef True
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    36
#define True WIN_True
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    37
#undef False
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    38
#define False WIN_False
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    39
#undef Block
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    40
#define Block WIN_Block
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    41
#undef Context
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    42
#define Context WIN_Context
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    43
#undef Date
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    44
#define Date WIN_Date
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    45
#undef Time
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    46
#define Time WIN_Time
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    47
#undef Delay
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    48
#define Delay WIN_Delay
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    49
#undef Signal
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    50
#define Signal WIN_Signal
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    51
#undef Set
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    52
#define Set WIN_Set
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    53
#undef Process
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    54
#define Process WIN_Process
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    55
#undef Processor
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    56
#define Processor WIN_Processor
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    57
#undef Message
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    58
#define Message WIN_Message
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    59
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    60
#include <stdio.h>
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    61
#include <errno.h>
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    62
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    63
#ifdef __BORLANDC__
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    64
# define NOATOM
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    65
# define NOGDICAPMASKS
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    66
# define NOMETAFILE
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    67
# define NOMINMAX
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    68
# define NOOPENFILE
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    69
# define NOSOUND
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    70
# define NOWH
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    71
# define NOCOMM
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    72
# define NOKANJI
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    73
# define NOCRYPT
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    74
# define NOMCX
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    75
# define WIN32_LEAN_AND_MEAN
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    76
# include <windows.h>
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    77
# include <shellapi.h>
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    78
# include <sys\timeb.h>
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    79
# include <dir.h>
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    80
#else
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    81
# define _USERENTRY /**/
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    82
# define NOATOM
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    83
# define NOGDICAPMASKS
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    84
# define NOMETAFILE
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    85
# define NOMINMAX
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    86
# define NOOPENFILE
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    87
# define NOSOUND
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    88
# define NOWH
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    89
# define NOCOMM
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    90
# define NOKANJI
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    91
# define NOCRYPT
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    92
# define NOMCX
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    93
# define WIN32_LEAN_AND_MEAN
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    94
# include <windows.h>
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    95
# include <sys\timeb.h>
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    96
#endif
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    97
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    98
#include <process.h>
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
    99
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   100
#ifdef __DEF_Array
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   101
# undef Array
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   102
# define Array __DEF_Array
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   103
#endif
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   104
#ifdef __DEF_Number
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   105
# undef Number
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   106
# define Number __DEF_Number
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   107
#endif
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   108
#ifdef __DEF_Method
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   109
# undef Method
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   110
# define Method __DEF_Method
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   111
#endif
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   112
#ifdef __DEF_Point
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   113
# undef Point
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   114
# define Point __DEF_Point
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   115
#endif
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   116
#ifdef __DEF_Rectangle
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   117
# undef Rectangle
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   118
# define Rectangle __DEF_Rectangle
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   119
#else
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   120
# undef Rectangle
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   121
#endif
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   122
#ifdef __DEF_Block
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   123
# undef Block
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   124
# define Block __DEF_Block
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   125
#endif
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   126
#ifdef __DEF_Context
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   127
# undef Context
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   128
# define Context __DEF_Context
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   129
#endif
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   130
#ifdef __DEF_Date
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   131
# undef Date
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   132
# define Date __DEF_Date
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   133
#endif
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   134
#ifdef __DEF_Time
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   135
# undef Time
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   136
# define Time __DEF_Time
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   137
#endif
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   138
# ifdef __DEF_Set
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   139
#  undef Set
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   140
#  define Set __DEF_Set
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   141
# endif
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   142
# ifdef __DEF_Signal
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   143
#  undef Signal
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   144
#  define Signal __DEF_Signal
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   145
# endif
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   146
# ifdef __DEF_Delay
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   147
#  undef Delay
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   148
#  define Delay __DEF_Delay
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   149
# endif
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   150
# ifdef __DEF_Process
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   151
#  undef Process
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   152
#  define Process __DEF_Process
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   153
# endif
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   154
# ifdef __DEF_Processor
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   155
#  undef Processor
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   156
#  define Processor __DEF_Processor
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   157
# endif
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   158
# ifdef __DEF_Message
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   159
#  undef Message
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   160
#  define Message __DEF_Message
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   161
# endif
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   162
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   163
#undef INT
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   164
#define INT int
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   165
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   166
/*
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   167
 * some defines - tired of typing ...
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   168
 */
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   169
#define _HANDLEVal(o)        (HANDLE)(__MKCP(o))
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   170
#define _HBITMAPVAL(o)       (HBITMAP)(__MKCP(o))
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   171
#define _HWNDVal(o)          (HWND)(__MKCP(o))
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   172
#define _HPALETTEVal(o)      (HPALETTE)(__MKCP(o))
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   173
#define _HCURSORVal(o)       (HCURSOR)(__MKCP(o))
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   174
#define _HGDIOBJVal(o)       (HGDIOBJ)(__MKCP(o))
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   175
#define _LOGPALETTEVal(o)    (LOGPALETTE *)(__MKCP(o))
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   176
#define _COLORREFVal(o)      (COLORREF)(__MKCP(o))
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   177
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   178
#define WIDECHAR unsigned short
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   179
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   180
#define WIN32PADDING 32
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   181
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   182
#ifdef DEBUG
2325
634b74929d2d *** empty log message ***
fm
parents: 2324
diff changeset
   183
# define DPRINTF(x)              /* printf  x */
634b74929d2d *** empty log message ***
fm
parents: 2324
diff changeset
   184
# define DFPRINTF(x)             /* fprintf x */
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   185
#else
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   186
# define DPRINTF(x)              /* */
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   187
# define DFPRINTF(x)             /* */
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   188
#endif
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   189
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   190
typedef int (*intf)(int);
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   191
%}
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   192
! !
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   193
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   194
!WinPrinterContext class methodsFor:'documentation'!
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   195
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
copyright
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
 COPYRIGHT (c) 2006 by eXept Software AG
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   199
              All Rights Reserved
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   200
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   201
 This software is furnished under a license and may be used
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
 only in accordance with the terms of that license and with the
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   203
 inclusion of the above copyright notice.   This software may not
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   204
 be provided or otherwise made available to, or used by, any
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   205
 other person.  No title to or ownership of the software is
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   206
 hereby transferred.
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
!
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   209
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   210
documentation
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
"
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   212
    I am the mediator between the smalltalk printing protocol
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   213
    (which is the same as the graphics drawing protocol) and the
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   214
    windows printer.
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   215
    When you open a printer, you will typically talk to me.
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   216
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
    [author:]
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   218
        Felix Madrid (fm@exept.de)
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   219
"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
! !
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   221
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
!WinPrinterContext class methodsFor:'instance creation'!
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
fromPrinterInfo: aPrinterInfo
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   225
    | printerContext printerDevice hDC|
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   227
    hDC := aPrinterInfo createDC.
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   228
    hDC = 0 ifTrue: [ ^self error: 'Error while opening printer.' ].
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   229
2316
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   230
    printerContext := self new.
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   231
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   232
    printerDevice := printerContext.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   233
"/    printerDevice := WinPrinter on: aPrinterInfo.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   234
"/    printerDevice printerDC:hDC.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   235
2316
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   236
    printerContext printerInfo: aPrinterInfo.
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   237
    printerContext setDevice:printerDevice id:nil gcId:hDC.
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   238
    printerContext initExtent.
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   239
    ^printerContext
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   240
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   241
    "Created: / 03-08-2006 / 12:53:52 / fm"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   242
    "Modified: / 04-08-2006 / 12:55:01 / fm"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   243
    "Modified: / 16-04-2007 / 12:36:26 / cg"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   244
! !
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   245
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   246
!WinPrinterContext class methodsFor:'accessing'!
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   247
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   248
getPrinterInformation:printerNameString
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   249
    " Answer the printer information for the printer named printerNameString.  If no name is specified,
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   250
      answer the information for the default printer."
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   251
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   252
    |h|
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   253
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   254
    h := OperatingSystem openPrinter:printerNameString.
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   255
    ^ OperatingSystem
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   256
        getDocumentProperties:nil
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   257
        hPrinter:h
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   258
        pDeviceName:printerNameString.
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   259
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   260
    "Created: / 27-07-2006 / 10:22:32 / fm"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
    "Modified: / 01-08-2006 / 16:01:44 / fm"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   262
    "Modified: / 10-10-2006 / 18:57:45 / cg"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   263
!
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   264
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   265
named: aName
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   266
    "Answer a new instance of Printer which represents
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   267
     the printer named aName as specified in the host
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   268
     Control Panel."
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   269
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   270
    aName isNil ifTrue: [ ^self default ].
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   271
    ^self new printerInfoWithName: aName
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   272
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   273
    "Created: / 27-07-2006 / 17:51:27 / fm"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   274
    "Modified: / 02-08-2006 / 17:26:29 / fm"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   275
    "Modified: / 10-10-2006 / 17:33:29 / cg"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   276
! !
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   277
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   278
!WinPrinterContext class methodsFor:'not supported yet'!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   279
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   280
printAdvancedLines: pairOfPointsArray
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   281
    "Opens a print dialog and prints the given lines"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   282
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   283
    | printerInfo printer |
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   284
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   285
    printerInfo := PrintingDialog getPrinterInfo.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   286
    printerInfo isNil ifTrue:[^self].
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   287
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   288
    printer := self fromPrinterInfo: printerInfo.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   289
    [
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   290
        printer startPrintJob: 'Advanced Lines'.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   291
        printer foreground:Color red background:Color white.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   292
        pairOfPointsArray
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   293
            do:[:pairOfPointsAndContext |
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   294
                 |pairOfPoints|
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   295
                 pairOfPoints := pairOfPointsAndContext at:1.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   296
                 printer
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   297
                    lineWidth: (pairOfPointsAndContext at:2);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   298
                    lineStyle: (pairOfPointsAndContext at:3);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   299
                    capStyle: (pairOfPointsAndContext at:4);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   300
                    joinStyle: (pairOfPointsAndContext at:5);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   301
                    foreground: (pairOfPointsAndContext at:6);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   302
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   303
                    displayAdvanceLineFrom: (pairOfPoints at:1)  to: (pairOfPoints at:2).
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   304
            ].
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   305
        printer endPrintJob.
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   306
    ] forkAt: 3
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   307
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   308
    "
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   309
     WinPrinterContext printAdvancedLines:
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   310
        (Array with: (Array with: (Array with:10@10 with:1000@5000) with: 3 with:#dashed with: #butt with: #miter with: Color green)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   311
               with: (Array with: (Array with:10@10 with:3500@2000) with: 2 with:#solid  with: #butt with: #miter with: Color yellow)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   312
               with: (Array with: (Array with:1000@800 with:6000@5000) with: 8 with:#dashed  with: #butt with: #miter with: Color black)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   313
               with: (Array with: (Array with:2000@2800 with:2000@5000) with: 1 with:#dashed  with: #butt with: #miter with: Color red)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   314
        )
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   315
    "
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   316
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   317
    "Created: / 07-08-2006 / 12:09:48 / fm"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   318
    "Modified: / 07-08-2006 / 14:11:17 / fm"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   319
    "Modified: / 16-04-2007 / 15:37:41 / cg"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   320
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   321
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   322
printImage: anImage
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   323
    "Opens a print dialog and prints the given image"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   324
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   325
    | printerInfo printer |
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   326
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   327
    printerInfo := PrintingDialog getPrinterInfo.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   328
    printerInfo isNil ifTrue:[^self].
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   329
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   330
    printer := self fromPrinterInfo: printerInfo.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   331
    [
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   332
        printer startPrintJob: 'Image'.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   333
        printer background:Color white.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   334
        anImage displayOn:printer x:1000 y:1000.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   335
        printer endPrintJob.
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   336
    ] forkAt: 3
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   337
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   338
    "
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   339
     WinPrinterContext printImage: (Image fromFile:'C:\vsw311\pavheadr.gif').
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   340
     WinPrinterContext printImage: XPToolbarIconLibrary help32x32Icon.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   341
     WinPrinterContext printImage: XPToolbarIconLibrary eraseXP28x28Icon.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   342
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   343
    "
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   344
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   345
    "Created: / 07-08-2006 / 11:46:52 / fm"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   346
    "Modified: / 16-04-2007 / 15:37:34 / cg"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   347
! !
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   348
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   349
!WinPrinterContext class methodsFor:'testing & examples'!
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   350
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   351
fillCircles: arrayOfPointsAndRadiusWithContextArray
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   352
    "Opens a print dialog and prints the given circles"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   353
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   354
    | printerInfo printer |
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   355
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   356
    printerInfo := PrintingDialog getPrinterInfo.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   357
    printerInfo isNil ifTrue:[^self].
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   358
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   359
    printer := self fromPrinterInfo: printerInfo.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   360
    [
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   361
        printer startPrintJob: 'Fill Circles'.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   362
        arrayOfPointsAndRadiusWithContextArray
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   363
            do:[:pointsAndRadiusWithContextArray |
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   364
                printer foreground:(pointsAndRadiusWithContextArray at:3).
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   365
                printer fillCircle:(pointsAndRadiusWithContextArray at:1)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   366
                        radius:(pointsAndRadiusWithContextArray at:2).
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   367
            ].
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   368
        printer endPrintJob.
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   369
    ] forkAt: 3
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   370
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   371
    "
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   372
     WinPrinterContext fillCircles:
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   373
        (Array with: (Array with: 800@800 with: 600 with:Color red)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   374
               with: (Array with: 1500@1500 with: 1000 with:Color blue)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   375
               with: (Array with: 4000@2500 with: 2000 with:Color gray))
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   376
    "
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   377
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   378
    "Created: / 07-08-2006 / 11:46:52 / fm"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   379
    "Modified: / 16-04-2007 / 15:37:34 / cg"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   380
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   381
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   382
fillPolygons: polygonsWithContextArray
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   383
    "Opens a print dialog and prints the given polygons"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   384
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   385
    | printerInfo printer |
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   386
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   387
    printerInfo := PrintingDialog getPrinterInfo.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   388
    printerInfo isNil ifTrue:[^self].
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   389
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   390
    printer := self fromPrinterInfo: printerInfo.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   391
    [
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   392
        printer startPrintJob: 'Fill Polygons'.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   393
        polygonsWithContextArray
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   394
            do:[:polygonWithContextArray |
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   395
                 |aPolygon|
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   396
                 aPolygon := polygonWithContextArray at: 1.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   397
                 printer foreground:(polygonWithContextArray at: 2).
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   398
                 aPolygon displayFilledOn: printer.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   399
            ].
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   400
        printer endPrintJob.
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   401
    ] forkAt: 3
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   402
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   403
    "
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   404
     WinPrinterContext fillPolygons:
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   405
        (Array with: (Array with: (Polygon vertices:(
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   406
                                Array
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   407
                                    with:100@100
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   408
                                    with:600@1000
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   409
                                    with:3500@4000
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   410
                                    with:100@4000
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   411
                                    with:100@100))
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   412
                            with: Color red)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   413
                with: (Array with: (Polygon vertices:(
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   414
                                Array
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   415
                                    with:1000@1000
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   416
                                    with:1000@2000
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   417
                                    with:2000@1000))
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   418
                             with: Color blue)
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   419
    )
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   420
    "
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   421
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   422
    "Created: / 07-08-2006 / 12:09:48 / fm"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   423
    "Modified: / 07-08-2006 / 14:11:17 / fm"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   424
    "Modified: / 16-04-2007 / 15:37:43 / cg"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   425
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   426
2316
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   427
fillRectangles: rectangles
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   428
    "Opens a print dialog and prints the given rectangles"
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   429
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   430
    | printerInfo printer |
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   431
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   432
    printerInfo := PrintingDialog getPrinterInfo.
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   433
    printerInfo isNil ifTrue:[^self].
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   434
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   435
    printer := self fromPrinterInfo: printerInfo.
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   436
    [
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   437
        printer startPrintJob: 'Fill Rectangles'.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   438
        printer foreground:Color blue background:Color white.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   439
        rectangles
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   440
            do:[:rectangle |
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   441
                printer fillRectangleX: rectangle origin x
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   442
                        y: rectangle origin y
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   443
                        width: rectangle width
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   444
                        height: rectangle height.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   445
            ].
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   446
        printer endPrintJob.
2316
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   447
    ] forkAt: 3
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   448
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   449
    "
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   450
     WinPrinterContext fillRectangles:
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   451
        (Array with: (Rectangle left:20 top:20 width:400 height:600)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   452
               with: (Rectangle left:500 top:700 width:600 height:400)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   453
               with: (Rectangle left:800 top:1000 width:1600 height:2000)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   454
               with: (Rectangle left:1040 top:1240 width:3000 height:3000)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   455
        )
2316
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   456
    "
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   457
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   458
    "Created: / 07-08-2006 / 11:40:48 / fm"
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   459
    "Modified: / 16-04-2007 / 15:37:46 / cg"
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   460
!
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   461
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   462
print: aString font: aFont title: aTitle
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   463
    "Open a print dialog to allow printing of the given string
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   464
     using the given title & font."
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   465
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   466
    self print: aString font: aFont title: aTitle wordWrap: false
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   467
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   468
   "
2313
a3fa5abef172 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2304
diff changeset
   469
    WinPrinterContext print: 'Holaaaa!! (from:  WinPrinterContext>>print:aString font:aFont title:aTitle)' font: nil title: 'Printing Test'
2315
026d4d8cfb1b changed #endPrintJob
fm
parents: 2313
diff changeset
   470
    WinPrinterContext print: (WinPrinterContext class sourceCodeAt:#'print:font:title:wordWrap:') font: nil title: 'Printing Test String'
026d4d8cfb1b changed #endPrintJob
fm
parents: 2313
diff changeset
   471
    WinPrinterContext print: (WinPrinterContext class sourceCodeAt:#'print:font:title:wordWrap:') font: (Font family:'Arial' face:'medium' size:8) title: 'Printing Test String'
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   472
   "
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   473
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   474
    "Created: / 27-07-2006 / 17:52:33 / fm"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   475
    "Modified: / 03-08-2006 / 18:52:31 / fm"
2313
a3fa5abef172 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2304
diff changeset
   476
    "Modified: / 16-04-2007 / 13:54:40 / cg"
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   477
!
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   478
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   479
print: aString font: aFont title: aTitle wordWrap: wordWrap
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   480
    "Open a print dialog to allow printing of the given string
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   481
     using the given title & font."
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   482
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   483
    | printerInfo printer |
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   484
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   485
    printerInfo := PrintingDialog getPrinterInfo.
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   486
    printerInfo isNil ifTrue:[^self].
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   487
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   488
    printer := self fromPrinterInfo: printerInfo.
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   489
    [
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   490
        printer
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   491
            print: aString
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   492
            font: aFont
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   493
            title: aTitle
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   494
            wordWrap: wordWrap
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   495
            marginsRect: nil
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   496
    ] forkAt: 3
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   497
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   498
    "
2313
a3fa5abef172 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2304
diff changeset
   499
     WinPrinterContext print: 'Holaaaa!! (from:  PrinterContext>>print:aString font:aFont title:aTitle)' font: nil title: 'Printing Test' wordWrap: true
2315
026d4d8cfb1b changed #endPrintJob
fm
parents: 2313
diff changeset
   500
     WinPrinterContext print: (WinPrinterContext class sourceCodeAt:#'print:font:title:wordWrap:') font:nil title:'Printing Test String' wordWrap:true
026d4d8cfb1b changed #endPrintJob
fm
parents: 2313
diff changeset
   501
     WinPrinterContext print: (WinPrinterContext class sourceCodeAt:#'print:font:title:wordWrap:') font: (Font family:'Arial' face:'medium' size:8) title: 'Printing Test String' wordWrap: true
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   502
    "
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   503
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   504
    "Created: / 03-08-2006 / 18:51:53 / fm"
2313
a3fa5abef172 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2304
diff changeset
   505
    "Modified: / 16-04-2007 / 15:37:31 / cg"
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   506
!
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   507
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   508
printCircles: arrayOfPointsAndRadius
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   509
    "Opens a print dialog and prints the given circles"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   510
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   511
    | printerInfo printer |
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   512
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   513
    printerInfo := PrintingDialog getPrinterInfo.
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   514
    printerInfo isNil ifTrue:[^self].
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   515
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   516
    printer := self fromPrinterInfo: printerInfo.
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   517
    [
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   518
        printer startPrintJob: 'Circles'.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   519
        printer foreground:Color green background:Color white.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   520
        arrayOfPointsAndRadius
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   521
            do:[:pointAndRadius |
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   522
                printer displayCircle:(pointAndRadius at:1)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   523
                        radius:(pointAndRadius at:2).
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   524
            ].
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   525
        printer endPrintJob.
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   526
    ] forkAt: 3
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   527
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   528
    "
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   529
     WinPrinterContext printCircles:
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   530
        (Array with: (Array with: 800@800 with: 600)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   531
               with: (Array with: 1500@1500 with: 1000)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   532
               with: (Array with: 4000@2500 with: 2000))
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   533
    "
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   534
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   535
    "Created: / 07-08-2006 / 11:46:52 / fm"
2313
a3fa5abef172 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2304
diff changeset
   536
    "Modified: / 16-04-2007 / 15:37:34 / cg"
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   537
!
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   538
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   539
printCirclesIn: rectangles
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   540
    "Opens a print dialog and prints the given circles"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   541
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   542
    | printerInfo printer |
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   543
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   544
    printerInfo := PrintingDialog getPrinterInfo.
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   545
    printerInfo isNil ifTrue:[^self].
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   546
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   547
    printer := self fromPrinterInfo: printerInfo.
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   548
    [
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   549
        printer startPrintJob: 'Circles In Rectangles'.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   550
        rectangles
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   551
           do:[:rectangle |
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   552
               printer displayCircleIn: rectangle.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   553
           ].
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   554
       printer endPrintJob.
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   555
    ] forkAt: 3
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   556
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   557
    "
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   558
     WinPrinterContext printCirclesIn:
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   559
        (Array with: (Rectangle left:20 top:20 width:400 height:600)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   560
               with: (Rectangle left:40 top:40 width:600 height:400)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   561
        )
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   562
    "
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   563
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   564
    "Created: / 07-08-2006 / 11:48:46 / fm"
2313
a3fa5abef172 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2304
diff changeset
   565
    "Modified: / 16-04-2007 / 15:37:38 / cg"
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   566
!
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   567
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   568
printLines: pairOfPointsWithContextArray
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   569
    "Opens a print dialog and prints the given lines"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   570
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   571
    | printerInfo printer |
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   572
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   573
    printerInfo := PrintingDialog getPrinterInfo.
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   574
    printerInfo isNil ifTrue:[^self].
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   575
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   576
    printer := self fromPrinterInfo: printerInfo.
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   577
    [
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   578
        printer startPrintJob: 'Lines'.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   579
        pairOfPointsWithContextArray
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   580
            do:[:pairOfPointsAndContext |
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   581
                 |pairOfPoints|
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   582
                 pairOfPoints := pairOfPointsAndContext at: 1.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   583
                 printer
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   584
                    foreground:(pairOfPointsAndContext at:2);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   585
                    lineWidth: (pairOfPointsAndContext at:3);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   586
                    lineStyle: (pairOfPointsAndContext at:4);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   587
                    displayLineFrom: (pairOfPoints at:1)  to: (pairOfPoints at:2).
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   588
            ].
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   589
        printer endPrintJob.
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   590
    ] forkAt: 3
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   591
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   592
    "
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   593
     WinPrinterContext printLines:
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   594
        (Array with: (Array with:(Array with:10@10 with:1000@5000) with: Color red with:4 with: #solid)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   595
               with: (Array with:(Array with:10@10 with:3500@2000) with: Color blue with:1 with: #dashed)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   596
               with: (Array with:(Array with:1000@800 with:6000@5000) with: Color black with: 1 with:#dotted)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   597
               with: (Array with: (Array with:2000@2800 with:2000@5000) with: Color green with:8 with: nil))
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   598
    "
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   599
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   600
    "Created: / 07-08-2006 / 12:09:48 / fm"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   601
    "Modified: / 07-08-2006 / 14:11:17 / fm"
2313
a3fa5abef172 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2304
diff changeset
   602
    "Modified: / 16-04-2007 / 15:37:41 / cg"
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   603
!
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   604
2316
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   605
printPoints: aCollectionOfPoints
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   606
    "Opens a print dialog and prints the given points"
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   607
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   608
    | printerInfo printer |
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   609
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   610
    printerInfo := PrintingDialog getPrinterInfo.
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   611
    printerInfo isNil ifTrue:[^self].
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   612
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   613
    printer := self fromPrinterInfo: printerInfo.
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   614
    [
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   615
        printer startPrintJob: 'Points'.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   616
        aCollectionOfPoints do:[:each |
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   617
            printer displayPointX: each x y: each y.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   618
        ].
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   619
        printer endPrintJob.
2316
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   620
    ] forkAt: 3
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   621
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   622
    "
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   623
     WinPrinterContext printPoints:
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   624
        (Array with: (10 @ 10)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   625
               with: (500 @ 700)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   626
               with: (900 @ 1000)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   627
               with: (1500 @ 1700)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   628
               with: (2100 @ 2000)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   629
               with: (2500 @ 2700)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   630
        )
2316
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   631
    "
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   632
!
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   633
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   634
printPolygons: polygons
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   635
    "Opens a print dialog and prints the given polygons"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   636
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   637
    | printerInfo printer |
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   638
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   639
    printerInfo := PrintingDialog getPrinterInfo.
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   640
    printerInfo isNil ifTrue:[^self].
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   641
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   642
    printer := self fromPrinterInfo: printerInfo.
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   643
    [
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   644
        printer startPrintJob: 'Polygons'.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   645
        printer foreground:Color black background:Color white.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   646
        polygons
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   647
            do:[:aPolygon |
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   648
                 aPolygon displayStrokedOn: printer.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   649
            ].
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   650
        printer endPrintJob.
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   651
    ] forkAt: 3
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   652
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   653
    "
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   654
     WinPrinterContext printPolygons:
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   655
        (Array with: (Polygon vertices:(
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   656
                                Array
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   657
                                    with:100@100
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   658
                                    with:600@1000
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   659
                                    with:3500@4000
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   660
                                    with:100@4000
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   661
                                    with:100@100))
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   662
                with: (Polygon vertices:(
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   663
                                Array
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   664
                                    with:1000@1000
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   665
                                    with:1000@2000
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   666
                                    with:2000@1000)))
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   667
    "
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   668
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   669
    "Created: / 07-08-2006 / 12:09:48 / fm"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   670
    "Modified: / 07-08-2006 / 14:11:17 / fm"
2313
a3fa5abef172 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2304
diff changeset
   671
    "Modified: / 16-04-2007 / 15:37:43 / cg"
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   672
!
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   673
2316
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   674
printPolylines: evenCollectionOfPoints
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   675
    "Opens a print dialog and prints the given rectangles"
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   676
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   677
    | printerInfo printer |
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   678
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   679
    printerInfo := PrintingDialog getPrinterInfo.
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   680
    printerInfo isNil ifTrue:[^self].
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   681
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   682
    printer := self fromPrinterInfo: printerInfo.
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   683
    [
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   684
        printer startPrintJob: 'Polylines'.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   685
        printer displayPolylines:evenCollectionOfPoints.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   686
        printer endPrintJob.
2316
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   687
    ] forkAt: 3
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   688
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   689
    "
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   690
     WinPrinterContext printPolylines:
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   691
        (Array with: (10 @ 10)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   692
               with: (500 @ 700)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   693
               with: (900 @ 1000)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   694
               with: (1500 @ 1700)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   695
               with: (2100 @ 2000)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   696
               with: (2500 @ 2700)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   697
        )
2316
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   698
    "
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   699
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   700
    "Created: / 07-08-2006 / 11:40:48 / fm"
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   701
    "Modified: / 16-04-2007 / 15:37:46 / cg"
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   702
!
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
   703
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   704
printRectangles: rectanglesWithContextArray
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   705
    "Opens a print dialog and prints the given rectangles"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   706
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   707
    | printerInfo printer |
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   708
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   709
    printerInfo := PrintingDialog getPrinterInfo.
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   710
    printerInfo isNil ifTrue:[^self].
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   711
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   712
    printer := self fromPrinterInfo: printerInfo.
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   713
    [
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   714
        printer startPrintJob: 'Rectangles'.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   715
        printer foreground:Color red background:Color white.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   716
        rectanglesWithContextArray do:[:rectangleWithContextArray |
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   717
            |rectangle|
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   718
            rectangle := rectangleWithContextArray at: 1.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   719
            printer
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   720
                foreground:(rectangleWithContextArray at:2);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   721
                lineWidth: (rectangleWithContextArray at:3);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   722
                lineStyle: (rectangleWithContextArray at:4);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   723
                displayRectangleX: rectangle origin x
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   724
                        y: rectangle origin y
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   725
                        width: rectangle width
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   726
                        height: rectangle height.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   727
            ].
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   728
        printer endPrintJob.
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   729
    ] forkAt: 3
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   730
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   731
    "
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   732
     WinPrinterContext printRectangles:
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   733
        (Array with: (Array with: (Rectangle left:30 top:10 width:400 height:600) with: Color red with:4 with: #solid)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   734
               with: (Array with: (Rectangle left:100 top:140 width:700 height:800) with: Color blue with:1 with: #dashed)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   735
               with: (Array with: (Rectangle left:800 top:1500 width:2600 height:3400) with: Color green with:1 with: #dotted)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   736
               with: (Array with: (Rectangle left:1000 top:1200 width:1400 height:1600) with: Color gray with:8 with: #dashed)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   737
               with: (Array with: (Rectangle left:2600 top:1200 width:1400 height:1600) with: Color darkGray with:1 with: #dashDotDot)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   738
        )
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   739
    "
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   740
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   741
    "Created: / 07-08-2006 / 11:40:48 / fm"
2313
a3fa5abef172 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2304
diff changeset
   742
    "Modified: / 16-04-2007 / 15:37:46 / cg"
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   743
!
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   744
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   745
printStrings: stringAndPositionsArray
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   746
    "Opens a print dialog and prints the given strings"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   747
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   748
    | printerInfo printer |
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   749
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   750
    printerInfo := PrintingDialog getPrinterInfo.
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   751
    printerInfo isNil ifTrue:[^self].
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   752
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   753
    printer := self fromPrinterInfo: printerInfo.
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   754
    [
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   755
        printer startPrintJob: 'Strings with Position'.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   756
        printer foreground:Color black background:Color white.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   757
        stringAndPositionsArray
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   758
            do:[:pairOfPointsAndPosition |
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   759
                 printer displayString:(pairOfPointsAndPosition at: 1)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   760
                            x:(pairOfPointsAndPosition at: 2) x
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   761
                            y:(pairOfPointsAndPosition at: 2) y
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   762
            ].
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   763
        printer endPrintJob.
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   764
    ] forkAt: 3
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   765
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   766
    "
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   767
     WinPrinterContext printStrings:
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   768
        (Array with: (Array with:'Testing printing with standart method' with:10@10)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   769
               with: (Array with:'Another test string to print' with:80@200))
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   770
    "
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   771
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   772
    "Created: / 07-08-2006 / 12:09:48 / fm"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   773
    "Modified: / 07-08-2006 / 14:11:17 / fm"
2313
a3fa5abef172 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2304
diff changeset
   774
    "Modified: / 16-04-2007 / 15:37:49 / cg"
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   775
! !
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   776
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   777
!WinPrinterContext methodsFor:'accessing'!
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   778
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   779
depth
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   780
    ^ 24
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   781
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   782
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   783
deviceColors
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   784
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   785
    ^#()
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   786
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   787
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   788
deviceFonts
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   789
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   790
    deviceFonts isNil ifTrue:[deviceFonts := CachingRegistry new cacheSize:10.].
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   791
    ^deviceFonts
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   792
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   793
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   794
getCharHeight
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   795
    "Private - answer the height of the font selected in the receiver's
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   796
     device context."
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   797
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   798
    |textMetrics answer|
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   799
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   800
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   801
    textMetrics := Win32OperatingSystem::TextMetricsStructure new.
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   802
"/    (OperatingSystem getTextMetrics:gcId lpMetrics:textMetrics) ifFalse:[ ^ self error ].
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   803
"/    Transcript showCR: 'CHAR HEIGHT PRIM ******* ', '   ',  (textMetrics tmHeight + textMetrics tmExternalLeading) printString.
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   804
"/    Transcript showCR: 'CHAR HEIGHT DEVICE ***** ', '   ', (self font heightOf:'PQWEXCZ' on:self device) printString.
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   805
    answer := (self font heightOf:'PQWEXCZ' on:self device).
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   806
"/    answer := textMetrics tmHeight + textMetrics tmExternalLeading.
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
   807
    ^answer
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   808
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   809
    "Created: / 02-08-2006 / 17:47:20 / fm"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   810
    "Modified: / 03-08-2006 / 10:09:01 / fm"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   811
    "Modified: / 10-10-2006 / 18:15:17 / cg"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   812
!
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   813
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   814
getLogicalPixelSizeX
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   815
    ^ printerInfo printQuality ? 600
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   816
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   817
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   818
getLogicalPixelSizeY
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   819
    ^ printerInfo printQuality ? 600
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   820
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   821
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   822
numberOfColorBitsPerPixel
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   823
    ^ OperatingSystem getDeviceCaps:gcId index:12 "Bitspixel"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   824
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   825
    "Created: / 03-08-2006 / 09:58:18 / fm"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   826
    "Modified: / 10-10-2006 / 18:15:40 / cg"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   827
!
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   828
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   829
physicalOffsetX
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   830
    ^ OperatingSystem getDeviceCaps:gcId index:112 "PhysicalOffsetX"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   831
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   832
    "Created: / 01-08-2006 / 16:28:34 / fm"
2301
135f21a3d127 refactorred OS-independent stuff
Claus Gittinger <cg@exept.de>
parents: 2299
diff changeset
   833
    "Modified: / 16-04-2007 / 12:52:06 / cg"
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   834
!
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   835
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   836
physicalOffsetY
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   837
    ^ OperatingSystem getDeviceCaps:gcId index:113 "PhysicalOffsetY"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   838
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   839
    "Created: / 01-08-2006 / 16:28:34 / fm"
2301
135f21a3d127 refactorred OS-independent stuff
Claus Gittinger <cg@exept.de>
parents: 2299
diff changeset
   840
    "Modified: / 16-04-2007 / 12:52:01 / cg"
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   841
!
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   842
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   843
pixelsPerInchOfScreenHeight
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   844
    ^ OperatingSystem getDeviceCaps:gcId index:90 "Logpixelsy"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   845
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   846
    "Created: / 01-08-2006 / 16:29:16 / fm"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   847
!
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   848
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   849
pixelsPerInchOfScreenWidth
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   850
    ^ OperatingSystem getDeviceCaps:gcId index:88 "Logpixelsx"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   851
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   852
    "Created: / 01-08-2006 / 16:28:34 / fm"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   853
!
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   854
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   855
printerHeightArea
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   856
    ^ (OperatingSystem getDeviceCaps:gcId index:10)
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   857
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   858
    "Modified: / 10-10-2006 / 18:18:31 / cg"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   859
!
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   860
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   861
printerPhysicalHeight
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   862
    ^ OperatingSystem getDeviceCaps:gcId "deviceContext" index:111 "PhysicalHeight"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   863
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   864
    "Created: / 01-08-2006 / 16:14:08 / fm"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   865
!
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   866
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   867
printerPhysicalWidth
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   868
    ^ OperatingSystem getDeviceCaps:gcId "deviceContext" index:110 "PhysicalWidth"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   869
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   870
    "Created: / 01-08-2006 / 16:14:08 / fm"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   871
!
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   872
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   873
printerWidthArea
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   874
    ^ OperatingSystem getDeviceCaps:gcId "deviceContext" index:8 "Horzres"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   875
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   876
    "Created: / 01-08-2006 / 16:14:08 / fm"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   877
!
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   878
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   879
supportedImageFormats
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   880
    "return an array with supported image formats; each array entry
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   881
     is another array, consisting of depth and bitsPerPixel values."
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   882
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   883
    |info|
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   884
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   885
    info := IdentityDictionary new.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   886
    info at:#depth put:self depth.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   887
    info at:#bitsPerPixel put:self depth.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   888
    info at:#padding put:32.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   889
    ^ Array with:info
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   890
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   891
    "
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   892
     Disply supportedImageFormats
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   893
    "
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   894
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   895
    "Modified: / 10.9.1998 / 23:14:05 / cg"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   896
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   897
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   898
visualType
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   899
    ^ #TrueColor
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   900
! !
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   901
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   902
!WinPrinterContext methodsFor:'color stuff'!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   903
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   904
colorScaledRed:r scaledGreen:g scaledBlue:b
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   905
    "allocate a color with rgb values (0..16rFFFF) - return the color index
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   906
     (i.e. colorID)"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   907
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   908
%{  /* NOCONTEXT */
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   909
    int id, ir, ig, ib;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   910
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   911
    if (__bothSmallInteger(r, g) && __isSmallInteger(b)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   912
        ir = (__intVal(r) >> 8) & 0xff;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   913
        ig = (__intVal(g) >> 8) & 0xff;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   914
        ib = (__intVal(b) >> 8) & 0xff;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   915
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   916
        id = RGB( ir, ig, ib);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   917
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   918
        RETURN ( __MKSMALLINT(id) );
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   919
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   920
%}.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   921
    self primitiveFailed.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   922
    ^ nil
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   923
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   924
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   925
setBackground:bgColorIndex in:aDC
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   926
    "set background color to be drawn with"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   927
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   928
%{  /* NOCONTEXT */
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   929
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   930
    HDC hDC;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   931
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   932
    if (__isExternalAddressLike(aDC)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   933
        HANDLE hDC = (HANDLE)(__externalAddressVal(aDC));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   934
        COLORREF bg, oldBg;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   935
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   936
        oldBg = GetBkColor(hDC);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   937
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   938
        bg = __intVal(bgColorIndex) & 0xffffff;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   939
/*        bg = (COLORREF)st2RGB(__intVal(bgColorIndex),gcData);         */
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   940
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   941
        if (bg != oldBg) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   942
            SetBkColor(hDC, bg);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   943
        }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   944
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   945
        RETURN (self);
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   946
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   947
%}
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   948
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   949
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   950
setBackgroundColor:color in:aGCId
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   951
    "set background color to be drawn with"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   952
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   953
    |colorId deviceColor|
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   954
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   955
    (color isOnDevice:self) ifTrue:[
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   956
        colorId := color colorId.
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   957
    ] ifFalse:[
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   958
        deviceColor := color onDevice:self.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   959
        deviceColor notNil ifTrue:[
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   960
            colorId := deviceColor colorId.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   961
        ]
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   962
    ].
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   963
    colorId isNil ifTrue:[
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   964
        'DeviceWorkstation [warning]: could not set bg color' infoPrintCR.
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   965
    ] ifFalse:[
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   966
        self setBackground:colorId in:aGCId.
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   967
    ]
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   968
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   969
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   970
setForeground:fgColorIndex background:bgColorIndex in:aDC
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   971
    "set foreground and background colors to be drawn with"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   972
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   973
%{  /* NOCONTEXT */
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   974
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   975
    if (__isExternalAddressLike(aDC)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   976
        HANDLE hDC = (HANDLE)(__externalAddressVal(aDC));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   977
        COLORREF fg, bg, oldFg, oldBg;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   978
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   979
/*        fg = (COLORREF)st2RGB(__intVal(fgColorIndex),gcData);    */
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   980
        fg = __intVal(fgColorIndex) & 0xffffff;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   981
/*        bg = (COLORREF)st2RGB(__intVal(bgColorIndex),gcData);    */
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   982
        bg = __intVal(bgColorIndex) & 0xffffff;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   983
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   984
        oldFg = GetTextColor(hDC);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   985
        oldBg = GetBkColor(hDC);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   986
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   987
        if ((fg != oldFg) || (bg != oldBg)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   988
            /* Pen only depends upon fg-color */
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   989
            if (fg != oldFg) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   990
                SetTextColor(hDC, fg);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   991
            }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   992
            if (bg != oldBg) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   993
                SetBkColor(hDC, bg);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   994
            }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   995
        }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
   996
        RETURN (self);
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   997
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   998
%}
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
   999
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1000
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1001
setForeground:fgColorIndex in:aDC
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1002
    "set foreground color to be drawn with"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1003
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1004
%{  /* NOCONTEXT */
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1005
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1006
    HDC hDC;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1007
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1008
    if (__isExternalAddressLike(aDC)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1009
        HANDLE hDC = (HANDLE)(__externalAddressVal(aDC));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1010
        COLORREF fg, oldFg;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1011
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1012
        oldFg = GetTextColor(hDC);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1013
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1014
        fg = __intVal(fgColorIndex) & 0xffffff;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1015
/*        fg = (COLORREF)st2RGB(__intVal(fgColorIndex),gcData);         */
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1016
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1017
        if (fg != oldFg) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1018
            SetTextColor(hDC, fg);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1019
        }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1020
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1021
        RETURN (self);
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1022
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1023
%}
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1024
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1025
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1026
setForegroundColor:color in:aGCId
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1027
    "set the foreground color to be drawn with"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1028
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1029
    |colorId deviceColor|
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1030
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1031
    (color isOnDevice:self) ifTrue:[
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1032
        colorId := color colorId.
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1033
    ] ifFalse:[
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1034
        deviceColor := color onDevice:self.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1035
        deviceColor notNil ifTrue:[
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1036
            colorId := deviceColor colorId.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1037
        ]
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1038
    ].
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1039
    colorId isNil ifTrue:[
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1040
        'DeviceWorkstation [warning]: could not set fg color' infoPrintCR.
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1041
    ] ifFalse:[
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1042
        self setForeground:colorId in:aGCId.
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1043
    ]
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1044
! !
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1045
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1046
!WinPrinterContext methodsFor:'context stuff'!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1047
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1048
getPenFor:aDC
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1049
    "set line attributes"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1050
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1051
%{  /* NOCONTEXT */
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1052
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1053
    if (__isExternalAddressLike(aDC)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1054
     && __isSmallInteger(__INST(lineWidth))) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1055
        HANDLE hDC = (HANDLE)(__externalAddressVal(aDC));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1056
        COLORREF fgColor;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1057
        HANDLE hPen, prevPen;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1058
        int lineStyleInt, capStyleInt, joinStyleInt, lineWidth;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1059
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1060
        lineWidth= __INST(lineWidth);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1061
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1062
        if (__INST(lineStyle) == @symbol(solid)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1063
            lineStyleInt= PS_SOLID;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1064
        } else if (__INST(lineStyle) == @symbol(dashed)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1065
            lineStyleInt= PS_DASH;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1066
        } else if (__INST(lineStyle) == @symbol(dotted)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1067
            lineStyleInt= PS_DOT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1068
        } else if (__INST(lineStyle) == @symbol(dashDot)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1069
            lineStyleInt= PS_DASHDOT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1070
        } else if (__INST(lineStyle) == @symbol(dashDotDot)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1071
            lineStyleInt= PS_DASHDOTDOT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1072
        } else
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1073
            lineStyleInt= PS_SOLID;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1074
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1075
        if (__INST(capStyle) == @symbol(round)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1076
            capStyleInt= PS_ENDCAP_ROUND;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1077
        } else if (__INST(capStyle) == @symbol(square)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1078
            capStyleInt= PS_ENDCAP_SQUARE;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1079
        } else if (__INST(capStyle) == @symbol(flat)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1080
            capStyleInt= PS_ENDCAP_FLAT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1081
        } else
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1082
            capStyleInt= PS_ENDCAP_FLAT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1083
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1084
        if (__INST(joinStyle) == @symbol(bevel)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1085
            joinStyleInt= PS_JOIN_BEVEL;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1086
        } else if (__INST(joinStyle) == @symbol(miter)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1087
            joinStyleInt= PS_JOIN_MITER;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1088
        } else if (__INST(joinStyle) == @symbol(round)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1089
            joinStyleInt= PS_JOIN_ROUND;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1090
        } else
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1091
            joinStyleInt= PS_JOIN_MITER;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1092
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1093
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1094
        fgColor = GetTextColor(hDC);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1095
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1096
        hPen = CreatePen(lineStyleInt | capStyleInt | joinStyleInt, lineWidth, fgColor);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1097
        prevPen = SelectObject(hDC, hPen);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1098
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1099
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1100
        RETURN (self);
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1101
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1102
%}.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1103
    self primitiveFailed
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1104
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1105
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1106
getPenForContext
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1107
    "set line attributes"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1108
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1109
%{  /* NOCONTEXT */
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1110
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1111
    if (__isExternalAddressLike(__INST(gcId))
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1112
     && __isSmallInteger(__INST(lineWidth))) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1113
        HANDLE hDC = (HANDLE)(__externalAddressVal(__INST(gcId)));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1114
        COLORREF fgColor;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1115
        HANDLE hPen;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1116
        int lineStyleInt, capStyleInt, joinStyleInt, lineWidth;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1117
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1118
        lineWidth= __INST(lineWidth);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1119
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1120
        if (__INST(lineStyle) == @symbol(solid)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1121
            lineStyleInt= PS_SOLID;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1122
        } else if (__INST(lineStyle) == @symbol(dashed)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1123
            lineStyleInt= PS_DASH;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1124
        } else if (__INST(lineStyle) == @symbol(dotted)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1125
            lineStyleInt= PS_DOT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1126
        } else if (__INST(lineStyle) == @symbol(dashDot)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1127
            lineStyleInt= PS_DASHDOT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1128
        } else if (__INST(lineStyle) == @symbol(dashDotDot)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1129
            lineStyleInt= PS_DASHDOTDOT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1130
        } else
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1131
            lineStyleInt= PS_SOLID;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1132
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1133
        if (__INST(capStyle) == @symbol(round)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1134
            capStyleInt= PS_ENDCAP_ROUND;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1135
        } else if (__INST(capStyle) == @symbol(square)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1136
            capStyleInt= PS_ENDCAP_SQUARE;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1137
        } else if (__INST(capStyle) == @symbol(flat)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1138
            capStyleInt= PS_ENDCAP_FLAT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1139
        } else
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1140
            capStyleInt= PS_ENDCAP_FLAT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1141
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1142
        if (__INST(joinStyle) == @symbol(bevel)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1143
            joinStyleInt= PS_JOIN_BEVEL;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1144
        } else if (__INST(joinStyle) == @symbol(miter)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1145
            joinStyleInt= PS_JOIN_MITER;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1146
        } else if (__INST(joinStyle) == @symbol(round)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1147
            joinStyleInt= PS_JOIN_ROUND;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1148
        } else
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1149
            joinStyleInt= PS_JOIN_MITER;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1150
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1151
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1152
        fgColor = GetTextColor(hDC);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1153
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1154
        hPen = CreatePen(lineStyleInt | capStyleInt | joinStyleInt, lineWidth, fgColor);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1155
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1156
        RETURN (self);
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1157
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1158
%}.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1159
    self primitiveFailed
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1160
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1161
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1162
noClipIn:aWindowId gc:aDC
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1163
    "disable clipping rectangle"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1164
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1165
%{  /* NOCONTEXT */
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1166
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1167
    if (__isExternalAddressLike(aDC)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1168
        HANDLE hDC = (HANDLE)(__externalAddressVal(aDC));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1169
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1170
        SelectClipRgn(hDC, NULL);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1171
        RETURN (self);
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1172
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1173
%}
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1174
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1175
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1176
setBitmapMask:aBitmapId in:aDC
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1177
    "set or clear the drawing mask - a bitmap mask using current fg/bg"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1178
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1179
%{  /* NOCONTEXT */
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1180
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1181
    if (__isExternalAddressLike(aDC)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1182
        HANDLE hDC = (HANDLE)(__externalAddressVal(aDC));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1183
        HBITMAP oldM;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1184
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1185
/*        oldM = gcData->hMask;
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1186
        if (__isExternalAddress(aBitmapId))
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1187
            gcData->hMask = _HBITMAPVAL(aBitmapId);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1188
        else
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1189
            gcData->hMask = 0;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1190
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1191
        if (oldM != gcData->hMask) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1192
          FLUSH_CACHED_DC(gcData);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1193
            CPRINTF(("masks set to %x\n",gcData->hMask));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1194
        }                                                     */
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1195
        RETURN (self);
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1196
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1197
%}
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1198
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1199
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1200
setClipX:clipX y:clipY width:clipWidth height:clipHeight in:ignoredDrawableId gc:aDC
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1201
    "clip to a rectangle"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1202
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1203
"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1204
      p--w---
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1205
      |     |
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1206
      h     |  the clipping rectangle
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1207
      |     |
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1208
      -------
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1209
          where p = ( clipX, clipY ), w = clipWidth, h = clipHeight
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1210
"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1211
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1212
%{  /* NOCONTEXT */
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1213
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1214
    if (__isExternalAddressLike(aDC)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1215
     && __bothSmallInteger(clipX, clipY)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1216
     && __bothSmallInteger(clipWidth, clipHeight) ) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1217
        HANDLE hDC;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1218
        int cX, cY, cW, cH;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1219
        POINT ptOrg;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1220
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1221
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1222
        hDC = (HANDLE)(__externalAddressVal(aDC));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1223
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1224
        GetViewportOrgEx(hDC,&ptOrg);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1225
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1226
        // set the clip rectangle
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1227
        // and offset the rectangle by the viewport origin
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1228
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1229
        cX = __intVal(clipX) + ptOrg.x;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1230
        cY = __intVal(clipY) + ptOrg.y;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1231
        cW = __intVal(clipWidth)+ ptOrg.x;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1232
        cH = __intVal(clipHeight)+ ptOrg.y;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1233
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1234
        {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1235
            HRGN region = CreateRectRgn(cX, cY, cX + cW, cY + cH);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1236
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1237
            if (region == NULL ) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1238
                console_fprintf(stderr, "WinWorkstat [warning]: clipping region creation failed\n");
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1239
            } else {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1240
                if (SelectClipRgn(hDC, region) == ERROR ) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1241
                    console_fprintf(stderr, "WinWorkstat [warning]: select clipping region failed\n");
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1242
                }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1243
                DeleteObject(region);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1244
            }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1245
        }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1246
        RETURN (self);
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1247
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1248
%}.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1249
    self primitiveFailed
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1250
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1251
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1252
setDashes:dashList dashOffset:offset in:aGCId
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1253
    "set line attributes"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1254
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1255
%{  /* NOCONTEXT */
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1256
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1257
    if (__isExternalAddressLike(aGCId)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1258
        DPRINTF(("WinWorkstat [warning]: dashes not (yet) implemented\n"));
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1259
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1260
%}
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1261
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1262
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1263
setLineWidth:aNumber style:lineStyle cap:capStyle join:joinStyle in:aDC
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1264
    "set line attributes"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1265
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1266
%{  /* NOCONTEXT */
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1267
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1268
    HDC hDC;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1269
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1270
    if (__isExternalAddressLike(aDC)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1271
     && __isSmallInteger(aNumber)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1272
        HANDLE hDC = (HANDLE)(__externalAddressVal(aDC));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1273
        int style;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1274
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1275
        if (lineStyle == @symbol(solid)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1276
            style = PS_SOLID;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1277
        } else if (lineStyle == @symbol(dashed)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1278
            style= PS_DASH;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1279
        } else if (lineStyle == @symbol(dotted)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1280
            style= PS_DOT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1281
        } else if (lineStyle == @symbol(dashDot)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1282
            style= PS_DASHDOT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1283
        } else if (lineStyle == @symbol(dashDotDot)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1284
            style= PS_DASHDOTDOT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1285
        } else
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1286
            style= PS_SOLID;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1287
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1288
        if (capStyle == @symbol(round)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1289
            style = PS_ENDCAP_ROUND;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1290
        } else if (capStyle == @symbol(square)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1291
            style = PS_ENDCAP_SQUARE;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1292
        } else if (capStyle == @symbol(flat)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1293
            style = PS_ENDCAP_FLAT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1294
        } else
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1295
            style = PS_ENDCAP_FLAT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1296
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1297
        if (joinStyle == @symbol(bevel)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1298
            style = PS_JOIN_BEVEL;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1299
        } else if (joinStyle == @symbol(miter)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1300
            style = PS_JOIN_MITER;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1301
        } else if (joinStyle == @symbol(round)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1302
            style = PS_JOIN_ROUND;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1303
        } else
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1304
            style = PS_JOIN_MITER;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1305
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1306
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1307
        RETURN (self);
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1308
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1309
%}.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1310
    self primitiveFailed
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1311
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1312
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1313
setMaskOriginX:orgX y:orgY in:aDC
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1314
    "set the mask origin"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1315
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1316
%{  /* NOCONTEXT */
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1317
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1318
    if (__isExternalAddress(aDC)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1319
     && __bothSmallInteger(orgX,orgY)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1320
        HANDLE hDC = (HANDLE)(__externalAddressVal(aDC));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1321
        int oX, oY, maskOrgX, maskOrgY;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1322
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1323
        oX = __intVal(orgX);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1324
        oY = __intVal(orgY);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1325
        if ((oX != maskOrgX)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1326
         || (oY != maskOrgY)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1327
            maskOrgX = __intVal(orgX);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1328
            maskOrgY = __intVal(orgY);;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1329
        }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1330
        RETURN (self);
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1331
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1332
%}
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1333
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1334
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1335
setViewportOrg: aPoint
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1336
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1337
    "Sets the viewport origin (LOGICAL point (0,0)) of the device context"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1338
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
  1339
    ^ OperatingSystem
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1340
            setViewportOrg: gcId "deviceContext"
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1341
            x: aPoint x
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1342
            y: aPoint y
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1343
            oldOrigin: nil
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1344
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1345
    "Created: / 01-08-2006 / 16:14:08 / fm"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1346
! !
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1347
2316
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
  1348
!WinPrinterContext methodsFor:'drawing'!
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
  1349
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1350
displayArcX:x y:y width:width height:height from:startAngle angle:angle in:ignoredDrawableId with:aDC
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1351
    "draw an arc. If any of x,y, w or h is not an integer, an error is triggered.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1352
     The angles may be floats or integer - they are given in degrees."
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1353
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1354
%{
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1355
    int __x, __y, w, h;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1356
    float angle1, angle2;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1357
    double f;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1358
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1359
    if (__isSmallInteger(startAngle))
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1360
        angle1 = (float)(__intVal(startAngle));
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1361
    else if (__isFloat(startAngle)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1362
        angle1 = (float) __floatVal(startAngle);
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1363
    } else if (__isShortFloat(startAngle)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1364
        angle1 = __shortFloatVal(startAngle);
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1365
    } else goto bad;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1366
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1367
    if (__isSmallInteger(angle))
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1368
        angle2 = (float)(__intVal(angle));
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1369
    else if (__isFloat(angle)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1370
        angle2 = (float) __floatVal(angle);
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1371
    } else if (__isShortFloat(angle)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1372
        angle2 = __shortFloatVal(angle);
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1373
    } else goto bad;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1374
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1375
    if (angle2 <= 0) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1376
        RETURN (self);
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1377
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1378
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1379
    if (__isExternalAddressLike(aDC)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1380
     && __bothSmallInteger(x, y)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1381
     && __bothSmallInteger(width, height))
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1382
     {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1383
        POINT p;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1384
        HANDLE hDC = (HANDLE)(__externalAddressVal(aDC));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1385
        DWORD clr = 0 /* 0xFFFFFFFF */;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1386
        HANDLE prevPen, hPen;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1387
        double xB, yB, xE, yE, xR, yR;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1388
        COLORREF fgColor;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1389
        int lStyleSymbol, lStyleInt;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1390
        int lw;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1391
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1392
        lw= __intVal(__INST(lineWidth));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1393
        lStyleSymbol= __INST(lineStyle);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1394
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1395
        /*  PS_DASH, PS_DOT, PS_DASHDOT, PS_DASHDOTDOT
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1396
            only works with lineWidth = 1  */
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1397
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1398
        if (lStyleSymbol == @symbol(solid)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1399
            lStyleInt= PS_SOLID;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1400
        } else if (lStyleSymbol == @symbol(dashed)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1401
            lStyleInt= PS_DASH;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1402
        } else if (lStyleSymbol == @symbol(dotted)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1403
            lStyleInt= PS_DOT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1404
        } else if (lStyleSymbol == @symbol(dashDot)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1405
            lStyleInt= PS_DASHDOT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1406
        } else if (lStyleSymbol == @symbol(dashDotDot)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1407
            lStyleInt= PS_DASHDOTDOT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1408
        } else if (lStyleSymbol == @symbol(insideFrame)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1409
            lStyleInt= PS_INSIDEFRAME;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1410
        } else
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1411
            lStyleInt= PS_SOLID;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1412
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1413
        fgColor = GetTextColor(hDC);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1414
        hPen = CreatePen(lStyleInt, lw, fgColor);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1415
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1416
        w = __intVal(width);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1417
        h = __intVal(height);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1418
        __x = __intVal(x);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1419
        __y = __intVal(y);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1420
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1421
            xR = w / 2;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1422
            yR = h / 2;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1423
            if (angle2 - angle1 >= 360) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1424
                xB = xE = __x + xR + 0.5;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1425
                yB = yE = __y /*+ yR + 0.5*/;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1426
            } else {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1427
                double sin(), cos();
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1428
                float rad1, rad2;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1429
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1430
                if (angle1 <= 180)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1431
                  angle1 = 180 - angle1;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1432
                else
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1433
                  angle1 = 360 + 180 - angle1;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1434
                angle2 = angle1 - angle2;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1435
                /* sigh - compute the intersections ... */
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1436
                rad1 = (angle1 * 3.14159265359) / 180.0;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1437
                rad2 = (angle2 * 3.14159265359) / 180.0;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1438
                xB = cos(rad1) * xR;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1439
                yB = sin(rad1) * yR;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1440
                xE = cos(rad2) * xR;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1441
                yE = sin(rad2) * yR;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1442
                xB = __x + xR - xB + 0.5;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1443
                yB = __y + yR - yB + 0.5;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1444
                xE = __x + xR - xE + 0.5;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1445
                yE = __y + yR - yE + 0.5;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1446
            }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1447
            prevPen = SelectObject(hDC, hPen);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1448
            DPRINTF(("Arc x=%d y=%d w=%d h=%d xB=%d xE=%d yB=%d yE=%d a1=%f a2=%f\n",__x,__y,w,h,(int)xB,(int)xE,(int)yB,(int)yE,angle1,angle2));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1449
            Arc(hDC,
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1450
                __x, __y,
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1451
                __x + w, __y + h,
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1452
                (int)xB, (int)yB,
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1453
                (int)xE, (int)yE);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1454
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1455
            SelectObject(hDC, prevPen);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1456
            DeleteObject(hPen);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1457
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1458
        RETURN ( self );
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1459
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1460
    bad: ;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1461
%}.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1462
    self primitiveFailed
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1463
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1464
    "Created: / 07-08-2006 / 10:40:27 / fm"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1465
    "Modified: / 07-08-2006 / 14:44:21 / fm"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1466
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1467
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1468
displayLineFromX:x0 y:y0 toX:x1 y:y1 in:ignoredDrawableId with:aDC
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1469
    "draw a line. If the coordinates are not integers, an error is triggered."
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1470
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1471
%{  /* NOCONTEXT */
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1472
    if (__isExternalAddressLike(aDC)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1473
     && __bothSmallInteger(x0, y0)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1474
     && __bothSmallInteger(x1, y1)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1475
        HANDLE hDC = (HANDLE)(__externalAddressVal(aDC));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1476
        COLORREF fgColor;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1477
        HANDLE prevPen, hPen;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1478
        int __x1 = __intVal(x1), __y1 = __intVal(y1);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1479
        int lStyleSymbol, lStyleInt;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1480
        int lw;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1481
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1482
/*      DPRINTF(("displayLine: %d/%d -> %d/%d\n",
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1483
                    __intVal(x0), __intVal(y0),
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1484
                    __x1, __y1));
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1485
*/
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1486
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1487
        lw= __intVal(__INST(lineWidth));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1488
        lStyleSymbol= __INST(lineStyle);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1489
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1490
        /*  PS_DASH, PS_DOT, PS_DASHDOT, PS_DASHDOTDOT
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1491
            only works with lineWidth = 1  */
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1492
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1493
        if (lStyleSymbol == @symbol(solid)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1494
            lStyleInt= PS_SOLID;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1495
        } else if (lStyleSymbol == @symbol(dashed)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1496
            lStyleInt= PS_DASH;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1497
        } else if (lStyleSymbol == @symbol(dotted)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1498
            lStyleInt= PS_DOT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1499
        } else if (lStyleSymbol == @symbol(dashDot)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1500
            lStyleInt= PS_DASHDOT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1501
        } else if (lStyleSymbol == @symbol(dashDotDot)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1502
            lStyleInt= PS_DASHDOTDOT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1503
        } else if (lStyleSymbol == @symbol(insideFrame)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1504
            lStyleInt= PS_INSIDEFRAME;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1505
        } else
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1506
            lStyleInt= PS_SOLID;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1507
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1508
        fgColor = GetTextColor(hDC);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1509
        hPen = CreatePen(lStyleInt, lw, fgColor);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1510
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1511
        prevPen = SelectObject(hDC, hPen);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1512
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1513
        MoveToEx(hDC, __intVal(x0), __intVal(y0), NULL);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1514
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1515
        LineTo(hDC, __x1, __y1);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1516
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1517
        /*
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1518
         * end-point ...
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1519
         */
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1520
        LineTo(hDC, __x1+1, __y1);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1521
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1522
        SelectObject(hDC, prevPen);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1523
        DeleteObject(hPen);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1524
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1525
        RETURN ( self );
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1526
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1527
%}
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1528
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1529
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1530
displayPointX:px y:py in:ignoredDrawableId with:aDC
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1531
    "draw a point. If x/y are not integers, an error is triggered."
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1532
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1533
%{  /* NOCONTEXT */
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1534
    if (__isExternalAddressLike(aDC)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1535
     && __bothSmallInteger(px, py)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1536
        HANDLE hDC = (HANDLE)(__externalAddressVal(aDC));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1537
        POINT p;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1538
        COLORREF fgColor;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1539
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1540
        int __x = __intVal(px), __y = __intVal(py);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1541
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1542
        fgColor = GetTextColor(hDC);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1543
        SetPixelV(hDC, __x, __y, fgColor);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1544
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1545
        RETURN ( self );
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1546
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1547
%}
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1548
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1549
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1550
displayPolygon:aPolygon in:aDrawableId with:aDC
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1551
    "draw a polygon, the argument aPolygon is a Collection of individual points,
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1552
     which define the polygon.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1553
     If any coordinate is not integer, an error is triggered."
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1554
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1555
    |numberOfPoints|
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1556
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1557
    numberOfPoints := aPolygon size.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1558
%{
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1559
    OBJ point, px, py;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1560
    int i, num;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1561
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1562
    if (__isExternalAddressLike(aDC)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1563
     /* && __isExternalAddress(aDrawableId) */
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1564
     && __isSmallInteger(numberOfPoints)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1565
        HANDLE hDC = (HANDLE)(__externalAddressVal(aDC));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1566
        POINT p;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1567
        DWORD clr = 0 /* 0xFFFFFFFF */;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1568
        HANDLE prevPen, hPen;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1569
        int lw;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1570
        COLORREF fgColor;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1571
        int lStyleSymbol, lStyleInt;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1572
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1573
        lw= __intVal(__INST(lineWidth));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1574
        lStyleSymbol= __INST(lineStyle);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1575
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1576
        /*  PS_DASH, PS_DOT, PS_DASHDOT, PS_DASHDOTDOT
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1577
            only works with lineWidth = 1  */
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1578
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1579
        if (lStyleSymbol == @symbol(solid)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1580
            lStyleInt= PS_SOLID;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1581
        } else if (lStyleSymbol == @symbol(dashed)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1582
            lStyleInt= PS_DASH;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1583
        } else if (lStyleSymbol == @symbol(dotted)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1584
            lStyleInt= PS_DOT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1585
        } else if (lStyleSymbol == @symbol(dashDot)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1586
            lStyleInt= PS_DASHDOT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1587
        } else if (lStyleSymbol == @symbol(dashDotDot)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1588
            lStyleInt= PS_DASHDOTDOT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1589
        } else if (lStyleSymbol == @symbol(insideFrame)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1590
            lStyleInt= PS_INSIDEFRAME;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1591
        } else
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1592
            lStyleInt= PS_SOLID;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1593
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1594
        num = __intVal(numberOfPoints);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1595
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1596
        for (i=0; i<num; i++) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1597
            point = __AT_(aPolygon, __MKSMALLINT(i+1));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1598
            if (! __isPoint(point)) goto fail;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1599
            px = _point_X(point);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1600
            py = _point_Y(point);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1601
            if (! __bothSmallInteger(px, py)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1602
                goto fail;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1603
            }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1604
        }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1605
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1606
        fgColor = GetTextColor(hDC);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1607
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1608
        hPen = CreatePen(lStyleInt, lw, fgColor);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1609
        prevPen = SelectObject(hDC, hPen);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1610
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1611
        for (i=0; i<num; i++) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1612
            point = __AT_(aPolygon, __MKSMALLINT(i+1));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1613
            px = _point_X(point);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1614
            py = _point_Y(point);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1615
            p.x = __intVal(px);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1616
            p.y = __intVal(py);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1617
            if (i == 0) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1618
                MoveToEx(hDC, p.x, p.y, NULL);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1619
            } else {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1620
                if (i == (num-1)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1621
                    PolylineTo(hDC, &p, 1);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1622
                } else {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1623
                    LineTo(hDC, p.x, p.y);
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1624
#ifdef PRE_04_JUN_04
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1625
                    /*
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1626
                     * end-point ...
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1627
                     */
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1628
                    LineTo(hDC, p.x+1, p.y);
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1629
#endif
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1630
                }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1631
            }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1632
        }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1633
        SelectObject(hDC, prevPen);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1634
        DeleteObject(hPen);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1635
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1636
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1637
        RETURN ( self );
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1638
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1639
fail: ;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1640
%}
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1641
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1642
    "Created: / 07-08-2006 / 14:46:55 / fm"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1643
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1644
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
  1645
displayPolylines:arrayOfPoints
2316
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
  1646
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
  1647
    device displayPolylines:arrayOfPoints in:nil with:gcId
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1648
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1649
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1650
displayPolylines:aPolyline in:ignoredDrawableId with:aDC
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1651
    "draw a polyline, the argument aPolyline is a collection of individual points,
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1652
     which define the lines (p1/p2 pairs); must be even in size.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1653
     If any coordinate is not integer, an error is triggered."
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1654
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1655
    |numberOfPoints|
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1656
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1657
    numberOfPoints := aPolyline size.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1658
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1659
%{
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1660
    OBJ point, px, py;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1661
    int i, num;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1662
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1663
    if (__isExternalAddressLike(aDC)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1664
     && __isSmallInteger(numberOfPoints)) {
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1665
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1666
        HANDLE hDC = (HANDLE)(__externalAddressVal(aDC));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1667
        POINT p;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1668
        HANDLE prevPen, hPen;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1669
        COLORREF fgColor;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1670
        int lw;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1671
        int lStyleSymbol, lStyleInt;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1672
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1673
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1674
        lw= __intVal(__INST(lineWidth));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1675
        lStyleSymbol= __INST(lineStyle);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1676
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1677
        /*  PS_DASH, PS_DOT, PS_DASHDOT, PS_DASHDOTDOT
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1678
            only works with lineWidth = 1  */
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1679
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1680
        if (lStyleSymbol == @symbol(solid)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1681
            lStyleInt= PS_SOLID;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1682
        } else if (lStyleSymbol == @symbol(dashed)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1683
            lStyleInt= PS_DASH;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1684
        } else if (lStyleSymbol == @symbol(dotted)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1685
            lStyleInt= PS_DOT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1686
        } else if (lStyleSymbol == @symbol(dashDot)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1687
            lStyleInt= PS_DASHDOT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1688
        } else if (lStyleSymbol == @symbol(dashDotDot)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1689
            lStyleInt= PS_DASHDOTDOT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1690
        } else if (lStyleSymbol == @symbol(insideFrame)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1691
            lStyleInt= PS_INSIDEFRAME;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1692
        } else
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1693
            lStyleInt= PS_SOLID;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1694
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1695
        fgColor = GetTextColor(hDC);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1696
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1697
        num = __intVal(numberOfPoints);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1698
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1699
        for (i=0; i<num; i++) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1700
            point = __AT_(aPolyline, __MKSMALLINT(i+1));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1701
            if (! __isPoint(point)) goto fail;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1702
            px = _point_X(point);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1703
            py = _point_Y(point);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1704
            if (! __bothSmallInteger(px, py)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1705
                goto fail;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1706
            }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1707
        }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1708
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1709
        hPen = CreatePen(lStyleInt, lw, fgColor);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1710
        prevPen = SelectObject(hDC, hPen);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1711
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1712
        for (i=0; i<num; i++) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1713
            point = __AT_(aPolyline, __MKSMALLINT(i+1));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1714
            px = _point_X(point);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1715
            py = _point_Y(point);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1716
            p.x = __intVal(px);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1717
            p.y = __intVal(py);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1718
            DPRINTF(("printing point"));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1719
            DPRINTF(("displayPolygon: no pen\n"));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1720
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1721
            if ((i & 1) == 0) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1722
                MoveToEx(hDC, p.x, p.y, NULL);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1723
            } else {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1724
                LineTo(hDC, p.x, p.y);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1725
                /*
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1726
                 * end-point ...
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1727
                 */
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1728
                LineTo(hDC, p.x+1, p.y);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1729
            }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1730
        }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1731
        SelectObject(hDC, prevPen);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1732
        DeleteObject(hPen);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1733
        RETURN ( self );
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1734
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1735
fail: ;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1736
%}
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1737
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1738
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1739
displayRectangleX:x y:y width:width height:height in:ignoredDrawableId with:aDC
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1740
    "draw a rectangle. If the coordinates are not integers, an error is triggered."
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1741
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1742
%{
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1743
    int w, h;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1744
    int xL, yT;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1745
    if (__isExternalAddressLike(aDC)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1746
     && __bothSmallInteger(x, y)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1747
     && __bothSmallInteger(width, height)) {
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1748
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1749
        xL = __intVal(x);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1750
        yT = __intVal(y);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1751
        w = __intVal(width);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1752
        h = __intVal(height);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1753
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1754
        DPRINTF(("displayRectangle: %d/%d -> %d/%d\n", xL, yT, w, h));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1755
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1756
        if ((w >= 0) && (h >= 0)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1757
            HANDLE hDC = (HANDLE)(__externalAddressVal(aDC));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1758
            COLORREF fgColor;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1759
            HANDLE prevPen, hPen;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1760
            int lStyleSymbol, lStyleInt;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1761
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1762
            int lw;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1763
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1764
            lw= __intVal(__INST(lineWidth));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1765
            lStyleSymbol= __INST(lineStyle);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1766
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1767
            /*  PS_DASH, PS_DOT, PS_DASHDOT, PS_DASHDOTDOT
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1768
                only works with lineWidth = 1  */
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1769
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1770
            if (lStyleSymbol == @symbol(solid)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1771
                lStyleInt= PS_SOLID;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1772
            } else if (lStyleSymbol == @symbol(dashed)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1773
                lStyleInt= PS_DASH;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1774
            } else if (lStyleSymbol == @symbol(dotted)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1775
                lStyleInt= PS_DOT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1776
            } else if (lStyleSymbol == @symbol(dashDot)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1777
                lStyleInt= PS_DASHDOT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1778
            } else if (lStyleSymbol == @symbol(dashDotDot)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1779
                lStyleInt= PS_DASHDOTDOT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1780
            } else if (lStyleSymbol == @symbol(insideFrame)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1781
                lStyleInt= PS_INSIDEFRAME;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1782
            } else
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1783
                lStyleInt= PS_SOLID;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1784
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1785
            fgColor = GetTextColor(hDC);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1786
            hPen = CreatePen(lStyleInt, lw, fgColor);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1787
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1788
            prevPen = SelectObject(hDC, hPen);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1789
            MoveToEx(hDC, xL, yT, NULL);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1790
            LineTo(hDC, xL+w, yT);       // to top-right
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1791
            LineTo(hDC, xL+w, yT+h);     // to bot-right
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1792
            MoveToEx(hDC, xL, yT, NULL); // back to top-left
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1793
            LineTo(hDC, xL, yT+h);       // to bot-left
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1794
            LineTo(hDC, xL+w+1, yT+h);   // move pen one pixel more
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1795
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1796
            SelectObject(hDC, prevPen);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1797
            DeleteObject(hPen);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1798
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1799
        }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1800
        RETURN ( self );
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1801
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1802
%}.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1803
    self primitiveFailed
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1804
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1805
    "Created: / 28-07-2006 / 20:18:25 / fm"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1806
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1807
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1808
displayString:aString from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1809
    "draw a sub-string - draw foreground only.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1810
     If the coordinates are not integers, retry with rounded."
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1811
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1812
    self
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1813
        displayString:aString
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1814
        from:index1
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1815
        to:index2
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1816
        x:x
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1817
        y:y
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1818
        in:aDrawableId
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1819
        with:aGCId
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1820
        opaque:false
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1821
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1822
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1823
displayString:aString from:index1 to:index2 x:x y:y in:ignoredDrawableId with:aDC opaque:opaque
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1824
    "draw a sub-string - if opaque is false, draw foreground only; otherwise, draw both
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1825
     foreground and background characters.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1826
     If the coordinates are not integers, an error is triggered."
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1827
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1828
%{  /* NOCONTEXT */
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1829
    unsigned char *cp;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1830
    OBJ cls;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1831
    int  i1, i2, l, n;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1832
    int nInstBytes;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1833
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1834
    if (__isExternalAddressLike(aDC)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1835
     && __isNonNilObject(aString)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1836
     && __bothSmallInteger(index1, index2)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1837
     && __bothSmallInteger(x, y))
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1838
    {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1839
        HANDLE hDC = (HANDLE)(__externalAddressVal(aDC));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1840
        int pX, pY;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1841
        COLORREF fgColor;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1842
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1843
        pX = __intVal(x);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1844
        pY = __intVal(y);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1845
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1846
        if (opaque == true) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1847
            SetBkMode(hDC, OPAQUE);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1848
        } else {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1849
            SetBkMode(hDC, TRANSPARENT);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1850
        }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1851
        fgColor = GetTextColor(hDC);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1852
        SetTextColor(hDC, fgColor);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1853
        SetBkColor(hDC, 0xFFFFFFFF);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1854
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1855
        cls = __qClass(aString);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1856
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1857
        i1 = __intVal(index1) - 1;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1858
        if (i1 >= 0) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1859
            i2 = __intVal(index2) - 1;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1860
            if (i2 < i1) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1861
                goto ret;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1862
            }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1863
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1864
            cp = _stringVal(aString);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1865
            l = i2 - i1 + 1;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1866
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1867
            if ((cls == @global(String)) || (cls == @global(Symbol))) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1868
                n = _stringSize(aString);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1869
                if (i2 < n) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1870
                    cp += i1;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1871
                    DPRINTF(("string1: %s pos=%d/%d l=%d hDC=%x\n", cp, pX, pY,l,hDC));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1872
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1873
                    if (l > 32767) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1874
                        l = 32767;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1875
                    }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1876
                    if (! TextOut(hDC, pX, pY, (char *)cp, l)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1877
                        DFPRINTF((stderr, "WinPrinter [warning]: Textout failed. %d\n", GetLastError()));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1878
                    }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1879
                    goto ret;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1880
                }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1881
            }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1882
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1883
            nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1884
            cp += nInstBytes;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1885
            n = __byteArraySize(aString) - nInstBytes;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1886
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1887
            if (__isBytes(aString)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1888
                if (i2 < n) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1889
                    cp += i1;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1890
                    DPRINTF(("string: %s pos=%d/%d\n", cp, pX, pY));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1891
                    if (l > 32767) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1892
                        l = 32767;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1893
                    }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1894
                    if (! TextOut(hDC, pX, pY, (char *)cp, l)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1895
                        DFPRINTF((stderr, "WinPrinter [warning]: Textout failed. %d\n", GetLastError()));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1896
                    }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1897
                    goto ret;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1898
                }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1899
            }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1900
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1901
            /* Unicode */
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1902
            if (__isWords(aString)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1903
                n = n / 2;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1904
                if (i2 < n) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1905
                    WIDECHAR *w_cp = (WIDECHAR *)cp;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1906
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1907
                    w_cp += i1;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1908
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1909
                    if (! TextOutW(hDC, pX, pY, w_cp, l)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1910
                        DFPRINTF((stderr, "WinPrinter [warning]: TextoutW failed. %d\n", GetLastError()));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1911
                    }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1912
                    goto ret;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1913
                }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1914
            }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1915
        }
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1916
ret:
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1917
        RETURN ( self );
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1918
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1919
%}.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1920
    self primitiveFailed
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1921
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1922
    "Created: / 28-07-2006 / 20:35:19 / fm"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1923
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1924
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1925
displayString:aString from:index1 to:index2 x:x y:y in:ignoredDrawableId with:aDC opaque:opaque fontAscent:fontAscent
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1926
    "draw a sub-string - if opaque is false, draw foreground only; otherwise, draw both
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1927
     foreground and background characters.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1928
     If the coordinates are not integers, an error is triggered."
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1929
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1930
%{  /* NOCONTEXT */
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1931
    unsigned char *cp;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1932
    OBJ cls;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1933
    int  i1, i2, l, n;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1934
    int nInstBytes;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1935
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1936
    if (__isExternalAddressLike(aDC)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1937
     && __isNonNilObject(aString)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1938
     && __bothSmallInteger(index1, index2)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1939
     && __bothSmallInteger(x, y))
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  1940
    {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1941
        HANDLE hDC = (HANDLE)(__externalAddressVal(aDC));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1942
        int pX, pY;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1943
        COLORREF fgColor;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1944
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1945
        pX = __intVal(x);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1946
        pY = __intVal(y);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1947
        pY -= __intVal(fontAscent);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1948
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1949
        if (opaque == true) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1950
            SetBkMode(hDC, OPAQUE);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1951
        } else {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1952
            SetBkMode(hDC, TRANSPARENT);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1953
        }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1954
        fgColor = GetTextColor(hDC);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1955
        SetTextColor(hDC, fgColor);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1956
        SetBkColor(hDC, 0xFFFFFFFF);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1957
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1958
        cls = __qClass(aString);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1959
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1960
        i1 = __intVal(index1) - 1;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1961
        if (i1 >= 0) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1962
            i2 = __intVal(index2) - 1;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1963
            if (i2 < i1) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1964
                goto ret;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1965
            }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1966
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1967
            cp = _stringVal(aString);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1968
            l = i2 - i1 + 1;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1969
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1970
            if ((cls == @global(String)) || (cls == @global(Symbol))) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1971
                n = _stringSize(aString);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1972
                if (i2 < n) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1973
                    cp += i1;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1974
                    DPRINTF(("string1: %s pos=%d/%d l=%d hDC=%x\n", cp, pX, pY,l,hDC));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1975
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1976
                    if (l > 32767) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1977
                        l = 32767;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1978
                    }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1979
                    if (! TextOut(hDC, pX, pY, (char *)cp, l)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1980
                        DFPRINTF((stderr, "WinPrinter [warning]: Textout failed. %d\n", GetLastError()));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1981
                    }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1982
                    goto ret;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1983
                }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1984
            }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1985
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1986
            nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1987
            cp += nInstBytes;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1988
            n = __byteArraySize(aString) - nInstBytes;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1989
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1990
            if (__isBytes(aString)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1991
                if (i2 < n) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1992
                    cp += i1;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1993
                    DPRINTF(("string: %s pos=%d/%d\n", cp, pX, pY));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1994
                    if (l > 32767) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1995
                        l = 32767;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1996
                    }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1997
                    if (! TextOut(hDC, pX, pY, (char *)cp, l)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1998
                        DFPRINTF((stderr, "WinPrinter [warning]: Textout failed. %d\n", GetLastError()));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  1999
                    }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2000
                    goto ret;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2001
                }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2002
            }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2003
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2004
            /* Unicode */
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2005
            if (__isWords(aString)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2006
                n = n / 2;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2007
                if (i2 < n) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2008
                    WIDECHAR *w_cp = (WIDECHAR *)cp;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2009
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2010
                    w_cp += i1;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2011
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2012
                    if (! TextOutW(hDC, pX, pY, w_cp, l)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2013
                        DFPRINTF((stderr, "WinPrinter [warning]: TextoutW failed. %d\n", GetLastError()));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2014
                    }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2015
                    goto ret;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2016
                }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2017
            }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2018
        }
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2019
ret:
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2020
        RETURN ( self );
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2021
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2022
%}.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2023
    self primitiveFailed
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2024
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2025
    "Created: / 28-07-2006 / 20:35:19 / fm"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2026
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2027
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2028
displayString:aString x:x y:y in:aDrawableId with:aDC
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2029
    "draw a string - draw foreground only.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2030
     If the coordinates are not integers, retry with rounded."
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2031
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2032
    self
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2033
        displayString:aString
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2034
        x:x
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2035
        y:y
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2036
        in:aDrawableId
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2037
        with:aDC
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2038
        opaque:false
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2039
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2040
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2041
displayString:aString x:x y:y in:aDrawableId with:aDC opaque:opaque
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2042
    "draw a string"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2043
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2044
    self displayString:aString
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2045
                  from:1
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2046
                    to:aString size
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2047
                     x:x
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2048
                     y:y
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2049
                     in:aDrawableId
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2050
                     with:aDC
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2051
                     opaque:opaque
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2052
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2053
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2054
fillArcX:x y:y width:width height:height from:startAngle angle:angle
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2055
               in:ignoredDrawableId with:aDC
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2056
    "fill an arc. If any coordinate is not integer, an error is triggered.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2057
     The angles may be floats or integer - they are given in degrees."
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2058
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2059
%{
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2060
    int __x, __y, w, h;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2061
    float angle1, angle2;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2062
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2063
    if (__isSmallInteger(startAngle))
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2064
        angle1 = (float)(__intVal(startAngle));
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2065
    else if (__isFloat(startAngle)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2066
        angle1 = __floatVal(startAngle);
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2067
    } else if (__isShortFloat(startAngle)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2068
        angle1 = __shortFloatVal(startAngle);
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2069
    } else goto bad;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2070
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2071
    if (__isSmallInteger(angle))
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2072
        angle2 = (float)(__intVal(angle));
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2073
    else if (__isFloat(angle)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2074
        angle2 = __floatVal(angle);
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2075
    } else if (__isShortFloat(angle)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2076
        angle2 = __shortFloatVal(angle);
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2077
    } else goto bad;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2078
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2079
    if (angle2 <= 0) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2080
        RETURN (self);
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2081
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2082
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2083
    if (__isExternalAddressLike(aDC)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2084
     && __bothSmallInteger(x, y)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2085
     && __bothSmallInteger(width, height))
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2086
     {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2087
        HANDLE hDC = (HANDLE)(__externalAddressVal(aDC));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2088
        HBRUSH hBrush, prevBrush;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2089
        HPEN prevPen = 0;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2090
        COLORREF fgColor;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2091
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2092
        w = __intVal(width);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2093
        h = __intVal(height);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2094
        __x = __intVal(x);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2095
        __y = __intVal(y);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2096
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2097
        fgColor = GetTextColor(hDC);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2098
        hBrush = CreateSolidBrush(fgColor);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2099
        prevBrush = SelectObject(hDC, hBrush);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2100
        if (hBrush == 0) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2101
            DPRINTF(("fillArc: no brush\n"));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2102
        } else {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2103
            HPEN hPen = 0;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2104
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2105
            if (0 /* __isWinNT */) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2106
                fgColor = GetTextColor(hDC);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2107
                hPen = CreatePen(PS_SOLID, 1, fgColor);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2108
                prevPen = SelectObject(hDC, hPen);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2109
                if (hPen == 0) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2110
                    DPRINTF(("fillArc: no pen\n"));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2111
                    goto failpen;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2112
                }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2113
            } else {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2114
                prevPen = SelectObject(hDC, GetStockObject(NULL_PEN));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2115
                w++;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2116
                h++;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2117
            }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2118
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2119
            {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2120
                double xB, yB, xE, yE, xR, yR;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2121
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2122
                xR = w / 2;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2123
                yR = h / 2;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2124
                if (angle2 - angle1 >= 360) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2125
                    xB = xE = __x + xR + 0.5;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2126
                    yB = yE = __y /*+ yR + 0.5*/;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2127
                } else {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2128
                    double sin(), cos();
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2129
                    float rad1, rad2;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2130
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2131
                    if (angle1 <= 180)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2132
                        angle1 = 180 - angle1;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2133
                    else
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2134
                        angle1 = 360 + 180 - angle1;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2135
                    angle2 = angle1 - angle2;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2136
                    /* sigh - compute the intersections ... */
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2137
                    rad1 = (angle1 * 3.14159265359) / 180.0;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2138
                    rad2 = (angle2 * 3.14159265359) / 180.0;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2139
                    xB = cos(rad1) * xR;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2140
                    yB = sin(rad1) * yR;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2141
                    xE = cos(rad2) * xR;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2142
                    yE = sin(rad2) * yR;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2143
                    xB = __x + xR - xB + 0.5;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2144
                    yB = __y + yR - yB + 0.5;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2145
                    xE = __x + xR - xE + 0.5;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2146
                    yE = __y + yR - yE + 0.5;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2147
                }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2148
                DPRINTF(("fillArc x=%d y=%d w=%d h=%d xB=%d xE=%d yB=%d yE=%d a1=%f a2=%f\n",__x,__y,w,h,(int)xB,(int)xE,(int)yB,(int)yE,angle1,angle2));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2149
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2150
                Pie(hDC,
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2151
                    __x, __y,
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2152
                    __x + w + 1, __y + h + 1,
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2153
                    (int)xB, (int)yB,
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2154
                    (int)xE, (int)yE);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2155
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2156
                if (hPen) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2157
                    DeleteObject(hPen);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2158
                }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2159
            }
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2160
failpen:
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2161
            if (prevPen) SelectObject(hDC, prevPen);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2162
            DeleteObject(hPen);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2163
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2164
            SelectObject(hDC, prevBrush);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2165
            DeleteObject(hBrush);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2166
        }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2167
        RETURN ( self );
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2168
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2169
    bad: ;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2170
%}.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2171
    self primitiveFailed
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2172
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2173
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2174
fillPolygon:aPolygon in:ignoredDrawableId with:aGCId
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2175
    "fill a polygon given by its points.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2176
     If any coordinate is not integer, an error is triggered."
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2177
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2178
    |numberOfPoints|
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2179
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2180
    numberOfPoints := aPolygon size.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2181
    self
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2182
        primFillPolygon:aPolygon n:numberOfPoints
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2183
        in:ignoredDrawableId with:aGCId
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2184
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2185
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2186
fillRectangleX:x y:y width:width height:height in:ignoredDrawableId with:aDC
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2187
    "fill a rectangle. If any coordinate is not integer, an error is triggered."
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2188
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2189
%{  /* NOCONTEXT */
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2190
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2191
    int w, h;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2192
    if (__isExternalAddressLike(aDC)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2193
     && __bothSmallInteger(x, y)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2194
     && __bothSmallInteger(width, height)) {
2326
82077cd59898 *** empty log message ***
fm
parents: 2325
diff changeset
  2195
        w = __intVal(width);
82077cd59898 *** empty log message ***
fm
parents: 2325
diff changeset
  2196
        h = __intVal(height);
82077cd59898 *** empty log message ***
fm
parents: 2325
diff changeset
  2197
82077cd59898 *** empty log message ***
fm
parents: 2325
diff changeset
  2198
        if ((w >= 0) && (h >= 0)) {
82077cd59898 *** empty log message ***
fm
parents: 2325
diff changeset
  2199
            HANDLE hDC = (HANDLE)(__externalAddressVal(aDC));
82077cd59898 *** empty log message ***
fm
parents: 2325
diff changeset
  2200
            HBRUSH hBrush, prevBrush;
82077cd59898 *** empty log message ***
fm
parents: 2325
diff changeset
  2201
            RECT rct;
82077cd59898 *** empty log message ***
fm
parents: 2325
diff changeset
  2202
            COLORREF fgColor;
82077cd59898 *** empty log message ***
fm
parents: 2325
diff changeset
  2203
82077cd59898 *** empty log message ***
fm
parents: 2325
diff changeset
  2204
            fgColor = GetTextColor(hDC);
82077cd59898 *** empty log message ***
fm
parents: 2325
diff changeset
  2205
            hBrush = CreateSolidBrush(fgColor);
82077cd59898 *** empty log message ***
fm
parents: 2325
diff changeset
  2206
            rct.left = __intVal(x);
82077cd59898 *** empty log message ***
fm
parents: 2325
diff changeset
  2207
            rct.top  = __intVal(y);
82077cd59898 *** empty log message ***
fm
parents: 2325
diff changeset
  2208
            rct.right  = rct.left + w + 1;
82077cd59898 *** empty log message ***
fm
parents: 2325
diff changeset
  2209
            rct.bottom = rct.top  + h + 1;
82077cd59898 *** empty log message ***
fm
parents: 2325
diff changeset
  2210
82077cd59898 *** empty log message ***
fm
parents: 2325
diff changeset
  2211
           prevBrush = SelectObject(hDC, hBrush);
82077cd59898 *** empty log message ***
fm
parents: 2325
diff changeset
  2212
           FillRect(hDC, &rct, hBrush);
82077cd59898 *** empty log message ***
fm
parents: 2325
diff changeset
  2213
           SelectObject(hDC, prevBrush);
82077cd59898 *** empty log message ***
fm
parents: 2325
diff changeset
  2214
           DeleteObject(hBrush);
82077cd59898 *** empty log message ***
fm
parents: 2325
diff changeset
  2215
82077cd59898 *** empty log message ***
fm
parents: 2325
diff changeset
  2216
        }
82077cd59898 *** empty log message ***
fm
parents: 2325
diff changeset
  2217
    }
82077cd59898 *** empty log message ***
fm
parents: 2325
diff changeset
  2218
    RETURN ( self );
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2219
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2220
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2221
%}
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2222
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2223
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2224
primFillPolygon:aPolygon n:numberOfPoints in:ignoredDrawableId with:aDC
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2225
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2226
%{
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2227
    OBJ point, px, py;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2228
    int i, num;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2229
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2230
    if (__isExternalAddressLike(aDC)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2231
     && __isSmallInteger(numberOfPoints)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2232
        HANDLE hDC = (HANDLE)(__externalAddressVal(aDC));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2233
        POINT p;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2234
        HBRUSH hBrush, prevBrush;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2235
        COLORREF fgColor;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2236
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2237
        num = __intVal(numberOfPoints);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2238
        if (num < 3) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2239
            RETURN ( self );
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2240
        }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2241
        for (i=0; i<num; i++) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2242
            point = __AT_(aPolygon, __MKSMALLINT(i+1));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2243
            if (! __isPoint(point)) goto fail;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2244
            px = _point_X(point);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2245
            py = _point_Y(point);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2246
            if (! __bothSmallInteger(px, py))
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2247
                goto fail;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2248
        }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2249
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2250
        fgColor = GetTextColor(hDC);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2251
        hBrush = CreateSolidBrush(fgColor);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2252
        if (hBrush == 0) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2253
            DPRINTF(("fillPolygon: no brush\n"));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2254
        } else {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2255
            HPEN prevPen;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2256
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2257
            prevBrush = SelectObject(hDC, hBrush);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2258
            prevPen = SelectObject(hDC, GetStockObject(NULL_PEN));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2259
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2260
            BeginPath(hDC);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2261
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2262
            for (i=0; i<num; i++) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2263
                point = __AT_(aPolygon, __MKSMALLINT(i+1));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2264
                px = _point_X(point);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2265
                py = _point_Y(point);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2266
                if (i == 0) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2267
                    MoveToEx(hDC, __intVal(px), __intVal(py), NULL);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2268
                } else {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2269
                    if (i == (num-1)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2270
                        p.x = __intVal(px);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2271
                        p.y = __intVal(py);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2272
                        PolylineTo(hDC, &p, 1);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2273
                    } else {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2274
                        LineTo(hDC, __intVal(px), __intVal(py));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2275
                    }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2276
                }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2277
            }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2278
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2279
            EndPath(hDC);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2280
            FillPath(hDC);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2281
            SelectObject(hDC, prevPen);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2282
            SelectObject(hDC, prevBrush);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2283
            DeleteObject(hBrush);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2284
        }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2285
        RETURN ( self );
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2286
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2287
fail: ;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2288
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2289
%}
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2290
! !
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2291
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2292
!WinPrinterContext methodsFor:'drawing bitmaps'!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2293
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2294
bitsBlue
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2295
    "return the number of valid bits in the red component."
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2296
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2297
"/    bitsRed isNil ifTrue:[
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2298
"/        "/ not a truecolor display
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2299
"/        ^ bitsPerRGB
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2300
"/    ].
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2301
"/    ^ bitsRed
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2302
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2303
     ^Display bitsBlue
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2304
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2305
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2306
bitsGreen
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2307
    "return the number of valid bits in the red component."
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2308
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2309
"/    bitsRed isNil ifTrue:[
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2310
"/        "/ not a truecolor display
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2311
"/        ^ bitsPerRGB
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2312
"/    ].
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2313
"/    ^ bitsRed
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2314
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2315
     ^Display bitsGreen
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2316
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2317
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2318
bitsRed
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2319
    "return the number of valid bits in the red component."
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2320
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2321
"/    bitsRed isNil ifTrue:[
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2322
"/        "/ not a truecolor display
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2323
"/        ^ bitsPerRGB
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2324
"/    ].
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2325
"/    ^ bitsRed
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2326
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2327
     ^Display bitsRed
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2328
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2329
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2330
copyFromId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2331
                width:w height:h
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2332
    "do a bit-blt; copy bits from the rectangle defined by
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2333
     srcX/srcY and w/h from the sourceId drawable to the rectangle
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2334
     below dstX/dstY in the destId drawable. Trigger an error if any
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2335
     argument is not integer."
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2336
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2337
%{
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2338
    int     dstGcOwnerThreadID;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2339
    HWND    dstGcHWIN;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2340
    HBITMAP dstGcHBITMAP;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2341
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2342
    if (! __isExternalAddressLike(srcGCId)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2343
     || ! __isExternalAddressLike(dstGCId)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2344
        goto fail;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2345
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2346
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2347
    if (__bothSmallInteger(w, h)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2348
     && __bothSmallInteger(srcX, srcY)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2349
     && __bothSmallInteger(dstX, dstY)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2350
        HANDLE srcDC = (HANDLE)(__externalAddressVal(srcGCId));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2351
        HANDLE dstDC = (HANDLE)(__externalAddressVal(dstGCId));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2352
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2353
        int fun, aFunctionSymbol;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2354
        int src_fg, src_bg, dst_fg, dst_bg;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2355
        char buf[5];
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2356
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2357
//          fun = dstGcData->bitbltrop2;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2358
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2359
        aFunctionSymbol= __INST(function);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2360
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2361
        if (aFunctionSymbol == @symbol(copy)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2362
            fun = SRCCOPY /* R2_COPYPEN */ ;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2363
/*            bfun = BITBLT_COPY;                                          */
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2364
        } else if (aFunctionSymbol == @symbol(copyInverted)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2365
            fun = NOTSRCCOPY /* R2_NOTCOPYPEN */;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2366
/*            bfun = BITBLT_COPYINVERTED;                                  */
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2367
        } else if (aFunctionSymbol == @symbol(xor)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2368
            fun = SRCINVERT /* R2_XORPEN */;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2369
/*            bfun = BITBLT_XOR;                                           */
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2370
        } else if (aFunctionSymbol == @symbol(and)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2371
            fun = SRCAND /* R2_MASKPEN */ ;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2372
/*            bfun = BITBLT_AND;                                           */
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2373
        } else if (aFunctionSymbol == @symbol(or)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2374
            fun = MERGECOPY /* R2_MERGEPEN */ ;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2375
/*            bfun = BITBLT_OR;                                            */
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2376
        }
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2377
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2378
    // convert 123 to string [buf]
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2379
    // itoa(fun, buf, 10);
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2380
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2381
    //        console_printf(" ", buf);
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2382
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2383
/*
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2384
#if 0
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2385
        switch (fun) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2386
          case BITBLT_COPY:
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2387
            console_printf("BITBLT_COPY\n");
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2388
            break;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2389
          case BITBLT_COPYINVERTED:
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2390
            console_printf("BITBLT_COPYINVERTED\n");
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2391
            break;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2392
          case BITBLT_XOR:
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2393
            console_printf("BITBLT_XOR\n");
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2394
            break;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2395
          case BITBLT_AND:
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2396
            console_printf("BITBLT_AND\n");
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2397
            break;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2398
          case BITBLT_OR:
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2399
            console_printf("BITBLT_OR\n");
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2400
            break;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2401
        }
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2402
#endif
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2403
*/
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2404
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2405
//          fun = dstGcData->bitbltrop2;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2406
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2407
        if (0 /* fun == BITBLT_COPY */) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2408
            src_fg = dst_fg = 0xFFFFFF;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2409
            src_bg = dst_bg = 0x000000;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2410
        } else {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2411
            src_fg = GetTextColor(srcDC) /* srcGcData->fgColor */;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2412
            src_bg = GetBkColor(dstDC) /* srcGcData->bgColor */;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2413
            dst_fg = GetTextColor(srcDC) /* dstGcData->fgColor */;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2414
            dst_bg = GetBkColor(dstDC) /* dstGcData->bgColor */;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2415
        }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2416
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2417
        SetBkColor(dstDC, dst_fg);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2418
        SetTextColor(dstDC, dst_bg);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2419
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2420
        SetBkColor(srcDC, src_fg);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2421
        SetTextColor(srcDC, src_bg);
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2422
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2423
/*
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2424
        CPRINTF(("bitblt src f:%x b:%x",GetTextColor(srcDC),GetBkColor(srcDC)));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2425
        CPRINTF(("dst f:%x b:%x\n",GetTextColor(dstDC),GetBkColor(dstDC)));
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2426
*/
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2427
        if (BitBlt(dstDC,
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2428
             __intVal(dstX), __intVal(dstY),
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2429
             __intVal(w), __intVal(h),
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2430
             srcDC,
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2431
             __intVal(srcX), __intVal(srcY),
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2432
             fun)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2433
           == 0
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2434
          ) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2435
            console_fprintf(stderr, "WinWorkstation [info]: ERROR in BitBlt\n");
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2436
        }
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2437
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2438
/*
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2439
        if (dstGcData != srcGcData) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2440
            SetBkColor(dstDC, dstGcData->bgColor);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2441
            SetTextColor(dstDC, dstGcData->fgColor);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2442
        }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2443
        SetBkColor(srcDC, srcGcData->bgColor);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2444
        SetTextColor(srcDC, srcGcData->fgColor);
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2445
*/
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2446
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2447
/*
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2448
        if (srcGcData != dstGcData) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2449
            _releaseDC(srcGcData);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2450
        }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2451
        _releaseDC(dstGcData);
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2452
*/
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2453
        RETURN ( self );
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2454
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2455
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2456
 fail: ;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2457
%}.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2458
    self primitiveFailed.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2459
    ^ nil
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2460
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2461
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2462
copyFromPixmapId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2463
    "do a bit-blt from a pix- or bitmap.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2464
     Here, fall back into copyFromId:, which should also work.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2465
     Subclasses may redefine this for more performance or if required"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2466
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2467
    ^ self copyFromId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2468
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2469
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2470
copyPlaneFromId:sourceId x:srcX y:srcY gc:srcDCId to:destId x:dstX y:dstY gc:dstDCId
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2471
                width:w height:h
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2472
    "do a bit-blt, but only copy the low-bit plane;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2473
     copy bits from the rectangle defined by
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2474
     srcX/srcY and w/h from the sourceId drawable to the rectangle
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2475
     below dstX/dstY in the destId drawable. Trigger an error if any
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2476
     argument is not integer."
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2477
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2478
    ^ self
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2479
        copyFromId:sourceId
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2480
                 x:srcX y:srcY gc:srcDCId
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2481
                to:destId x:dstX y:dstY gc:dstDCId
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2482
             width:w height:h
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2483
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2484
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2485
copyPlaneFromPixmapId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2486
    "do a bit-blt from a pix- or bitmap, using the low-bit plane of the source only.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2487
     Here, fall back into copyPlaneFromId:, which should also work.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2488
     Subclasses may redefine this for more performance or if required"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2489
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2490
    ^ self copyPlaneFromId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2491
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2492
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2493
createBitmapFromArray:anArray width:w height:h
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2494
    |bitmapId|
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2495
2325
634b74929d2d *** empty log message ***
fm
parents: 2324
diff changeset
  2496
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2497
    bitmapId := self primCreateBitmapFromArray:anArray width:w height:h.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2498
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2499
    bitmapId isNil ifTrue:[
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2500
        'WINWORKSTATION: cannot create bitmap' errorPrintCR.
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2501
    ].
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2502
    ^ bitmapId
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2503
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2504
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2505
createPixmapWidth:w height:h depth:d
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2506
    "allocate a pixmap on the Xserver, the contents is undefined
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2507
     (i.e. random). Return a bitmap id or nil"
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2508
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2509
%{
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2510
    HANDLE newBitmapHandle;
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2511
    HANDLE rootDC = CreateDC("DISPLAY", NULL, NULL, NULL);
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2512
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2513
    /*console_printf("CreateBitmap Color\n");*/
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2514
    if (__bothSmallInteger(w, h) && __isSmallInteger(d) /*&& ISCONNECTED */) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2515
        if (__intVal(d) == 1) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2516
            newBitmapHandle = CreateBitmap(__intVal(w), __intVal(h) , 1, 1, NULL);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2517
        } else {
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2518
#if 0
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2519
            if (__intVal(d) != __depth) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2520
                console_printf("invalid depth\n");
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2521
                RETURN (nil);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2522
            }
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2523
#endif
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2524
            newBitmapHandle = CreateCompatibleBitmap(rootDC, __intVal(w), __intVal(h) );
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2525
        }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2526
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2527
        if (newBitmapHandle) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2528
            RETURN ( __MKOBJ(newBitmapHandle));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2529
        }
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2530
/*
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2531
        DPRINTF(("empty bitmap handle = %x\n", newBitmapHandle));
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2532
*/
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2533
    }
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2534
    RETURN (nil);
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2535
%}
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2536
!
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2537
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2538
destroyPixmap:aDrawableId
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2539
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2540
%{  /* NOCONTEXT */
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2541
    if (__isExternalAddress(aDrawableId) /* && ISCONNECTED */ ) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2542
        HANDLE bitmapHandle = _HANDLEVal(aDrawableId);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2543
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2544
        if (bitmapHandle) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2545
            DeleteObject(bitmapHandle);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2546
        /*    _DeleteObject(bitmapHandle, __LINE__);    */
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2547
        }
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2548
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2549
%}
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2550
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2551
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2552
drawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth padding:padd
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2553
                          width:imageWidth height:imageHeight
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2554
                              x:srcx y:srcy
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2555
                           into:ignoredDrawableId
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2556
                              x:dstx y:dsty
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2557
                          width:w height:h
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2558
                           with:aGCId
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2559
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2560
    "draw a bitImage which has depth id, width iw and height ih into
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2561
     the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2562
     Individual source pixels have bitsPerPixel bits, allowing to draw
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2563
     depth and pixel-units to be different.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2564
     It has to be checked elsewhere, that the server can do it with the given
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2565
     depth - otherwise, primitive failure will be signalled.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2566
     Also it is assumed, that the colormap is setup correctly and the
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2567
     colors are allocated - otherwise the colors may be wrong."
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2568
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2569
    "
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2570
     sorry; I had to separate it into 2 methods, since XPutImage needs
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2571
     an unlimited stack, and thus cannot send primitiveFailed
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2572
    "
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2573
    (self primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth padding:padd
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2574
                                        width:imageWidth height:imageHeight
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2575
                                             x:srcx y:srcy
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2576
                                          into:ignoredDrawableId
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2577
                                             x:dstx y:dsty
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2578
                                         width:w height:h
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2579
                                          with:aGCId)
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2580
    ifFalse:[
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2581
        "
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2582
         also happens, if a segmentation violation occurs in the
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2583
         XPutImage ...
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2584
        "
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2585
        self primitiveFailed
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2586
    ].
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2587
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2588
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2589
gcForBitmap:aDrawableId
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2590
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2591
%{  /* NOCONTEXT */
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2592
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2593
    if (__isExternalAddress(aDrawableId)){
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2594
        BITMAP bitmap;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2595
        HBITMAP hBitmap = _HBITMAPVAL(aDrawableId);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2596
        HBITMAP memBM;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2597
        HANDLE compatibleDC, rootDC, hdcScreen;
2325
634b74929d2d *** empty log message ***
fm
parents: 2324
diff changeset
  2598
   //     HANDLE printerDC = (HANDLE)(__externalAddressVal(__INST(gcId)));
634b74929d2d *** empty log message ***
fm
parents: 2324
diff changeset
  2599
634b74929d2d *** empty log message ***
fm
parents: 2324
diff changeset
  2600
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2601
        if (! hBitmap) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2602
            RETURN (nil);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2603
        }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2604
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2605
        if (GetObject(hBitmap, sizeof(bitmap), &bitmap)) {
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2606
/*
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2607
            DDPRINTF(("bitmap info:%d\n", bitmap.bmBitsPixel));
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2608
*/
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2609
        } else {
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2610
/*
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2611
            DPRINTF(("noinfo returned for bitmap\n"));
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2612
*/
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2613
            /* mhmh - can this happen ? */
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2614
            bitmap.bmBitsPixel = 1;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2615
        }
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2616
/*
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2617
        gcData->hBitmap = hBitmap;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2618
        gcData->bitmapColorBitCount = bitmap.bmBitsPixel;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2619
*/
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2620
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2621
        rootDC  = CreateDC("DISPLAY", NULL, NULL, NULL);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2622
        compatibleDC = CreateCompatibleDC(rootDC);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2623
        SelectObject(compatibleDC, hBitmap);
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2624
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2625
   //     hdcScreen= CreateDC("NULL", NULL, NULL, NULL);
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2626
   //       compatibleDC =  rootDC;
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2627
   //     compatibleDC = CreateCompatibleDC(printerDC);
2325
634b74929d2d *** empty log message ***
fm
parents: 2324
diff changeset
  2628
   //     compatibleDC = CreateCompatibleDC(0);
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2629
   //     memBM = CreateCompatibleBitmap ( compatibleDC, bitmap.bmWidth, bitmap.bmHeight );
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2630
   //     SelectObject ( compatibleDC, memBM );
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2631
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2632
        RETURN (__MKOBJ(compatibleDC));
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2633
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2634
/*
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2635
        RETURN ( __MKOBJ(gcData) );
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2636
*/
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2637
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2638
    RETURN (nil);
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2639
%}
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2640
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2641
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2642
primCreateBitmapFromArray:anArray width:w height:h
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2643
%{
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2644
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2645
    HBITMAP newBitmapHandle;
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2646
    int b_width, b_height, bytesPerRowST, bytesPerRowWN, padding;
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2647
    int row, col;
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2648
    unsigned char *cp, *bPits;
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2649
    unsigned char *b_bits = 0;
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2650
    int index;
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2651
    OBJ num;
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2652
    unsigned char *allocatedBits = 0;
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2653
    unsigned char fastBits[10000];
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2654
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2655
    if (__bothSmallInteger(w, h)
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2656
     && _isNonNilObject(anArray)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2657
        OBJ cls = __qClass(anArray);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2658
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2659
        b_width = __intVal(w);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2660
        b_height = __intVal(h);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2661
        bytesPerRowST = (b_width + 7) / 8;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2662
        bytesPerRowWN = ((b_width + 15) / 16) * 2;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2663
        padding = bytesPerRowWN - bytesPerRowST;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2664
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2665
        if ((padding == 0) && (cls == @global(ByteArray))) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2666
            b_bits = __ByteArrayInstPtr(anArray)->ba_element;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2667
            cp = 0;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2668
        } else {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2669
            int nBytes = b_height * bytesPerRowWN;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2670
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2671
            if (nBytes < sizeof(fastBits)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2672
                cp = b_bits = fastBits;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2673
            } else {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2674
                cp = b_bits = allocatedBits = (unsigned char *) malloc(nBytes);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2675
                if (! cp) goto fail;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2676
            }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2677
        }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2678
        if (cp) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2679
            if (cls == @global(Array)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2680
                OBJ *op;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2681
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2682
                index = 1;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2683
                op = &(__ArrayInstPtr(anArray)->a_element[index - 1]);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2684
                for (row = b_height; row; row--) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2685
                    for (col = bytesPerRowST; col; col--) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2686
                        num = *op++;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2687
                        if (! __isSmallInteger(num))
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2688
                            goto fail;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2689
                        *cp++ = __intVal(num);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2690
                    }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2691
                    cp += padding;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2692
                }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2693
            } else if (cls == @global(ByteArray)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2694
                unsigned char *pBits;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2695
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2696
                pBits = __ByteArrayInstPtr(anArray)->ba_element;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2697
                for (row = b_height; row; row--) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2698
                    for (col = bytesPerRowST; col; col--) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2699
                        *cp++ = ( *pBits++ /*^ 0xFF*/ );
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2700
                    }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2701
                    cp += padding;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2702
                }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2703
            } else {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2704
                goto fail;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2705
            }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2706
        }
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2707
/*
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2708
        CPRINTF(("create bitmap ...\n"));
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2709
*/
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2710
        newBitmapHandle = CreateBitmap(b_width, b_height, 1, 1, b_bits );
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2711
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2712
        if (newBitmapHandle ) {
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2713
/*
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2714
            DDPRINTF(("returning bitmap %x ...\n", newBitmapHandle));
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2715
*/
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2716
            if (allocatedBits) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2717
                free(allocatedBits);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2718
            }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2719
            RETURN ( __MKOBJ(newBitmapHandle));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2720
        }
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2721
    }
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2722
fail: ;
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2723
/*
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2724
    DDPRINTF(("create bitmap FAILED!!!\n"));
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2725
*/
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2726
    if (allocatedBits) {
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2727
/*
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2728
        CPRINTF(("freeing up bitmap bits ...\n"));
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2729
*/
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2730
        free(allocatedBits);
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2731
    }
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2732
/*
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2733
    CPRINTF(("returning nil ...\n"));
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2734
*/
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2735
    RETURN ( nil );
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2736
%}
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2737
!
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2738
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2739
primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth padding:padd
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2740
                              width:imageWidth height:imageHeight
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2741
                                  x:srcx y:srcy
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2742
                               into:ignoredDrawableId
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2743
                                  x:dstx y:dsty
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2744
                              width:w height:h
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2745
                               with:aGCId
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2746
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2747
    "since XPutImage may allocate huge amount of stack space
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2748
     (some implementations use alloca), this must run with unlimited stack."
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2749
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2750
%{
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2751
    unsigned char fastBits[10000];
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2752
    unsigned char *b_bits = 0;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2753
    unsigned char *allocatedBits = 0;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2754
    unsigned char *__imageBits = 0;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2755
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2756
    if (__isByteArray(imageBits)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2757
        __imageBits = __ByteArrayInstPtr(imageBits)->ba_element;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2758
    } else if (__isExternalBytesLike(imageBits)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2759
        __imageBits = (unsigned char *)(__externalBytesAddress(imageBits));
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2760
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2761
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2762
    if (/* ISCONNECTED
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2763
     && */ __isExternalAddressLike(aGCId)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2764
     && __bothSmallInteger(srcx, srcy)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2765
     && __bothSmallInteger(dstx, dsty)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2766
     && __bothSmallInteger(w, h)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2767
     && __bothSmallInteger(imageWidth, imageHeight)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2768
     && __bothSmallInteger(imageDepth, bitsPerPixel)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2769
     && __isSmallInteger(padd)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2770
     && __imageBits)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2771
     {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2772
        struct
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2773
        {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2774
          BITMAPINFOHEADER bmiHeader;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2775
          DWORD r;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2776
          DWORD g;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2777
          DWORD b;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2778
        } bitmap;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2779
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2780
        HANDLE hDC = (HANDLE)(__externalAddressVal(aGCId));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2781
        HBITMAP hBitmap = _HBITMAPVAL(__INST(drawableId));
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2782
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2783
/*
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2784
        DDPRINTF(("hDC = %x\n", hDC));
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2785
*/
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2786
        if (__intVal(padd) != WIN32PADDING) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2787
            int row, col;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2788
            unsigned char *cp;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2789
            unsigned char *pBits;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2790
            int b_width, b_height, bytesPerRowST, bytesPerRowWN, padding, nBytes;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2791
            int bi = __intVal(bitsPerPixel);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2792
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2793
            b_width = __intVal(w);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2794
            b_height = __intVal(h);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2795
            bytesPerRowST = (b_width * bi + (__intVal(padd)-1)) / __intVal(padd);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2796
            bytesPerRowWN = (b_width * bi + (WIN32PADDING-1)) / WIN32PADDING * (WIN32PADDING/8);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2797
            padding = bytesPerRowWN - bytesPerRowST;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2798
            nBytes = b_height * bytesPerRowWN;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2799
            /*console_printf("padd %d bs %d bw %d p %d\n",__intVal(padd),bytesPerRowST,bytesPerRowWN,padding);*/
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2800
            if (padding) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2801
                if (nBytes < sizeof(fastBits)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2802
                    cp = b_bits = fastBits;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2803
                } else {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2804
                    cp = b_bits = allocatedBits = (unsigned char *) malloc(nBytes);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2805
                }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2806
                if (cp) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2807
                    pBits = __imageBits;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2808
                    for (row = b_height; row; row--) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2809
                        for (col = bytesPerRowST; col; col--) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2810
                            *cp++ = *pBits++;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2811
                        }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2812
                        cp += padding;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2813
                    }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2814
                } else
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2815
                    goto fail;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2816
            }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2817
        }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2818
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2819
        if (b_bits == 0) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2820
            b_bits = __imageBits;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2821
        }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2822
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2823
        bitmap.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2824
        bitmap.bmiHeader.biPlanes = 1;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2825
        if (__intVal(imageDepth) == 24) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2826
            /*bitmap.bmiHeader.biCompression = BI_BITFIELDS;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2827
            bitmap.r = 0xff0000;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2828
            bitmap.g = 0x00ff00;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2829
            bitmap.b = 0x0000ff;*/
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2830
            bitmap.bmiHeader.biCompression = BI_RGB;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2831
        } else if (__intVal(imageDepth) == 16) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2832
            /*bitmap.bmiHeader.biCompression = BI_RGB;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2833
            bitmap.bmiHeader.biCompression = BI_BITFIELDS;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2834
            bitmap.b = 0x001f;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2835
            bitmap.g = 0x07e0;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2836
            bitmap.r = 0xf800;*/
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2837
            bitmap.b = 0;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2838
            bitmap.g = 0;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2839
            bitmap.r = 0;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2840
            bitmap.bmiHeader.biCompression = BI_RGB;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2841
        }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2842
        bitmap.bmiHeader.biSizeImage = 0;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2843
        bitmap.bmiHeader.biXPelsPerMeter = 0;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2844
        bitmap.bmiHeader.biYPelsPerMeter = 0;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2845
        bitmap.bmiHeader.biClrUsed = 0;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2846
        bitmap.bmiHeader.biClrImportant = 0;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2847
        bitmap.bmiHeader.biWidth = __intVal(imageWidth);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2848
        bitmap.bmiHeader.biHeight = -(__intVal(imageHeight));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2849
        bitmap.bmiHeader.biBitCount = __intVal(bitsPerPixel);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2850
        /*console_printf("drawBits depth:%d bitsPerPixel:%d IW%d W:%d H:%d\n",__intVal(imageDepth),bitmap.bmiHeader.biBitCount,bitmap.bmiHeader.biWidth,__intVal(w),bitmap.bmiHeader.biHeight);*/
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2851
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2852
        SetDIBitsToDevice(hDC,__intVal(dstx),__intVal(dsty),
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2853
                              __intVal(w), __intVal(h),
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2854
                              __intVal(srcx), __intVal(srcy),
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2855
                              0,__intVal(h),
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2856
                              (void *)b_bits,
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2857
                              (BITMAPINFO*)&bitmap,DIB_RGB_COLORS);
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2858
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2859
/*
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2860
        SetDIBits(hDC,hBitmap,
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2861
                              0,__intVal(h),
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2862
                              (void *)b_bits,
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2863
                              (BITMAPINFO*)&bitmap,DIB_RGB_COLORS);
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2864
*/
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2865
/*
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2866
        StretchDIBits(hDC,
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2867
                      __intVal(dstx),(__intVal(dsty)),            //  x & y coord of destination upper-left corner
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2868
                      __intVal(w), __intVal(h),                 // width & height of destination rectangle
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2869
                      __intVal(srcx), __intVal(srcy),           // x & y coord of source upper-left corner
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2870
                      __intVal(w), __intVal(h),                 // width & height of source rectangle
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2871
                      (void *)b_bits,                           // bitmap bits
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2872
                      (BITMAPINFO*)&bitmap,                     // bitmap data
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2873
                      DIB_RGB_COLORS,                           // usage options
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2874
                      SRCCOPY                                   // raster operation code
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2875
        );
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2876
*/
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2877
        if (allocatedBits) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2878
            free(allocatedBits);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2879
        }
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2880
/*
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2881
#ifndef CACHE_LAST_DC
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2882
        _releaseDC(gcData);
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2883
#endif
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2884
*/
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2885
        RETURN ( true );
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2886
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2887
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2888
fail: ;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2889
/*
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2890
    PRINTF(("create temp bitmap FAILED!!!\n"));
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2891
*/
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2892
    if (allocatedBits) {
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2893
/*
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2894
        PRINTF(("freeing up temp bitmap bits ...\n"));
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2895
*/
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2896
        free(allocatedBits);
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2897
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2898
/*
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2899
#ifndef CACHE_LAST_DC
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2900
    if (hDC) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2901
        _releaseDC(gcData);
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2902
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2903
#endif
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2904
*/
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2905
%}
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2906
.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2907
    ^ false
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2908
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2909
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2910
setFunction:aFunctionSymbol in:aGCId
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2911
    "set alu function to be drawn with"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2912
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2913
    Transcript showCR: aFunctionSymbol printString.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2914
    function := aFunctionSymbol.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2915
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2916
"/%{  /* NOCONTEXT */
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2917
"/
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2918
"/    if (__isExternalAddress(aGCId)) {
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2919
"/        struct gcData *gcData = _GCDATA(aGCId);
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2920
"/        int fun = -1;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2921
"/        int bfun = -1;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2922
"/
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2923
"/        if (aFunctionSymbol == @symbol(copy)) {
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2924
"/            fun = R2_COPYPEN;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2925
"/            bfun = BITBLT_COPY;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2926
"/        } else if (aFunctionSymbol == @symbol(copyInverted)) {
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2927
"/            fun = R2_NOTCOPYPEN;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2928
"/            bfun = BITBLT_COPYINVERTED;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2929
"/        } else if (aFunctionSymbol == @symbol(xor)) {
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2930
"/            fun = R2_XORPEN;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2931
"/            bfun = BITBLT_XOR;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2932
"/        } else if (aFunctionSymbol == @symbol(and)) {
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2933
"/            fun = R2_MASKPEN;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2934
"/            bfun = BITBLT_AND;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2935
"/        } else if (aFunctionSymbol == @symbol(or)) {
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2936
"/            fun = R2_MERGEPEN;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2937
"/            bfun = BITBLT_OR;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2938
"/        }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2939
"/
2325
634b74929d2d *** empty log message ***
fm
parents: 2324
diff changeset
  2940
"/        if (fun
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2941
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2942
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2943
setGraphicsExposures:aBoolean in:aGCId
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2944
    "set or clear the graphics exposures flag"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2945
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2946
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2947
shiftBlue
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2948
    "return the number of valid bits in the red component."
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2949
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2950
"/    bitsRed isNil ifTrue:[
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2951
"/        "/ not a truecolor display
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2952
"/        ^ bitsPerRGB
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2953
"/    ].
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2954
"/    ^ bitsRed
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2955
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2956
     ^Display shiftBlue
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2957
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2958
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2959
shiftGreen
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2960
    "return the number of valid bits in the red component."
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2961
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2962
"/    bitsRed isNil ifTrue:[
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2963
"/        "/ not a truecolor display
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2964
"/        ^ bitsPerRGB
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2965
"/    ].
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2966
"/    ^ bitsRed
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2967
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2968
     ^Display shiftGreen
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2969
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2970
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2971
shiftRed
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2972
    "return the number of valid bits in the red component."
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2973
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2974
"/    bitsRed isNil ifTrue:[
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2975
"/        "/ not a truecolor display
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2976
"/        ^ bitsPerRGB
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2977
"/    ].
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2978
"/    ^ bitsRed
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2979
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2980
     ^Display shiftRed
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2981
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  2982
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2983
xgcForBitmap:aDrawableId
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2984
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2985
%{  /* NOCONTEXT */
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2986
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2987
    if (__isExternalAddress(aDrawableId)){
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2988
        BITMAP bitmap;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2989
        HBITMAP hBitmap = _HBITMAPVAL(aDrawableId);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2990
        HBITMAP memBM;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2991
        HANDLE compatibleDC, rootDC, hdcScreen;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2992
        HANDLE hDC = (HANDLE)(__externalAddressVal(__INST(gcId)));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2993
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2994
        if (! hBitmap) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2995
            RETURN (nil);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2996
        }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2997
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  2998
        if (GetObject(hBitmap, sizeof(bitmap), &bitmap)) {
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  2999
/*
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3000
            DDPRINTF(("bitmap info:%d\n", bitmap.bmBitsPixel));
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  3001
*/
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3002
        } else {
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  3003
/*
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3004
            DPRINTF(("noinfo returned for bitmap\n"));
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  3005
*/
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3006
            /* mhmh - can this happen ? */
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3007
            bitmap.bmBitsPixel = 1;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3008
        }
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  3009
/*
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3010
        gcData->hBitmap = hBitmap;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3011
        gcData->bitmapColorBitCount = bitmap.bmBitsPixel;
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  3012
*/
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  3013
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3014
        rootDC  = CreateDC("DISPLAY", NULL, NULL, NULL);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3015
        compatibleDC = CreateCompatibleDC(hDC);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3016
        SelectObject(compatibleDC, hBitmap);
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  3017
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  3018
   //     hdcScreen= CreateDC("NULL", NULL, NULL, NULL);
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  3019
   //       compatibleDC =  rootDC;
2325
634b74929d2d *** empty log message ***
fm
parents: 2324
diff changeset
  3020
   //     compatibleDC = CreateCompatibleDC(0);
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  3021
   //         compatibleDC = CreateCompatibleDC(hDC);
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  3022
   //     memBM = CreateCompatibleBitmap ( compatibleDC, bitmap.bmWidth, bitmap.bmHeight );
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  3023
   //     SelectObject ( compatibleDC, memBM );
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  3024
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3025
        RETURN (__MKOBJ(compatibleDC));
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  3026
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  3027
/*
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3028
        RETURN ( __MKOBJ(gcData) );
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  3029
*/
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  3030
    }
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  3031
    RETURN (nil);
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  3032
%}
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  3033
!
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  3034
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3035
xprimDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth padding:padd width:imageWidth height:imageHeight
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3036
                                  x:srcx y:srcy
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3037
                               into:ignoredDrawableId
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3038
                                  x:dstx y:dsty
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3039
                              width:w height:h
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3040
                               with:aDC
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3041
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3042
    "since XPutImage may allocate huge amount of stack space
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3043
     (some implementations use alloca), this must run with unlimited stack."
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3044
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3045
%{
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3046
    unsigned char fastBits[10000];
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3047
    unsigned char *b_bits = 0;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3048
    unsigned char *allocatedBits = 0;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3049
    unsigned char *__imageBits = 0;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3050
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3051
    if (__isByteArray(imageBits)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3052
        __imageBits = __ByteArrayInstPtr(imageBits)->ba_element;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3053
    } else if (__isExternalBytesLike(imageBits)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3054
        __imageBits = (unsigned char *)(__externalBytesAddress(imageBits));
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3055
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3056
2325
634b74929d2d *** empty log message ***
fm
parents: 2324
diff changeset
  3057
    if (/* ISCONNECTED
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3058
     && */  __isExternalAddressLike(aDC)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3059
     && __bothSmallInteger(srcx, srcy)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3060
     && __bothSmallInteger(dstx, dsty)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3061
     && __bothSmallInteger(w, h)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3062
     && __bothSmallInteger(imageWidth, imageHeight)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3063
     && __bothSmallInteger(imageDepth, bitsPerPixel)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3064
     && __isSmallInteger(padd)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3065
     && __imageBits)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3066
     {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3067
        HANDLE hDC = (HANDLE)(__externalAddressVal(aDC));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3068
        struct
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3069
        {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3070
          BITMAPINFOHEADER bmiHeader;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3071
          DWORD r;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3072
          DWORD g;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3073
          DWORD b;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3074
        } bitmap;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3075
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3076
        if (__intVal(padd) != WIN32PADDING) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3077
            int row, col;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3078
            unsigned char *cp;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3079
            unsigned char *pBits;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3080
            int b_width, b_height, bytesPerRowST, bytesPerRowWN, padding, nBytes;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3081
            int bi = __intVal(bitsPerPixel);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3082
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3083
            b_width = __intVal(w);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3084
            b_height = __intVal(h);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3085
            bytesPerRowST = (b_width * bi + (__intVal(padd)-1)) / __intVal(padd);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3086
            bytesPerRowWN = (b_width * bi + (WIN32PADDING-1)) / WIN32PADDING * (WIN32PADDING/8);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3087
            padding = bytesPerRowWN - bytesPerRowST;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3088
            nBytes = b_height * bytesPerRowWN;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3089
            /*console_printf("padd %d bs %d bw %d p %d\n",__intVal(padd),bytesPerRowST,bytesPerRowWN,padding);*/
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3090
            if (padding) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3091
                if (nBytes < sizeof(fastBits)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3092
                    cp = b_bits = fastBits;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3093
                } else {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3094
                    cp = b_bits = allocatedBits = (unsigned char *) malloc(nBytes);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3095
                }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3096
                if (cp) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3097
                    pBits = __imageBits;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3098
                    for (row = b_height; row; row--) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3099
                        for (col = bytesPerRowST; col; col--) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3100
                            *cp++ = *pBits++;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3101
                        }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3102
                        cp += padding;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3103
                    }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3104
                } else
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3105
                    goto fail;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3106
            }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3107
        }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3108
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3109
        if (b_bits == 0) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3110
            b_bits = __imageBits;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3111
        }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3112
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3113
        bitmap.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3114
        bitmap.bmiHeader.biPlanes = 1;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3115
        if (__intVal(imageDepth) == 24) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3116
            /*bitmap.bmiHeader.biCompression = BI_BITFIELDS;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3117
            bitmap.r = 0xff0000;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3118
            bitmap.g = 0x00ff00;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3119
            bitmap.b = 0x0000ff;*/
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3120
            bitmap.bmiHeader.biCompression = BI_RGB;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3121
        } else if (__intVal(imageDepth) == 16) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3122
            /*bitmap.bmiHeader.biCompression = BI_RGB;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3123
            bitmap.bmiHeader.biCompression = BI_BITFIELDS;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3124
            bitmap.b = 0x001f;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3125
            bitmap.g = 0x07e0;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3126
            bitmap.r = 0xf800;*/
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3127
            bitmap.b = 0;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3128
            bitmap.g = 0;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3129
            bitmap.r = 0;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3130
            bitmap.bmiHeader.biCompression = BI_RGB;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3131
        }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3132
        bitmap.bmiHeader.biSizeImage = 0;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3133
        bitmap.bmiHeader.biXPelsPerMeter = 0;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3134
        bitmap.bmiHeader.biYPelsPerMeter = 0;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3135
        bitmap.bmiHeader.biClrUsed = 0;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3136
        bitmap.bmiHeader.biClrImportant = 0;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3137
        bitmap.bmiHeader.biWidth = __intVal(imageWidth);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3138
        bitmap.bmiHeader.biHeight = -(__intVal(imageHeight));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3139
        bitmap.bmiHeader.biBitCount = __intVal(bitsPerPixel);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3140
        /*console_printf("drawBits depth:%d bitsPerPixel:%d IW%d W:%d H:%d\n",__intVal(imageDepth),bitmap.bmiHeader.biBitCount,bitmap.bmiHeader.biWidth,__intVal(w),bitmap.bmiHeader.biHeight);*/
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3141
        SetDIBitsToDevice(hDC,__intVal(dstx),__intVal(dsty),
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3142
                              __intVal(w), __intVal(h),
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3143
                              __intVal(srcx), __intVal(srcy),
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3144
                              0,__intVal(h),
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3145
                              (void *)b_bits,
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3146
                              (BITMAPINFO*)&bitmap,DIB_RGB_COLORS);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3147
        if (allocatedBits) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3148
            free(allocatedBits);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3149
        }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3150
        RETURN ( true );
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3151
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3152
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3153
fail: ;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3154
/*
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3155
    PRINTF(("create temp bitmap FAILED!!!\n"));
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3156
*/
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3157
    if (allocatedBits) {
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3158
/*
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3159
        PRINTF(("freeing up temp bitmap bits ...\n"));
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3160
*/
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3161
        free(allocatedBits);
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3162
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3163
%}
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3164
.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3165
    ^ false
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3166
! !
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3167
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3168
!WinPrinterContext methodsFor:'font stuff'!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3169
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3170
createFontFor:aFontName
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3171
    "a basic method for font allocation; this method allows
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3172
     any font to be aquired (even those not conforming to
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3173
     standard naming conventions, such as cursor, fixed or k14)"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3174
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3175
%{
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3176
    HGDIOBJ hFont;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3177
    char *fn;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3178
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3179
    if (__isString(aFontName) || __isSymbol(aFontName)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3180
        fn = __stringVal(aFontName);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3181
        if ((strcmp(fn, "fixed") == 0) || (strcmp(fn, "ANSI_FIXED_FONT") == 0)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3182
            hFont = GetStockObject(ANSI_FIXED_FONT);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3183
        } else if ((strcmp(fn, "variable") == 0) || (strcmp(fn, "ANSI_VAR_FONT") == 0)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3184
            hFont = GetStockObject(ANSI_VAR_FONT);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3185
        } else if ((strcmp(fn, "system") == 0) || (strcmp(fn, "SYSTEM_FONT") == 0)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3186
            hFont = GetStockObject(SYSTEM_FONT);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3187
        } else if ((strcmp(fn, "systemFixed") == 0) || (strcmp(fn, "SYSTEM_FIXED_FONT") == 0)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3188
            hFont = GetStockObject(SYSTEM_FIXED_FONT);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3189
        } else if ((strcmp(fn, "deviceDefault") == 0) || (strcmp(fn, "DEVICE_DEFAULT_FONT") == 0)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3190
            hFont = GetStockObject(DEVICE_DEFAULT_FONT);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3191
        } else {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3192
            hFont = GetStockObject(ANSI_FIXED_FONT);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3193
        }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3194
        if (hFont) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3195
            DPRINTF(("createFontFor:%s -> %x\n", fn, hFont));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3196
            RETURN ( __MKOBJ(hFont) );
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3197
        }
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3198
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3199
%}.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3200
    ^ nil
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3201
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3202
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3203
fontMetricsOf:fontId
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3204
    "return a fonts metrics info object"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3205
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3206
    |rawData info|
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3207
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3208
    rawData := Array new:15.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3209
    (self primFontMetricsOf:fontId hdc:gcId intoArray:rawData) isNil ifTrue:[
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3210
        self primitiveFailed.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3211
        ^ self
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3212
    ].
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3213
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3214
    rawData at:11 put:#'ms-ansi'.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3215
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3216
    info := DeviceWorkstation::DeviceFontMetrics new.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3217
    info
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3218
      ascent:(rawData at:1)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3219
      descent:(rawData at:2)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3220
      maxAscent:(rawData at:3)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3221
      maxDescent:(rawData at:4)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3222
      minWidth:(rawData at:5)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3223
      maxWidth:(rawData at:6)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3224
      avgWidth:(rawData at:7)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3225
      minCode:(rawData at:8)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3226
      maxCode:16rFFFF "(rawData at:9)"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3227
      direction:nil
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3228
      encoding:(rawData at:11).
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3229
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3230
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3231
    ^ info
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3232
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3233
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3234
getDefaultFont
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3235
    "return a default font id - used when class Font cannot
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3236
     find anything usable"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3237
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3238
     ^ self createFontFor:'fixed'
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3239
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3240
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3241
getFontWithFamily:familyString face:faceString
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3242
            style:styleArgString size:sizeArg encoding:encodingSym
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3243
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3244
    "try to get the specified font, if not available, try the next smaller
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3245
     font."
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3246
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3247
    |styleString theName theId xlatedStyle id spacing|
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3248
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3249
    styleString := styleArgString.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3250
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3251
    "special: if face is nil, allow access to X-fonts"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3252
    faceString isNil ifTrue:[
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3253
        sizeArg notNil ifTrue:[
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3254
            theName := familyString , '-' , sizeArg printString
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3255
        ] ifFalse:[
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3256
            theName := familyString
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3257
        ].
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3258
        theName isNil ifTrue:[
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3259
            "
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3260
             mhmh - fall back to the default font
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3261
            "
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3262
            theName := 'fixed'
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3263
        ].
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3264
        theId := self createFontFor:theName.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3265
        theId isNil ifTrue:[
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3266
            theId := self getDefaultFont
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3267
        ].
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3268
        ^ theId
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3269
    ].
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3270
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3271
    "/ spacing other than 'normal' is contained as last component
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3272
    "/ in style
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3273
    styleString notNil ifTrue:[
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3274
        ((styleString endsWith:'-narrow')
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3275
         or:[styleString endsWith:'-semicondensed']) ifTrue:[
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3276
            |i|
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3277
            i := styleString lastIndexOf:$-.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3278
            spacing := styleString copyFrom:(i+1).
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3279
            styleString := styleString copyTo:(i-1).
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3280
        ] ifFalse:[
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3281
            spacing := 'normal'.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3282
        ].
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3283
    ].
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3284
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3285
    xlatedStyle := styleString.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3286
    xlatedStyle notNil ifTrue:[
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3287
        xlatedStyle := xlatedStyle first asString
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3288
    ].
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3289
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3290
    id := self
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3291
            getFontWithFoundry:'*'
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3292
            family:familyString asLowercase
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3293
            weight:faceString
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3294
            slant:styleString "/ xlatedStyle
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3295
            spacing:spacing
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3296
            pixelSize:nil
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3297
            size:sizeArg
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3298
            registry:'*'
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3299
            encoding:encodingSym.
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3300
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3301
    id isNil ifTrue:[
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3302
        (encodingSym notNil and:[encodingSym ~= '*']) ifTrue:[
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3303
            "/ too stupid: encodings come in both cases
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3304
            "/
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3305
            id := self
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3306
                    getFontWithFoundry:'*'
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3307
                    family:familyString asLowercase
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3308
                    weight:faceString
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3309
                    slant:styleString "/ xlatedStyle
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3310
                    spacing:spacing
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3311
                    pixelSize:nil
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3312
                    size:sizeArg
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3313
                    registry:'*'
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3314
                    encoding:encodingSym asUppercase.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3315
            id isNil ifTrue:[
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3316
                id := self
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3317
                        getFontWithFoundry:'*'
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3318
                        family:familyString asLowercase
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3319
                        weight:faceString
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3320
                        slant:styleString "/ xlatedStyle
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3321
                        spacing:spacing
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3322
                        pixelSize:nil
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3323
                        size:sizeArg
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3324
                        registry:'*'
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3325
                        encoding:encodingSym asLowercase.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3326
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3327
                id isNil ifTrue:[
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3328
                    id := self
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3329
                            getFontWithFoundry:'*'
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3330
                            family:familyString asLowercase
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3331
                            weight:faceString asLowercase
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3332
                            slant:styleString asLowercase
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3333
                            spacing:spacing
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3334
                            pixelSize:nil
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3335
                            size:sizeArg
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3336
                            registry:'*'
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3337
                            encoding:encodingSym asLowercase.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3338
                ]
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3339
            ]
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3340
        ]
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3341
    ].
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3342
    ^ id
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3343
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3344
    "Modified: 24.2.1996 / 22:37:24 / cg"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3345
    "Modified: 4.7.1996 / 11:38:47 / stefan"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3346
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3347
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3348
getFontWithFoundry:foundry family:family weight:weight
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3349
              slant:slant spacing:spc pixelSize:pixelSize size:pointSize
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3350
              registry:registry encoding:encoding
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3351
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3352
    "get the specified font, if not available, return nil.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3353
     For now, this is a poor (incomplete) emulation of the X code ...
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3354
     Individual attributes can be left empty (i.e. '') or nil to match any.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3355
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3356
     foundry:   'adobe', 'misc', 'dec', 'schumacher' ... usually '*'
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3357
     family:    'helvetica' 'courier' 'times' ...
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3358
     weight:    'bold' 'medium' 'demi' ...
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3359
     slant:     'r(oman)' 'i(talic)' 'o(blique)'
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3360
     spacing:   'narrow' 'normal' semicondensed' ... usually '*'
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3361
     pixelSize: 16,18 ... usually left empty
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3362
     size:      size in point (1/72th of an inch)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3363
     registry:  iso8859, sgi ... '*'
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3364
     encoding:  vendor specific encoding (usually '*')
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3365
    "
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3366
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3367
    "
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3368
     Windows-NT/95 allows the creation of a font with the following parameters
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3369
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3370
        nHeight
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3371
        nWidth
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3372
        nEscapement
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3373
        nOrientation
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3374
        fnWeight        FW_DONTCARE, FW_NORMAL, FW_MEDIUM, FW_BOLD, ...
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3375
        fdwItalic       TRUE or FALSE
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3376
        fdwUnderline    TRUE or FALSE
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3377
        fdwStrikeOut    TRUE or FALSE
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3378
        fdwCharSet      ANSI_CHARSET, UNICODE_, SYMBOL_, SHIFTJIS_,...
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3379
        fdwOutputPrecision      DEFAULT, STRING, CHAR, ...
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3380
        fdwClipPrecision        DEFAULT, CHAR, STROKE, MASK, ...
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3381
        fdwQuality      DEFAULT, DRAFT, or PROOF.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3382
        fdwPitchAndFamily
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3383
                DEFAULT, FIXED or VARIABLE pitch
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3384
                DECORATIVE, DONTCASE, MODERN, ROMAN, SCRIPT, or SWISS.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3385
        lpszFace
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3386
                Typeface Name
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3387
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3388
      These two above descriptions will be matched as follows:
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3389
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3390
        foundry   - ignored
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3391
        family    - mapped to type face name.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3392
        weight    - mapped to fnWeight
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3393
        slant     - used for style
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3394
        spacing   - NOT USED INITIALLY
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3395
        pixelSize - NOT USED INITIALLY
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3396
        size      - mapped to nHeight
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3397
        registry  - NOT USED INITIALLY
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3398
        encoding  - mapped to fdwCharSet
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3399
     "
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3400
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3401
    |logSize|
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3402
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3403
    pixelSize notNil ifTrue:[
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3404
        logSize := pixelSize
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3405
    ] ifFalse:[
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3406
        logSize := (pointSize * (self getLogicalPixelSizeY) / 72.0) rounded.
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3407
    ].
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3408
%{
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3409
    HGDIOBJ hFont;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3410
    int  pointSize, nHeight, nWidth, nEscapement, nOrientation;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3411
    char* work;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3412
    char* work2;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3413
    DWORD fnWeight;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3414
    DWORD fdwItalic;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3415
    DWORD fdwUnderline;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3416
    DWORD fdwStrikeOut;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3417
    DWORD fdwCharSet;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3418
    DWORD fdwOutputPrecision;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3419
    DWORD fdwClipPrecision;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3420
    DWORD fdwQuality;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3421
    DWORD fdwPitchAndFamily;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3422
    static char faceName[256];
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3423
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3424
/* INITIALIZE */
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3425
    strcpy( faceName, "NULL" );
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3426
    nHeight   = 0;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3427
    nWidth   = 0;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3428
    nEscapement = 0;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3429
    nOrientation = 0;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3430
    fnWeight = FW_NORMAL;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3431
    fdwItalic = FALSE;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3432
    fdwUnderline = FALSE;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3433
    fdwStrikeOut = FALSE;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3434
    fdwOutputPrecision = OUT_DEFAULT_PRECIS;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3435
    fdwClipPrecision   = CLIP_DEFAULT_PRECIS;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3436
    fdwQuality         = DEFAULT_QUALITY;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3437
    fdwPitchAndFamily  = FF_DONTCARE;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3438
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3439
    fdwCharSet   = ANSI_CHARSET;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3440
    if ((encoding == @symbol('ms-ansi'))) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3441
        fdwCharSet   = ANSI_CHARSET;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3442
    } else if (encoding == @symbol('ms-default')) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3443
        fdwCharSet   = DEFAULT_CHARSET;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3444
    } else if ((encoding == @symbol('ms-symbol'))
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3445
            || (encoding == @symbol('misc-fontspecific'))) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3446
        fdwCharSet   = SYMBOL_CHARSET;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3447
    } else if ((encoding == @symbol('ms-shiftjis'))
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3448
            || (encoding == @symbol('jisx0208.1983-0'))){
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3449
        fdwCharSet   = SHIFTJIS_CHARSET;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3450
    } else if ((encoding == @symbol('ms-gb2312'))
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3451
            || (encoding == @symbol('gb2312.1980-0'))) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3452
        fdwCharSet   = GB2312_CHARSET;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3453
    } else if ((encoding == @symbol('ms-hangeul'))
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3454
            || (encoding == @symbol('ksc5601.1987-0'))) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3455
        fdwCharSet   = HANGEUL_CHARSET;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3456
    } else if ((encoding == @symbol('ms-chinesebig5'))
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3457
            || (encoding == @symbol('big5'))) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3458
        fdwCharSet   = CHINESEBIG5_CHARSET;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3459
    } else if (encoding == @symbol('ms-oem')) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3460
        fdwCharSet   = OEM_CHARSET;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3461
    } else if (encoding == @symbol('ms-johab')) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3462
        fdwCharSet   = JOHAB_CHARSET;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3463
    } else if ((encoding == @symbol('ms-hebrew'))
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3464
            || (encoding == @symbol('ms-cp1255'))) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3465
        fdwCharSet   = HEBREW_CHARSET;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3466
    } else if ((encoding == @symbol('ms-arabic'))
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3467
            || (encoding == @symbol('ms-cp1256'))) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3468
        fdwCharSet   = ARABIC_CHARSET;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3469
    } else if ((encoding == @symbol('ms-greek'))
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3470
            || (encoding == @symbol('ms-cp1253'))) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3471
        fdwCharSet   = GREEK_CHARSET;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3472
    } else if ((encoding == @symbol('ms-turkish'))
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3473
            || (encoding == @symbol('ms-cp1254'))) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3474
        fdwCharSet   = TURKISH_CHARSET;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3475
    } else if ((encoding == @symbol('ms-russian'))
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3476
            || (encoding == @symbol('ms-cp1251'))) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3477
        fdwCharSet   = RUSSIAN_CHARSET;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3478
    } else if ((encoding == @symbol('ms-easteurope'))
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3479
            || (encoding == @symbol('ms-cp1250'))) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3480
        fdwCharSet   = EASTEUROPE_CHARSET;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3481
    } else if ((encoding == @symbol('ms-baltic'))
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3482
            || (encoding == @symbol('ms-cp1257'))) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3483
        fdwCharSet   = BALTIC_CHARSET;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3484
    } else if ((encoding == @symbol('ms-vietnamese'))) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3485
        fdwCharSet   = VIETNAMESE_CHARSET;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3486
    } else if ((encoding == @symbol('ms-thai'))) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3487
        fdwCharSet   = THAI_CHARSET;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3488
    } else if ((encoding == @symbol('ms-mac'))) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3489
        fdwCharSet   = MAC_CHARSET;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3490
#ifdef UNICODE_CHARSET
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3491
    } else if ((encoding == @symbol('ms-unicode'))) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3492
        fdwCharSet   = UNICODE_CHARSET;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3493
#endif
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3494
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3495
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3496
    if ( __isString( family ) ) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3497
        work = __stringVal( family );
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3498
        if (strcmp( work, "nil" ) != 0 ) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3499
            strncpy( faceName, work, sizeof(faceName)-1 );
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3500
        }
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3501
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3502
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3503
    /* Q: should we allow those ? (they make ST/X programs less portable to X */
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3504
    if( __isString( weight ) ) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3505
        work = __stringVal( weight );
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3506
        if (strcmp( work, "bold" ) == 0 ) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3507
            fnWeight = FW_BOLD;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3508
        } else if (strcmp( work, "medium" ) == 0 ) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3509
            fnWeight = FW_MEDIUM;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3510
        } else if (strcmp( work, "normal" ) == 0 ) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3511
            fnWeight = FW_NORMAL;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3512
        } else if (strcmp( work, "light" ) == 0 ) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3513
            fnWeight = FW_LIGHT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3514
        } else if (strcmp( work, "demi" ) == 0 ) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3515
            fnWeight = FW_LIGHT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3516
        } else if (strcmp( work, "heavy" ) == 0 ) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3517
            fnWeight = FW_HEAVY;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3518
        } else if (strcmp( work, "extraBold" ) == 0 ) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3519
            fnWeight = FW_EXTRABOLD;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3520
        } else if (strcmp( work, "semiBold" ) == 0 ) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3521
            fnWeight = FW_SEMIBOLD;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3522
        } else if (strcmp( work, "thin" ) == 0 ) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3523
            fnWeight = FW_THIN;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3524
        } else if (strcmp( work, "extraLight" ) == 0 ) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3525
            fnWeight = FW_EXTRALIGHT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3526
        }
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3527
    } else if (__isSmallInteger(weight)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3528
        fnWeight = __intVal(weight);
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3529
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3530
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3531
    if(__isSmallInteger( logSize )) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3532
        nHeight = __intVal( logSize );
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3533
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3534
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3535
    if (__isString(slant)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3536
        work2 = __stringVal( slant );
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3537
        work  = __stringVal( slant );
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3538
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3539
        if (strncmp(work2, "italic", 6) == 0)  {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3540
            fdwItalic = TRUE;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3541
            if ( work2[6] == '-' )
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3542
                strncpy( work, &work2[7], ( strlen( work2) - 7) );
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3543
        } else {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3544
            if (strncmp(work2, "oblique", 7) == 0)  {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3545
                fdwItalic = TRUE;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3546
                if ( work2[7] == '-' )
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3547
                    strncpy( work, &work2[8], ( strlen( work2) - 8) );
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3548
            }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3549
        }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3550
        if (strncmp( work, "underline", 9 ) == 0 ) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3551
            fdwUnderline = TRUE;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3552
            if( work[10] == '-' )
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3553
                strncpy( work2, &work[11], ( strlen( work ) - 10 ) );
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3554
        }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3555
        if (strncmp( work2, "strikeOut", 9 ) == 0 ) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3556
            fdwStrikeOut = TRUE;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3557
        }
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3558
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3559
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3560
    DPRINTF(("CreateFont face:%s h=%d w=%d wght=%d\n",
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3561
                faceName, nHeight, nWidth, fnWeight));
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3562
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3563
    hFont = CreateFont( -nHeight,   /* character height - not cell height */
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3564
                        nWidth,
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3565
                        nEscapement,
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3566
                        nOrientation,
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3567
                        fnWeight,
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3568
                        fdwItalic,
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3569
                        fdwUnderline,
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3570
                        fdwStrikeOut,
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3571
                        fdwCharSet,
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3572
                        fdwOutputPrecision,
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3573
                        fdwClipPrecision,
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3574
                        fdwQuality,
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3575
                        fdwPitchAndFamily,
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3576
                        faceName );
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3577
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3578
    if (hFont != NULL) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3579
        DPRINTF(("createFont: %x\n", hFont));
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3580
/*
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3581
    #ifdef COUNT_RESOURCES
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3582
        __cnt_font++;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3583
        RES1PRINTF(("CreateFont %d\n", __cnt_font));
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3584
    #endif
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3585
*/
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3586
        RETURN ( __MKOBJ(hFont) );
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3587
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3588
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3589
    DPRINTF(("***** ERROR createFontWithFoundry failed ERROR *****\n" ));
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3590
%}.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3591
    ^ nil
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3592
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3593
    "
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3594
     Display getFontWithFoundry:'*'
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3595
                         family:'courier'
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3596
                         weight:'medium'
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3597
                          slant:'r'
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3598
                        spacing:nil
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3599
                      pixelSize:nil
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3600
                           size:13
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3601
                       registry:'iso8859'
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3602
                       encoding:'*'
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3603
    "
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3604
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3605
    "new NT Version: 20.2.1997 / 22:33:29 / dq"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3606
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3607
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3608
primFontMetricsOf:fontId hdc:aDC intoArray:rawData
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3609
    "evaluate aBlock, passing a fonts metrics as arguments.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3610
     fill passed array as:
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3611
      ascent     -> (data at:1)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3612
      descent    -> (data at:2)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3613
      maxAscent  -> (data at:3)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3614
      maxDescent -> (data at:4)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3615
      minWidth   -> (data at:5)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3616
      maxWidth   -> (data at:6)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3617
      avgWidth   -> (data at:7).
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3618
      minChar    -> (data at:8).
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3619
      maxChar    -> (data at:9).
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3620
      defaultChar-> (data at:10).
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3621
      charSet    -> (data at:11).
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3622
"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3623
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3624
%{
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3625
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3626
    if (__isExternalAddress(fontId)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3627
     && __isExternalAddressLike(aDC)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3628
     && __isArray(rawData)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3629
     && (__arraySize(rawData) >= 11)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3630
        SIZE size;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3631
        int avgWidth;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3632
        HGDIOBJ hFont;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3633
        HGDIOBJ prevFont;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3634
        TEXTMETRIC tmet;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3635
        static char *s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3636
        static int len;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3637
        OBJ t;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3638
        HANDLE hDC;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3639
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3640
        hFont = _HGDIOBJVal(fontId);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3641
        hDC = (HANDLE)(__externalAddressVal(aDC));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3642
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3643
        /*
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3644
         * temporarily set this font in the tmpDC (root-) context
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3645
         */
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3646
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3647
        prevFont = SelectObject(hDC, hFont);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3648
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3649
        GetTextMetricsW(hDC, &tmet);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3650
        if (len == 0) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3651
            len = strlen(s);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3652
        }
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3653
#if 0
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3654
        GetTextExtentPoint32(hDC, s, len, &size);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3655
        avgWidth = (size.cx / (len / 2) + 1) / 2;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3656
#else
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3657
        avgWidth = tmet.tmAveCharWidth;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3658
#endif
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3659
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3660
        __ArrayInstPtr(rawData)->a_element[0] = __MKSMALLINT(tmet.tmAscent);        /* ascent     -> (data at:1) */
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3661
        __ArrayInstPtr(rawData)->a_element[1] = __MKSMALLINT(tmet.tmDescent);       /* descent    -> (data at:2) */
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3662
        __ArrayInstPtr(rawData)->a_element[2] = __MKSMALLINT(tmet.tmAscent);        /* maxAscent  -> (data at:3) */
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3663
        __ArrayInstPtr(rawData)->a_element[3] = __MKSMALLINT(tmet.tmDescent);       /* maxDescent -> (data at:4) */
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3664
        __ArrayInstPtr(rawData)->a_element[4] = __MKSMALLINT(avgWidth);             /* minWidth   -> (data at:5) */
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3665
        __ArrayInstPtr(rawData)->a_element[5] = __MKSMALLINT(tmet.tmMaxCharWidth);  /* maxWidth   -> (data at:6) */
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3666
        __ArrayInstPtr(rawData)->a_element[6] = __MKSMALLINT(avgWidth);             /* avgWidth   -> (data at:7) */
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3667
        __ArrayInstPtr(rawData)->a_element[7] = __MKSMALLINT(tmet.tmFirstChar);     /* min        -> (data at:8) */
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3668
        __ArrayInstPtr(rawData)->a_element[8] = __MKSMALLINT(tmet.tmLastChar);      /* max        -> (data at:9) */
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3669
        __ArrayInstPtr(rawData)->a_element[9] = __MKSMALLINT(tmet.tmDefaultChar);   /* default    -> (data at:10) */
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3670
#if 0
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3671
        t = __charSetSymbolFor(tmet.tmCharSet);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3672
        __ArrayInstPtr(rawData)->a_element[10]= t; __STORE(rawData, t);             /* charSet    -> (data at:11) */
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3673
#endif
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3674
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3675
        DPRINTF(("textMetrics h=%x  avgAsc=%d avgDesc=%d minW=%d maxW=%d avgW=%d\n",
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3676
                    hFont, tmet.tmAscent, tmet.tmDescent, avgWidth, tmet.tmMaxCharWidth,
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3677
                    tmet.tmAveCharWidth));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3678
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3679
        SelectObject(hDC, prevFont);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3680
        RETURN (self);
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3681
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3682
    RETURN (nil);
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3683
%}
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3684
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3685
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3686
releaseFont:aFontId
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3687
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3688
%{  /* NOCONTEXT */
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3689
    if (__isExternalAddress(aFontId)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3690
        HGDIOBJ hFont = _HGDIOBJVal(aFontId);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3691
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3692
        if (hFont) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3693
           DPRINTF(("ReleaseFont: %x\n", hFont));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3694
           DeleteObject(hFont);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3695
        }
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3696
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3697
%}
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3698
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3699
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3700
setFont:aFontId in:aDC
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3701
    "set font to be drawn in"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3702
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3703
%{  /* NOCONTEXT */
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3704
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3705
    if (__isExternalAddressLike(aDC)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3706
     && __isExternalAddress(aFontId))
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3707
    {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3708
        HANDLE hDC = (HANDLE)(__externalAddressVal(aDC));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3709
        HGDIOBJ prevFont, hFont;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3710
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3711
        hFont = _HGDIOBJVal(aFontId);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3712
        prevFont = SelectObject(hDC, hFont);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3713
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3714
        RETURN ( self );
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3715
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3716
%}.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3717
    self primitiveFailed
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3718
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3719
    "Created: / 04-08-2006 / 12:32:53 / fm"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3720
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3721
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3722
widthOf:aString from:index1 to:index2 inFont:aFontId
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3723
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3724
%{  /* NOCONTEXT */
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3725
    unsigned char *cp;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3726
    int len, n, i1, i2, l;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3727
    OBJ cls;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3728
    int nInstBytes;
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3729
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3730
    if (__bothSmallInteger(index1, index2)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3731
     && __isExternalAddress(aFontId)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3732
     && __isExternalAddressLike(__INST(gcId))
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3733
     && __isNonNilObject(aString)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3734
        HGDIOBJ hFont,prevFont;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3735
        HANDLE hDC;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3736
        SIZE tsize;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3737
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3738
#ifndef PRE_22_FEP_2007
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3739
#       define N_QUICK_CHARS    1024
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3740
        unsigned short quickWchars[N_QUICK_CHARS];
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3741
        unsigned short *wcharPtr;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3742
        int mustFree = 0;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3743
        int i;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3744
#endif
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3745
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3746
        hFont = _HGDIOBJVal(aFontId);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3747
        hDC = (HANDLE)(__externalAddressVal(__INST(gcId)));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3748
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3749
        prevFont = SelectObject(hDC, hFont);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3750
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3751
        i1 = __intVal(index1) - 1;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3752
        cls = __qClass(aString);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3753
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3754
        if (i1 >= 0) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3755
            i2 = __intVal(index2) - 1;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3756
            if (i2 < i1) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3757
                RETURN ( __MKSMALLINT( 0 ) );
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3758
            }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3759
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3760
            cp = (char *) _stringVal(aString);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3761
            l = i2 - i1 + 1;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3762
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3763
            if ((cls == @global(String)) || (cls == @global(Symbol))) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3764
                n = _stringSize(aString);
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3765
    commonWidthChars:
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3766
                if (i2 < n) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3767
                    cp += i1;
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3768
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3769
#ifdef PRE_22_FEP_2007
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3770
                    GetTextExtentPoint32(hDC, cp, l, &tsize);
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3771
#else
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3772
                    if (l <= N_QUICK_CHARS) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3773
                        wcharPtr = quickWchars;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3774
                        mustFree = 0;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3775
                    } else {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3776
                        wcharPtr = malloc(sizeof(short)*l);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3777
                        if (! wcharPtr) RETURN (__MKSMALLINT(0));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3778
                        mustFree = 1;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3779
                    }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3780
                    for (i=0; i<l; i++) wcharPtr[i] = ((unsigned char *)cp)[i];
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3781
                    GetTextExtentPoint32W(hDC, wcharPtr, l, &tsize);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3782
                    if (mustFree) free(wcharPtr);
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3783
#endif
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3784
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3785
#ifdef SUPERDEBUG
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3786
                    if (__debug__) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3787
                        char buf[80];
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3788
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3789
                        GetTextFace(hDC,80,buf);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3790
                        console_printf("font1 %x %s >%s< l=%d dx=%d\n",hFont,buf,cp,l,tsize.cx);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3791
                    }
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3792
#endif
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3793
                    SelectObject(hDC, prevFont);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3794
                    RETURN ( __MKSMALLINT(tsize.cx) );
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3795
                }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3796
                RETURN (__MKSMALLINT(0));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3797
            }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3798
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3799
            nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3800
            cp += nInstBytes;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3801
            n = __byteArraySize(aString) - nInstBytes;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3802
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3803
            if (__isBytes(aString)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3804
                goto commonWidthChars;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3805
            }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3806
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3807
            /* Unicode */
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3808
            if (__isWords(aString)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3809
                n = n / 2;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3810
                if (i2 < n) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3811
                    WIDECHAR *w_cp = (WIDECHAR *)cp;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3812
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3813
                    w_cp += i1;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3814
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3815
                    GetTextExtentPoint32W(hDC, w_cp, l, &tsize);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3816
                    SelectObject(hDC, prevFont);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3817
                    RETURN ( __MKSMALLINT(tsize.cx) );
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3818
                }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3819
                RETURN (__MKSMALLINT(0));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3820
            }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3821
        }
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3822
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3823
%}.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3824
    self primitiveFailed.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3825
    ^ 0
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3826
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3827
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3828
widthOf:aString inFont:aFontId
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3829
    "return the width in pixels of a string in a specific font"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3830
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3831
    ^ self widthOf:aString from:1 to:(aString size) inFont:aFontId
2316
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
  3832
! !
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
  3833
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3834
!WinPrinterContext methodsFor:'initialization & release'!
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3835
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3836
createDC
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3837
    "Private - Create a device context for the receiver"
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
  3838
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3839
    gcId := printerInfo createDC
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3840
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3841
    "Created: / 27-07-2006 / 10:21:05 / fm"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3842
    "Modified: / 02-08-2006 / 17:30:47 / fm"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3843
    "Modified: / 10-10-2006 / 18:14:28 / cg"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3844
!
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3845
2315
026d4d8cfb1b changed #endPrintJob
fm
parents: 2313
diff changeset
  3846
deleteDC
026d4d8cfb1b changed #endPrintJob
fm
parents: 2313
diff changeset
  3847
    "Private - Delete a device context for the receiver"
026d4d8cfb1b changed #endPrintJob
fm
parents: 2313
diff changeset
  3848
026d4d8cfb1b changed #endPrintJob
fm
parents: 2313
diff changeset
  3849
    OperatingSystem deletePrinterDC: gcId.
026d4d8cfb1b changed #endPrintJob
fm
parents: 2313
diff changeset
  3850
!
026d4d8cfb1b changed #endPrintJob
fm
parents: 2313
diff changeset
  3851
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3852
destroy
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3853
    "Destroy the GC."
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3854
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3855
    |id|
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3856
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3857
    id := gcId.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3858
    id notNil ifTrue:[
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3859
        gcId := nil.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3860
        self deleteDC.
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3861
    ].
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3862
"/    Lobby unregister:self.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3863
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3864
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3865
destroyGC:aDC
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3866
%{
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3867
    if (__isExternalAddressLike(aDC)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3868
        HANDLE hDC = (HANDLE)(__externalAddressVal(aDC));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3869
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3870
        DeleteDC(hDC);
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3871
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3872
/*
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3873
#ifdef CACHE_LAST_DC
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3874
        if (lastGcData == gcData) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3875
            _releaseDC(gcData);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3876
        }
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3877
#endif
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3878
*/
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3879
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3880
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3881
%}
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3882
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3883
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3884
executor
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3885
    |aCopy|
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3886
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3887
    aCopy := WinWorkstation::PrinterDeviceContextHandle basicNew.
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3888
    aCopy setDevice:device id:nil gcId:gcId.
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3889
    ^ aCopy
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3890
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3891
    "Created: / 16-04-2007 / 12:39:02 / cg"
2315
026d4d8cfb1b changed #endPrintJob
fm
parents: 2313
diff changeset
  3892
!
026d4d8cfb1b changed #endPrintJob
fm
parents: 2313
diff changeset
  3893
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3894
initialize
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3895
    super initialize.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3896
"/    deviceForms := Registry new.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3897
"/    deviceColors := Registry new.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3898
    deviceFonts := CachingRegistry new cacheSize:10.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3899
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3900
2315
026d4d8cfb1b changed #endPrintJob
fm
parents: 2313
diff changeset
  3901
releaseDC
026d4d8cfb1b changed #endPrintJob
fm
parents: 2313
diff changeset
  3902
    "Private - Delete and clear the device context of the receiver."
026d4d8cfb1b changed #endPrintJob
fm
parents: 2313
diff changeset
  3903
026d4d8cfb1b changed #endPrintJob
fm
parents: 2313
diff changeset
  3904
    self deleteDC.
2316
1660bcf17d63 *** empty log message ***
fm
parents: 2315
diff changeset
  3905
"/    device close.
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3906
    gcId := nil.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3907
    self releaseDeviceFonts
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3908
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3909
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3910
releaseDeviceFonts
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3911
    deviceFonts isEmptyOrNil ifFalse:[
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3912
        deviceFonts do:[:afont |
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3913
            afont releaseFromDevice.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3914
        ].
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3915
    ].
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3916
    deviceFonts := CachingRegistry new cacheSize:10.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3917
! !
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3918
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3919
!WinPrinterContext methodsFor:'not supported yet'!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3920
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3921
displayAdvanceLineFrom:point1 to:point2
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3922
    "draw a line"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3923
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3924
    self displayAdvanceLineFromX:(point1 x) y:(point1 y)
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3925
                      toX:(point2 x) y:(point2 y)
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3926
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3927
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3928
displayAdvanceLineFromX:x0 y:y0 toX:x1 y:y1
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3929
    "draw a line (with current paint-color); apply transformation if nonNil"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3930
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3931
    |pX0 pY0 pX1 pY1 easy fgId bgId|
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3932
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3933
    gcId isNil ifTrue:[
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3934
        self initGC
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3935
    ].
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3936
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3937
    lineStyle == #doubleDashed ifTrue:[
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3938
        "
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3939
         if bgPaint or paint is not a real color, we have to do it the hard way ...
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3940
        "
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3941
        easy := true.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3942
        paint isColor ifFalse:[
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3943
            easy := false
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3944
        ] ifTrue:[
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3945
            fgId := paint colorId.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3946
            fgId isNil ifTrue:[
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3947
                easy := false
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3948
            ]
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3949
        ].
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3950
        bgPaint isColor ifFalse:[
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3951
            easy := false
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3952
        ] ifTrue:[
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3953
            bgId := bgPaint colorId.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3954
            bgId isNil ifTrue:[
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3955
                easy := false
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3956
            ]
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3957
        ].
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3958
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3959
        easy ifTrue:[
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3960
            ((foreground ~~ paint) or:[background ~~ bgPaint]) ifTrue:[
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3961
                device setForeground:fgId background:bgId in:gcId.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3962
                foreground := paint.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3963
                background := bgPaint.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3964
            ].
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3965
        ] ifFalse:[
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3966
            'DeviceGraphicsContext [warning]: cannot draw dashes with dithered colors' errorPrintCR
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3967
        ].
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3968
    ].
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3969
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3970
    transformation notNil ifTrue:[
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3971
        pX0 := transformation applyToX:x0.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3972
        pY0 := transformation applyToY:y0.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3973
        pX1 := transformation applyToX:x1.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3974
        pY1 := transformation applyToY:y1.
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3975
    ] ifFalse:[
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3976
        pX0 := x0.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3977
        pY0 := y0.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3978
        pX1 := x1.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  3979
        pY1 := y1
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3980
    ].
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3981
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3982
    pX0 := pX0 rounded.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3983
    pY0 := pY0 rounded.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3984
    pX1 := pX1 rounded.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3985
    pY1 := pY1 rounded.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3986
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3987
    device displayAdvanceLineFromX:pX0 y:pY0 toX:pX1 y:pY1 in:drawableId with:gcId
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3988
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3989
    "Modified: 10.1.1997 / 17:46:32 / cg"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3990
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3991
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3992
displayAdvanceLineFromX:x0 y:y0 toX:x1 y:y1 in:ignoredDrawableId with:aDC
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3993
    "draw a line. If the coordinates are not integers, an error is triggered."
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3994
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3995
    self getPenForMyContext.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3996
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3997
%{  /* NOCONTEXT */
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3998
    if (__isExternalAddressLike(aDC)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  3999
     && __bothSmallInteger(x0, y0)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4000
     && __bothSmallInteger(x1, y1)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4001
        HANDLE hDC = (HANDLE)(__externalAddressVal(aDC));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4002
        COLORREF fgColor;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4003
        int __x1 = __intVal(x1), __y1 = __intVal(y1);
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4004
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4005
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4006
/*      DPRINTF(("displayLine: %d/%d -> %d/%d\n",
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4007
                    __intVal(x0), __intVal(y0),
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4008
                    __x1, __y1));
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4009
*/
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4010
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4011
/*        fgColor = GetTextColor(hDC);
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4012
 *        hPen = CreatePen(PS_SOLID, 1, fgColor);
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4013
 */
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4014
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4015
        MoveToEx(hDC, __intVal(x0), __intVal(y0), NULL);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4016
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4017
        LineTo(hDC, __x1, __y1);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4018
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4019
        /*
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4020
         * end-point ...
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4021
         */
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4022
        LineTo(hDC, __x1+1, __y1);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4023
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4024
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4025
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4026
        RETURN ( self );
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4027
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4028
%}
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4029
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4030
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4031
getPenForMyContext
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4032
    "Get a pen for my context"
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4033
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4034
    |maskOriginX maskOriginY|
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4035
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4036
    self maskOrigin isNil ifFalse:[
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4037
        maskOriginX := self maskOrigin x.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4038
        maskOriginY := self maskOrigin y.
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4039
    ].
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4040
2325
634b74929d2d *** empty log message ***
fm
parents: 2324
diff changeset
  4041
%{
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4042
    HPEN hPen = 0;
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4043
    HPEN prevPen;
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4044
    LOGBRUSH Brush;
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4045
    COLORREF fgColor;
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4046
    HANDLE hDC = (HANDLE)(__externalAddressVal(__INST(gcId)));
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4047
    int lStyle, bkMode, hMask, maskOrgX, maskOrgY;
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4048
    int style, lineStyle, capStyle, joinStyle;
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4049
    int lw;
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4050
    int BK_TRANSPARENT;
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4051
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4052
    BK_TRANSPARENT = 1;
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4053
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4054
    lw= __INST(lineWidth);
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4055
/*    fgColor = __intVal(__INST(foreground)) & 0xffffff;     */
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4056
2325
634b74929d2d *** empty log message ***
fm
parents: 2324
diff changeset
  4057
    fgColor = GetTextColor(hDC);
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4058
    lineStyle=__INST(lineStyle);
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4059
    capStyle=__INST(capStyle);
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4060
    joinStyle=__INST(joinStyle);
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4061
    hMask= __INST(mask);
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4062
    maskOrgX=__intVal(maskOriginX);
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4063
    maskOrgY=__intVal(maskOriginY);
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4064
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4065
    if (lineStyle == @symbol(solid)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4066
        style = PS_SOLID;
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4067
    } else if (lineStyle == @symbol(dashed)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4068
        style= PS_DASH;
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4069
    } else if (lineStyle == @symbol(dotted)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4070
        style= PS_DOT;
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4071
    } else if (lineStyle == @symbol(dashDot)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4072
        style= PS_DASHDOT;
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4073
    } else if (lineStyle == @symbol(dashDotDot)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4074
        style= PS_DASHDOTDOT;
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4075
    } else
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4076
        style= PS_SOLID;
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4077
    lStyle &= ~PS_STYLE_MASK;
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4078
    lStyle |= style;
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4079
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4080
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4081
    if (capStyle == @symbol(round)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4082
        style = PS_ENDCAP_ROUND;
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4083
    } else if (capStyle == @symbol(square)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4084
        style = PS_ENDCAP_SQUARE;
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4085
    } else if (capStyle == @symbol(flat)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4086
        style = PS_ENDCAP_FLAT;
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4087
    } else
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4088
        style = PS_ENDCAP_FLAT;
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4089
    lStyle &= ~PS_ENDCAP_MASK;
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4090
    lStyle |= style;
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4091
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4092
    if (joinStyle == @symbol(bevel)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4093
        style = PS_JOIN_BEVEL;
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4094
    } else if (joinStyle == @symbol(miter)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4095
        style = PS_JOIN_MITER;
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4096
    } else if (joinStyle == @symbol(round)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4097
        style = PS_JOIN_ROUND;
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4098
    } else
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4099
        style = PS_JOIN_MITER;
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4100
    lStyle &= ~PS_JOIN_MASK;
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4101
    lStyle |= style;
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4102
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4103
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4104
    if (((lStyle & PS_STYLE_MASK) == PS_SOLID)
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4105
     && (hMask == 0)
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4106
     && (lw /* lineWidth */ <= 1)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4107
        if (fgColor == 0 /* BlackPixel */ ) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4108
            hPen = GetStockObject(BLACK_PEN);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4109
            prevPen = SelectObject(hDC, hPen);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4110
            RETURN( hPen );
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4111
        }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4112
        if (fgColor == 1 /* WhitePixel */) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4113
            hPen = GetStockObject(WHITE_PEN);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4114
            prevPen = SelectObject(hDC, hPen);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4115
            RETURN( hPen );
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4116
        }
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4117
    }
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4118
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4119
    hPen = (HPEN) 0;
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4120
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4121
    if (0 /* __isWinNT */) {
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4122
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4123
        if (lw == 0) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4124
            lw = 1;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4125
        }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4126
        /*
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4127
         * NT supports masked drawing with any lineStyle,
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4128
         * and also non-solid lines with any lineWidth.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4129
         */
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4130
        if (hMask) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4131
            Brush.lbStyle = BS_PATTERN;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4132
            Brush.lbHatch = (DWORD)hMask;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4133
            Brush.lbColor = fgColor;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4134
        } else {
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4135
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4136
#ifndef PRE_07_APR_04
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4137
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4138
            hPen = CreatePen((lStyle & PS_STYLE_MASK), lw, fgColor);
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4139
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4140
/*            RESPRINTF(("CreatePen %x %d(%d) %x %x\n",
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4141
 *                       lStyle,
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4142
 *                       lw, __INST(lineWidth),
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4143
 *                       fgColor, hMask));
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4144
 */
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4145
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4146
            SetBkMode(hDC, TRANSPARENT);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4147
            bkMode = BK_TRANSPARENT;
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4148
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4149
#else
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4150
            Brush.lbStyle = BS_SOLID;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4151
            Brush.lbHatch = 0;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4152
            Brush.lbColor = fgColor;
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4153
#endif
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4154
        }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4155
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4156
        if (! hPen)
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4157
        {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4158
            hPen = ExtCreatePen(PS_GEOMETRIC | lStyle,
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4159
                            lw, /* lineWidth, */
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4160
                            &Brush,
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4161
                            0, 0);
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4162
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4163
/*            RESPRINTF(("ExtCreatePen1 %x %d(%d) %x %x\n",
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4164
 *                       lStyle,
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4165
 *                       lw, __INST(lineWidth),
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4166
 *                       fgColor, hMask));
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4167
 */
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4168
            if (hMask) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4169
                SetBrushOrgEx(hDC, maskOrgX, maskOrgY, 0);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4170
            }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4171
        }
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4172
    } else {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4173
        /*
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4174
         * W95 only supports masked drawing with SOLID lines
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4175
         * also, we should use COSMETIC pens if possible
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4176
         * with non-solid lineStyles.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4177
         */
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4178
        if ((lStyle & PS_STYLE_MASK) == PS_SOLID) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4179
            int ps = PS_GEOMETRIC;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4180
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4181
            if (hMask) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4182
                Brush.lbStyle = BS_PATTERN;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4183
                Brush.lbHatch = (DWORD)hMask;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4184
                Brush.lbColor = fgColor;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4185
            } else {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4186
                Brush.lbStyle = BS_SOLID;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4187
                Brush.lbHatch = 0;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4188
                Brush.lbColor = fgColor;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4189
                if (lw /* lineWidth */ <= 1) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4190
                    ps = PS_COSMETIC;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4191
                }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4192
            }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4193
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4194
            hPen = ExtCreatePen(ps | lStyle,
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4195
                                lw, /* lineWidth */
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4196
                                &Brush,
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4197
                                0, 0);
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4198
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4199
/*            RESPRINTF(("ExtCreatePen1 %x %d %x %x\n",
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4200
 *                           lStyle,
2325
634b74929d2d *** empty log message ***
fm
parents: 2324
diff changeset
  4201
 *                           lw,
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4202
 *                           fgColor, hMask));
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4203
 */
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4204
            if (hMask) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4205
                SetBrushOrgEx(hDC, maskOrgX, maskOrgY, 0);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4206
            }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4207
        } else {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4208
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4209
            if (lw == 1) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4210
                lw = 0;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4211
            }
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4212
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4213
            /*
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4214
             * dashes only supported with lineWidth 0
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4215
             */
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4216
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4217
            hPen = CreatePen((lStyle & PS_STYLE_MASK),
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4218
                             lw,
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4219
                             fgColor);
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4220
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4221
/*            RESPRINTF(("CreatePen %x %d %x\n",
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4222
 *                               (lStyle & PS_STYLE_MASK),
2325
634b74929d2d *** empty log message ***
fm
parents: 2324
diff changeset
  4223
 *                               lw,
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4224
 *                               fgColor));
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4225
 */
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4226
            //
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4227
            // CG: wrong; must set to opaque, if doubleDashed
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4228
            //
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4229
            SetBkMode(hDC, TRANSPARENT);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4230
            bkMode = BK_TRANSPARENT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4231
        }
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4232
    }
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4233
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4234
    prevPen = SelectObject(hDC, hPen);
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4235
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4236
    RETURN (hPen);
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4237
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4238
%}
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4239
!
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4240
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4241
xxdisplayLineFromX:x0 y:y0 toX:x1 y:y1 in:ignoredDrawableId with:aDC
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4242
    "draw a line. If the coordinates are not integers, an error is triggered."
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4243
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4244
    |pen|
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4245
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4246
    pen := self getPenForMyContext.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4247
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4248
%{  /* NOCONTEXT */
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4249
    if (__isExternalAddressLike(aDC)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4250
     && __bothSmallInteger(x0, y0)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4251
     && __bothSmallInteger(x1, y1)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4252
        HANDLE hDC = (HANDLE)(__externalAddressVal(aDC));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4253
        COLORREF fgColor;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4254
        HANDLE prevPen, hPen;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4255
        int __x1 = __intVal(x1), __y1 = __intVal(y1);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4256
                                                                          /*  Obtaining Pen  */
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4257
        int style, styleInt, lineWidth;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4258
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4259
        lineWidth= __INST(lineWidth);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4260
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4261
        if (__INST(lineStyle) == @symbol(solid)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4262
            style= PS_SOLID;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4263
        } else if (__INST(lineStyle) == @symbol(dashed)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4264
            style= PS_DASH;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4265
        } else if (__INST(lineStyle) == @symbol(dotted)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4266
            style= PS_DOT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4267
        } else if (__INST(lineStyle) == @symbol(dashDot)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4268
            style= PS_DASHDOT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4269
        } else if (__INST(lineStyle) == @symbol(dashDotDot)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4270
            style= PS_DASHDOTDOT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4271
        } else
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4272
            style= PS_SOLID;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4273
        styleInt &= ~PS_STYLE_MASK;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4274
        styleInt |= style;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4275
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4276
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4277
        if (__INST(capStyle) == @symbol(round)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4278
            style= PS_ENDCAP_ROUND;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4279
        } else if (__INST(capStyle) == @symbol(square)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4280
            style= PS_ENDCAP_SQUARE;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4281
        } else if (__INST(capStyle) == @symbol(flat)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4282
            style= PS_ENDCAP_FLAT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4283
        } else
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4284
            style= PS_ENDCAP_FLAT;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4285
        styleInt &= ~PS_ENDCAP_MASK;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4286
        styleInt |= style;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4287
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4288
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4289
        if (__INST(joinStyle) == @symbol(bevel)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4290
            style= PS_JOIN_BEVEL;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4291
        } else if (__INST(joinStyle) == @symbol(miter)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4292
            style= PS_JOIN_MITER;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4293
        } else if (__INST(joinStyle) == @symbol(round)) {
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4294
            style= PS_JOIN_ROUND;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4295
        } else
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4296
            style= PS_JOIN_MITER;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4297
        styleInt &= ~PS_JOIN_MASK;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4298
        styleInt |= style;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4299
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4300
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4301
        fgColor = GetTextColor(hDC);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4302
        hPen = CreatePen((styleInt & PS_STYLE_MASK), lineWidth, fgColor);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4303
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4304
                                                                             /*  Finish Obtaining Pen  */
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4305
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4306
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4307
/*      DPRINTF(("displayLine: %d/%d -> %d/%d\n",
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4308
                    __intVal(x0), __intVal(y0),
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4309
                    __x1, __y1));
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4310
*/
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4311
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4312
        prevPen = SelectObject(hDC, hPen);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4313
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4314
        MoveToEx(hDC, __intVal(x0), __intVal(y0), NULL);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4315
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4316
        LineTo(hDC, __x1, __y1);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4317
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4318
        /*
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4319
         * end-point ...
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4320
         */
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4321
        LineTo(hDC, __x1+1, __y1);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4322
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4323
        SelectObject(hDC, prevPen);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4324
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4325
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4326
        RETURN ( self );
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4327
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4328
%}
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4329
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4330
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4331
xxxdisplayLineFromX:x0 y:y0 toX:x1 y:y1 in:ignoredDrawableId with:aDC
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4332
    "draw a line. If the coordinates are not integers, an error is triggered."
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4333
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4334
    |penHandle|
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4335
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4336
    penHandle := ExternalBytes address: self getPenForMyContext.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4337
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4338
%{  /* NOCONTEXT */
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4339
    if (__isExternalAddressLike(aDC)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4340
     && __isExternalAddressLike(penHandle)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4341
     && __bothSmallInteger(x0, y0)
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4342
     && __bothSmallInteger(x1, y1)) {
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4343
        HANDLE hDC = (HANDLE)(__externalAddressVal(aDC));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4344
        HANDLE hPen = (HANDLE)(__externalAddressVal(penHandle));
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4345
        COLORREF fgColor;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4346
        HANDLE prevPen;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4347
        int __x1 = __intVal(x1), __y1 = __intVal(y1);
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4348
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4349
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4350
/*      DPRINTF(("displayLine: %d/%d -> %d/%d\n",
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4351
                    __intVal(x0), __intVal(y0),
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4352
                    __x1, __y1));
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4353
*/
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4354
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4355
/*        fgColor = GetTextColor(hDC);
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4356
 *        hPen = CreatePen(PS_SOLID, 1, fgColor);
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4357
 */
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4358
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4359
        prevPen = SelectObject(hDC, hPen);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4360
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4361
        MoveToEx(hDC, __intVal(x0), __intVal(y0), NULL);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4362
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4363
        LineTo(hDC, __x1, __y1);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4364
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4365
        /*
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4366
         * end-point ...
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4367
         */
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4368
        LineTo(hDC, __x1+1, __y1);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4369
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4370
        SelectObject(hDC, prevPen);
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4371
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4372
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4373
        RETURN ( self );
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4374
    }
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4375
%}
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4376
! !
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4377
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4378
!WinPrinterContext methodsFor:'printing process'!
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4379
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4380
endPage
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4381
    "Informs device that we are finished writing to a page."
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
  4382
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4383
    (OperatingSystem endPage:gcId) > 0 ifFalse:[
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4384
        self error
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4385
    ]
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4386
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4387
    "Created: / 27-07-2006 / 18:20:48 / fm"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4388
    "Modified: / 01-08-2006 / 16:01:34 / fm"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4389
    "Modified: / 10-10-2006 / 18:14:44 / cg"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4390
!
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4391
2315
026d4d8cfb1b changed #endPrintJob
fm
parents: 2313
diff changeset
  4392
endPrintJobWithoutRelease
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4393
    "End the print job.  Everything drawn between startPrintJob
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4394
     and endPrintJob will become one entry in the print queue."
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
  4395
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4396
    |result|
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4397
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4398
    self endPage.
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4399
    result := OperatingSystem endDoc:gcId.
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4400
    jobid := nil.
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4401
    result >= 0 ifFalse:[ self error ]
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4402
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4403
    "Created: / 27-07-2006 / 18:21:04 / fm"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4404
    "Modified: / 01-08-2006 / 16:01:38 / fm"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4405
    "Modified: / 10-10-2006 / 18:50:43 / cg"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4406
!
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4407
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4408
startPage
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4409
    "Starts a page."
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
  4410
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4411
    (OperatingSystem startPage:gcId) > 0 ifFalse:[
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4412
        ^ self error
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4413
    ].
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4414
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4415
    "Created: / 27-07-2006 / 18:25:55 / fm"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4416
    "Modified: / 28-07-2006 / 18:19:04 / fm"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4417
    "Modified: / 10-10-2006 / 18:19:02 / cg"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4418
!
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4419
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
  4420
startPrintJob:aString fileName:aFileName
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4421
    "Start a print job, using aString as the job title; everything
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4422
     drawn between startPrintJob and endPrintJob will become
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4423
     one entry in the print queue."
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
  4424
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4425
    |docInfoStruct nameAddress title fileNameAddress|
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4426
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4427
    gcId isNil ifTrue:[
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4428
        self buildPrinter
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4429
    ].
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4430
    abort := false.
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4431
    title := aString ? 'Smalltalk/X'.
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4432
    nameAddress := title asExternalBytes unprotectFromGC.
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4433
    aFileName isNil ifFalse:[
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4434
        fileNameAddress := aFileName pathName asExternalBytes unprotectFromGC
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4435
    ].
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4436
    docInfoStruct := Win32OperatingSystem::DocInfoStructure new.
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4437
    docInfoStruct
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4438
        cbSize:docInfoStruct sizeInBytes;
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4439
        lpszDocName:nameAddress address.
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4440
    fileNameAddress isNil ifFalse:[
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4441
        docInfoStruct lpszOutput:fileNameAddress address
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4442
    ].
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4443
    jobid := OperatingSystem startDoc:gcId docInfo:docInfoStruct.
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4444
    jobid > 0 ifFalse:[
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4445
        jobid = -1 ifTrue:[
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4446
            abort := true.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4447
            ^ nil
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4448
        ].
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4449
        ^ self error
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4450
    ].
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4451
    self startPage
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4452
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4453
    "Created: / 27-07-2006 / 18:19:31 / fm"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4454
    "Modified: / 03-08-2006 / 15:11:19 / fm"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4455
    "Modified: / 10-10-2006 / 18:20:01 / cg"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4456
! !
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4457
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4458
!WinPrinterContext methodsFor:'queries'!
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4459
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4460
hasGrayscales
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4461
    "return true, if this workstation supports grayscales
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4462
     (also true for color displays)"
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4463
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4464
    ^ true
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4465
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4466
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4467
isOpen
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4468
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4469
    ^ gcId notNil
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4470
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4471
2324
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4472
isPersistentInSnapshot
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4473
    "return true, if resources on this device are to be made
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4474
     persistent in a snapshot image."
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4475
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4476
    ^ false
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4477
!
5065edb4f5bd *** empty log message ***
fm
parents: 2323
diff changeset
  4478
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4479
supportsColor
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4480
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4481
"/    | retVal info |
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4482
"/
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4483
"/    info := (self class getPrinterInformation: self name) asUppercase.
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4484
"/    (info includesSubstring: ',PSCRIPT,')
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4485
"/    ifTrue: [
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4486
"/        retVal := (DAPASX::DapasSystemInfo getYesNoInfoApp: 'Printer' profile: 'PostScriptBlackWhite') not.
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4487
"/    ]
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4488
"/    ifFalse: [
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4489
"/        retVal := (info includesSubstring: 'PDF')
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4490
"/            ifTrue: [true]
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4491
"/            ifFalse: [self numberOfColorBitsPerPixel > 1].
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4492
"/    ].
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4493
"/
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4494
"/    ^retVal
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4495
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4496
    ^ false.
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4497
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4498
    "Created: / 03-08-2006 / 09:55:26 / fm"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4499
    "Modified: / 04-08-2006 / 13:20:40 / fm"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4500
    "Modified: / 10-10-2006 / 18:21:07 / cg"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4501
!
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4502
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4503
supportsGraphics
2301
135f21a3d127 refactorred OS-independent stuff
Claus Gittinger <cg@exept.de>
parents: 2299
diff changeset
  4504
    ^(OperatingSystem getDeviceCaps: gcId index: 2 "Technology") ~= 4
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4505
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4506
    "Created: / 03-08-2006 / 10:07:43 / fm"
2301
135f21a3d127 refactorred OS-independent stuff
Claus Gittinger <cg@exept.de>
parents: 2299
diff changeset
  4507
    "Modified: / 16-04-2007 / 12:44:03 / cg"
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4508
! !
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4509
2323
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4510
!WinPrinterContext methodsFor:'registration'!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4511
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4512
registerFont:aFont
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4513
    deviceFonts register:aFont.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4514
!
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4515
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4516
unregisterFont:aFont
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4517
    deviceFonts unregister:aFont.
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4518
! !
c038faba10bf printing in context (without device)
fm
parents: 2317
diff changeset
  4519
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4520
!WinPrinterContext methodsFor:'text printing'!
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4521
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
  4522
stringWidthOf:aString at:index
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4523
    "Return the width of aString up to index
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4524
     when written using the current font; expand tabs out
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4525
     to 4 spaces for calculations"
2317
c9bf3bf3c014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2316
diff changeset
  4526
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4527
    |answer str size spaceWidth|
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4528
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4529
    index <= 0 ifTrue:[ ^ 0 ].
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4530
    str := index >= aString size ifTrue:[ aString ] ifFalse:[ aString copyFrom:1 to:index ].
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4531
    true "self font isNil" ifTrue:[
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4532
        "if font not set yet, calculate based on default font"
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4533
        "/            extString := str asExternalString.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4534
        size := Win32OperatingSystem::WinPointStructure new.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4535
        (OperatingSystem
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4536
            getTextExtentPoint:gcId
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4537
            string:str
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4538
            size:size) ifFalse:[ ^ self error ].
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4539
        answer := size x.
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4540
"/        Transcript showCR: 'FROM PRIM ******* ', str, '   ',  answer printString.
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4541
"/        Transcript showCR: 'FROM DEVICE ***** ', str, '   ',(self font widthOf:str on:self device) printString.
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4542
        #TODO.
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4543
    ] ifFalse:[
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4544
        answer := self font widthOf:str on:self device
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4545
    ].
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4546
    index > aString size ifTrue:[
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4547
        spaceWidth := self font widthOf:Character space on:self device.
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4548
        answer := answer + ((index - aString size) * spaceWidth)
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4549
    ].
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4550
    ^ answer.
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4551
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4552
    "Created: / 03-08-2006 / 10:27:20 / fm"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4553
    "Modified: / 04-08-2006 / 12:27:26 / fm"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4554
    "Modified: / 10-10-2006 / 18:20:43 / cg"
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4555
! !
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4556
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4557
!WinPrinterContext class methodsFor:'documentation'!
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4558
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4559
version
2327
32f68e607e13 + displayString supports color
fm
parents: 2326
diff changeset
  4560
    ^ '$Header: /cvs/stx/stx/libview2/WinPrinterContext.st,v 1.12 2007-04-25 10:25:38 fm Exp $'
2299
b0576a106d03 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4561
! !