Jspice3
hcopy.c File Reference
#include "spice.h"
#include "sced.h"
#include "scedmacs.h"
#include "plotext.h"
#include <time.h>
Include dependency graph for hcopy.c:

Go to the source code of this file.

Functions

static void hcpy_display ()
 
static void init_window ()
 
static void init_hc_viewport ()
 
void Hcopy ()
 
static void hcpy_display (GRAPH *graph)
 
static void init_window (long X, long Y, long Width, long HalfHeight)
 

Variables

char * MenuHCOPY
 

Function Documentation

void Hcopy ( )

Definition at line 36 of file hcopy.c.

38 {
41 
45 
47  InitViewport();
51 }
static void hcpy_display()
void CenterFullView()
Definition: init.c:466
void InitViewport()
Definition: init.c:358
int kpDoingHardcopy
Definition: sced.h:287
void MenuDeselect()
#define NULL
Definition: spdefs.h:121
struct kp Parameters
Definition: init.c:19
#define True
Definition: scedstub.c:16
void RedisplaySCED()
GRAPH * currentgraph
Definition: graphdb.c:21
void(* redraw)()
Definition: ftegraph.h:70
#define False
Definition: scedstub.c:15
void MenuSelect()
void ft_hardcopy()
char * MenuHCOPY
Definition: scedintr.c:80
static void hcpy_display ( )
static
static void hcpy_display ( GRAPH graph)
static

Definition at line 55 of file hcopy.c.

58 {
59  int i;
60  long L,B,R,T;
61  long VPmaxX,VPmaxY,MidX,Wid,Hei;
62  double Ratio;
63  int scale,Margin;
64  int Leg;
65  char OldControl;
66  char buf[64];
67 
68  PushGraphContext(graph);
69  OldControl = Parameters.kpRedisplayControl;
71 
73 
74  if (Not CDBB(Parameters.kpCellDesc,(struct o *)NULL,&L,&B,&R,&T))
75  MallocFailed();
76 
77 if (!strcmp(dispdev->name,"wp")) {
78  init_window((R+L)/2,(T+B)/2,(R-L)+(R-L)/10,((T-B)+(T-B)/10)/2);
79 
81  Parameters.kpRedisplayControl = OldControl;
83  return;
84 }
85 
86  /* scale for text */
87  scale = 2400/graph->absolute.width;
88  if (scale == 1) Parameters.kpHardcopyTextScale = 4; /* 300dpi */
89  else if (scale == 2) Parameters.kpHardcopyTextScale = 2; /* 150dpi */
90  else Parameters.kpHardcopyTextScale = 1; /* 75,100dpi */
91 
92  TPush();
93  TIdentity();
94  if ((R-L) > (T-B)) {
95  TRotate(0L,1L);
96  TPoint(&L,&B);
97  TPoint(&R,&T);
98  if (L > R) SwapInts(L,R);
99  if (B > T) SwapInts(T,B);
100  }
101  else TIdentity();
102  TPremultiply();
103  TStore();
104 
105  Leg = 3*graph->fontheight;
106  VPmaxY = graph->absolute.height - Leg - 1;
107  VPmaxX = graph->absolute.width - 1;
108 
109  if (((double)(T-B))/(R-L) >
110  ((double)VPmaxY)/VPmaxX) {
111 
112  Ratio = ((double)(T-B))/VPmaxY;
113  Hei = (long)(.5 + (double)(T-B + Leg*Ratio)/2);
114  Wid = VPmaxX*Ratio;
115  }
116  else {
117  Ratio = ((double)(R-L))/VPmaxX;
118  Hei = (VPmaxY+Leg)*Ratio/2;
119  Wid = R-L;
120  T = (T+B + Ratio*VPmaxY)/2;
121  }
122  init_window((R+L)/2,T - Hei,Wid,Hei);
123 
125 
126  sprintf(buf,"Circuit: %s",Parameters.kpCellName);
127  DevText(buf,0,currentgraph->fontheight*3/2);
129 
130  TPop();
131  TStore();
132  Parameters.kpRedisplayControl = OldControl;
133  PopGraphContext();
134 }
static void init_window()
static char buf[MAXPROMPT]
Definition: arg.c:18
void TPoint()
void Redisplay()
struct ka * kvCoarseWindow
Definition: sced.h:149
struct graph::@2 absolute
#define COARSEVIEWPORTONLY
Definition: sced.h:51
void DevText()
char * name
Definition: plotdev.h:60
struct s * kpCellDesc
Definition: sced.h:207
#define Not
Definition: cdmacs.h:16
DISPDEVICE * dispdev
Definition: display.c:112
char * kpCellName
Definition: sced.h:210
char * datestring()
Definition: time.c:37
int height
Definition: ftegraph.h:45
char kpRedisplayControl
Definition: sced.h:312
#define L
Definition: parse.c:442
int kpHardcopyTextScale
Definition: sced.h:290
void TStore()
Definition: xforms.c:331
void MallocFailed()
Definition: scedintr.c:857
#define R
Definition: parse.c:444
void PushGraphContext()
#define NULL
Definition: spdefs.h:121
struct kp Parameters
Definition: init.c:19
static void init_hc_viewport()
Definition: hcopy.c:157
void TPremultiply()
Definition: xforms.c:216
int fontheight
Definition: ftegraph.h:82
void TRotate()
struct kv * View
Definition: init.c:17
Definition: cddefs.h:142
void PopGraphContext()
Definition: graphdb.c:270
void TIdentity()
Definition: xforms.c:189
int CDBB()
GRAPH * currentgraph
Definition: graphdb.c:21
int width
Definition: ftegraph.h:45
void TPop()
Definition: xforms.c:64
void TPush()
Definition: xforms.c:53
#define SwapInts(Dragon, Eagle)
Definition: cdmacs.h:20
static void init_hc_viewport ( )
static

Definition at line 157 of file hcopy.c.

158 {
159  struct ka *Vl;
160 
162  Vl->kaLeft = 0;
163  Vl->kaBottom = 0;
164  Vl->kaRight = gi_maxx;
165  Vl->kaTop = gi_maxy;
166  Vl->kaWidth = Vl->kaRight - Vl->kaLeft;
167  Vl->kaHeight = Vl->kaTop - Vl->kaBottom;
168 }
long kaRight
Definition: sced.h:112
long kaBottom
Definition: sced.h:112
Definition: sced.h:111
struct ka * kvLargeCoarseViewport
Definition: sced.h:151
#define gi_maxx
Definition: scedmacs.h:58
long kaTop
Definition: sced.h:112
double kaHeight
Definition: sced.h:114
struct kv * View
Definition: init.c:17
long kaLeft
Definition: sced.h:112
double kaWidth
Definition: sced.h:114
#define gi_maxy
Definition: scedmacs.h:59
static void init_window ( )
static
static void init_window ( long  X,
long  Y,
long  Width,
long  HalfHeight 
)
static

Definition at line 138 of file hcopy.c.

141 {
142 
143  View->kvCoarseWindow->kaX = X;
144  View->kvCoarseWindow->kaY = Y;
145  View->kvCoarseWindow->kaLeft = X - Width/2;
146  View->kvCoarseWindow->kaRight = X + Width/2;
147  View->kvCoarseWindow->kaBottom = Y - HalfHeight;
148  View->kvCoarseWindow->kaTop = Y + HalfHeight;
149  View->kvCoarseWindow->kaWidth = Width;
154 }
long kaY
Definition: sced.h:113
struct ka * kvCoarseWindow
Definition: sced.h:149
long kaRight
Definition: sced.h:112
long kaBottom
Definition: sced.h:112
double kvCoarseRatio
Definition: sced.h:155
long X
Definition: actions.c:450
struct ka * kvCoarseViewport
Definition: sced.h:150
long kaTop
Definition: sced.h:112
double kaHeight
Definition: sced.h:114
struct kv * View
Definition: init.c:17
long kaLeft
Definition: sced.h:112
double kaWidth
Definition: sced.h:114
long Y
Definition: actions.c:450
long kaX
Definition: sced.h:113

Variable Documentation

char* MenuHCOPY

Definition at line 80 of file scedintr.c.