Jspice3
init.c File Reference
#include "spice.h"
#include "sced.h"
#include "scedmacs.h"
Include dependency graph for init.c:

Go to the source code of this file.

Functions

static void correct_cell_view ()
 
static int get_window_coords ()
 
char * Init ()
 
void InitVLT ()
 
void InitParameters ()
 
void DefaultWindows ()
 
void InitCoarseWindow (long X, long Y, long Width)
 
void InitFineWindow (long X, long Y)
 
void SetPositioning ()
 
void InitViewport ()
 
void SetCurrentAOI (struct ka *Window)
 
void CenterFullView ()
 
static void correct_cell_view (long *L, long *B, long *R, long *T)
 
void UpdateSCED ()
 
void Readin ()
 
void RedisplaySCED (GRAPH *graph)
 
void ResizeSCED (GRAPH *graph)
 
static void ghost_line ()
 
static void ghost_line_snap ()
 
static void ghost_box ()
 
static void ghost_box_snap ()
 
static void ghost_wires ()
 
static void ghost_move ()
 
static void ghost_place ()
 
short FBGetchar (int DisplayOrErase)
 
char * FBEdit (char *string)
 
struct hprlistFBHyEdit (struct hprlist *htxt)
 
void FBText (char Mode, int RowOrX, int ColumnOrY, char *String)
 
void FBPolygon (int Pixel, char Type, long *xy, int n)
 
void FBPolygonClip (long *coord, int *n, struct ka *window)
 
void FBSetRubberBanding (char mode)
 
static void ghost_line (int x, int y, int refx, int refy)
 
static void ghost_line_snap (int x, int y, int refx, int refy)
 
static void ghost_box (int x, int y, int refx, int refy)
 
static void ghost_box_snap (int x, int y, int refx, int refy)
 
static void ghost_wires (int x, int y, int refx, int refy)
 
static void ghost_move (int x, int y, int refx, int refy)
 
static void ghost_place (int x, int y, int refx, int refy)
 
static int get_window_coords (long *X, long *Y, int Clip)
 

Variables

struct kvView
 
struct ka MenuViewport
 
struct kp Parameters
 
struct klColorTable
 
struct kc SCursor
 
struct a CurrentAOI
 
char TypeOut [200]
 

Function Documentation

void CenterFullView ( )

Definition at line 466 of file init.c.

468 {
469  long L,B,R,T;
470  long X,Y,Width,Height;
471  double Cratio,Vratio;
472 
473  if (Not CDBB(Parameters.kpCellDesc,(struct o *)NULL,&L,&B,&R,&T))
474  MallocFailed();
475  /*
476  * Window cell automatically. How slick.
477  * Leave some white space around the perimeter.
478  * Check for a null (empty) cell.
479  */
480  if (L == R Or B == T Or (L == CDINFINITY And B == CDINFINITY)) {
481  DefaultWindows();
482  return;
483  }
485 
486  Width = R - L;
487  Height = T - B;
488  X = L + Width/2;
489  Y = B + Height/2;
490  Cratio = (double) Width/Height;
491 
492  if (Cratio < Vratio)
493  Width = Height*Vratio;
494  else
495  Height = Width/Vratio;
496 
497  InitCoarseWindow(X,Y,Width);
498  L = X - Width/2;
499  R = X + Width/2;
500  B = Y - Height/2;
501  T = Y + Height/2;
502 /*
503  correct_cell_view(&L,&B,&R,&T);
504 */
505 
506  Width = R - L;
507  Height = T - B;
508  X = L + Width/2;
509  Y = B + Height/2;
510  Cratio = (double) Width/Height;
511  if (Cratio > Vratio)
512  Width *= 1.1;
513  else
514  Width = 1.1*Height*Vratio;
515 
516  InitCoarseWindow(X,Y,Width);
517 
518  SetPositioning();
519 }
#define Or
Definition: cdmacs.h:15
#define CDINFINITY
Definition: cddefs.h:70
void SetPositioning()
Definition: init.c:322
struct kv * View
Definition: init.c:17
struct s * kpCellDesc
Definition: sced.h:207
#define Not
Definition: cdmacs.h:16
#define L
Definition: parse.c:442
void MallocFailed()
Definition: scedintr.c:857
long X
Definition: actions.c:450
struct kp Parameters
Definition: init.c:19
#define R
Definition: parse.c:444
#define NULL
Definition: spdefs.h:121
struct ka * kvCoarseViewport
Definition: sced.h:150
double kaHeight
Definition: sced.h:114
Definition: cddefs.h:142
#define And
Definition: cdmacs.h:14
int CDBB()
double kaWidth
Definition: sced.h:114
void DefaultWindows()
Definition: init.c:239
void InitCoarseWindow(long X, long Y, long Width)
Definition: init.c:265
long Y
Definition: actions.c:450
static void correct_cell_view ( )
static
static void correct_cell_view ( long *  L,
long*  B,
long*  R,
long*  T 
)
static

Definition at line 523 of file init.c.

527 {
528  struct g *GenDesc;
529  struct o *Pointer;
530  struct ka LBB;
531  int Info;
532  char Type;
533  long Width,Height;
534 
535  Width = *R - *L;
536  Height = *T - *B;
537  if (Not CDInitGen(Parameters.kpCellDesc,1,*L,*B,
538  *R,*T,&GenDesc)) MallocFailed();
539 
540  loop {
541  CDGen(Parameters.kpCellDesc,GenDesc,&Pointer);
542  if (Pointer == NULL) break;
543 
544  if (Pointer->oType != CDLABEL) continue;
545  if (Pointer->oInfo == SQ_GONE) continue;
546 
547  BBLabel(View->kvCoarseWindow,Pointer,&LBB);
548 
549  if (LBB.kaLeft < *L) {
550  Width *= (double)(LBB.kaRight - LBB.kaLeft)/(LBB.kaRight - *L);
551  *L = *R - Width;
552  }
553  if (LBB.kaRight > *R) {
554  Width *= (double)(LBB.kaRight - LBB.kaLeft)/(*R - LBB.kaLeft);
555  *R = *L + Width;
556  }
557  if (LBB.kaBottom < *B) {
558  Height *= (double)(LBB.kaTop - LBB.kaBottom)/(LBB.kaTop - *B);
559  *B = *T - Height;
560  }
561  if (LBB.kaTop > *T) {
562  Height *= (double)(LBB.kaTop - LBB.kaBottom)/(*T - LBB.kaBottom);
563  *T = *B + Height;
564  }
565  }
566 }
#define loop
Definition: cdmacs.h:11
int struct o * Pointer
Definition: cd.c:1311
#define SQ_GONE
Definition: sced.h:347
struct ka * kvCoarseWindow
Definition: sced.h:149
struct kv * View
Definition: init.c:17
char oType
Definition: cddefs.h:148
struct s * kpCellDesc
Definition: sced.h:207
#define Not
Definition: cdmacs.h:16
void BBLabel()
void CDGen()
Definition: sced.h:111
#define L
Definition: parse.c:442
void MallocFailed()
Definition: scedintr.c:857
struct kp Parameters
Definition: init.c:19
int CDInitGen()
#define R
Definition: parse.c:444
#define NULL
Definition: spdefs.h:121
Definition: cddefs.h:142
Definition: cddefs.h:227
int char Type
Definition: actions.c:449
short oInfo
Definition: cddefs.h:147
#define CDLABEL
Definition: cddefs.h:46
void DefaultWindows ( )

Definition at line 239 of file init.c.

241 {
242  int DefWidth;
243 
245  if (View->kvControl == FULLSCREEN)
246  DefWidth = 100;
247  else
248  DefWidth = 1000;
249  InitCoarseWindow((long)0,(long)0,(long)DefWidth*RESOLUTION);
250 
251  /* default fine window */
254 
257 
258 
259  SetPositioning();
260  SaveLastView();
261 }
int kpPointingThreshold
Definition: sced.h:279
char kvControl
Definition: sced.h:157
void SetPositioning()
Definition: init.c:322
struct kv * View
Definition: init.c:17
struct ka * kvFineViewport
Definition: sced.h:148
struct ka * kvLargeCoarseViewport
Definition: sced.h:151
struct kp Parameters
Definition: init.c:19
struct ka * kvCoarseViewport
Definition: sced.h:150
struct ka * kvFineWindow
Definition: sced.h:147
#define RESOLUTION
Definition: sced.h:36
double kaHeight
Definition: sced.h:114
#define FULLSCREEN
Definition: sced.h:49
void SaveLastView()
Definition: display.c:297
double kaWidth
Definition: sced.h:114
void InitCoarseWindow(long X, long Y, long Width)
Definition: init.c:265
char* FBEdit ( char *  string)

Definition at line 743 of file init.c.

746 {
747  int x,y;
748 
751  return (KbEdit(string,x,y,BackgroundColor,PromptTextColor,
753 }
#define PromptTextColor
Definition: sced.h:80
#define gi_fntheight
Definition: scedmacs.h:57
struct kp Parameters
Definition: init.c:19
char * KbEdit(char *s, int x, int y, int bg, int fg, int cc)
Definition: main.c:280
#define gi_fntwidth
Definition: scedmacs.h:56
#define BackgroundColor
Definition: sced.h:73
#define gi_numtextrows
Definition: scedmacs.h:60
int kpLastCursorColumn
Definition: sced.h:293
#define HighlightingColor
Definition: sced.h:74
#define gi_maxy
Definition: scedmacs.h:59
short FBGetchar ( int  DisplayOrErase)

Definition at line 715 of file init.c.

718 {
719  int x,y;
720  short c;
721  char s[2];
722 
723  if (DisplayOrErase == ERASE)
724  return ((short)DevGetchar(NULL));
725 
729  KbCursor(x,y);
730  c = (short)DevGetchar(NULL);
731  s[0] = (char)(c & 0xff);
732  s[1] = '\0';
734  DevText(s,x,y);
735  AppendToOldPrompt(s[0]);
737  KbCursor(x,y);
738  return (c);
739 }
#define PromptTextColor
Definition: sced.h:80
Definition: cddefs.h:119
void DevSetColor()
void DevText()
#define ERASE
Definition: scedmacs.h:11
#define gi_fntheight
Definition: scedmacs.h:57
void KbCursor()
struct kp Parameters
Definition: init.c:19
#define NULL
Definition: spdefs.h:121
static double c
Definition: vectors.c:16
int DevGetchar()
#define gi_fntwidth
Definition: scedmacs.h:56
#define BackgroundColor
Definition: sced.h:73
#define gi_numtextrows
Definition: scedmacs.h:60
int kpLastCursorColumn
Definition: sced.h:293
#define HighlightingColor
Definition: sced.h:74
#define gi_maxy
Definition: scedmacs.h:59
void AppendToOldPrompt()
struct hprlist* FBHyEdit ( struct hprlist htxt)

Definition at line 757 of file init.c.

760 {
761  int x,y;
762 
765  return (HYedit(htxt,x,y,BackgroundColor,PromptTextColor,
767 }
#define PromptTextColor
Definition: sced.h:80
#define gi_fntheight
Definition: scedmacs.h:57
struct kp Parameters
Definition: init.c:19
struct hprlist * HYedit()
#define gi_fntwidth
Definition: scedmacs.h:56
#define BackgroundColor
Definition: sced.h:73
#define gi_numtextrows
Definition: scedmacs.h:60
int kpLastCursorColumn
Definition: sced.h:293
#define HighlightingColor
Definition: sced.h:74
#define gi_maxy
Definition: scedmacs.h:59
void FBPolygon ( int  Pixel,
char  Type,
long *  xy,
int  n 
)

Definition at line 788 of file init.c.

793 {
794  /*
795  * Type == FILL means fill
796  * Type == OUTLINE means outline
797  */
798  int j,n2,X,Y,Z,T;
799  POLYGON poly;
800 
801  DevSetColor(Pixel);
802 
803  poly.xy = xy;
804  while (NextPolygon(&poly)) {
805  n = poly.nvertices;
806 
807  if (Type == OUTLINE) {
808  n2 = n + n;
809  j = 2;
810  X = xy[0];
811  Y = xy[1];
812  while (j < n2) {
813  Z = xy[j++];
814  T = xy[j++];
815  DevLine(X,Y,Z,T);
816  X = Z;
817  Y = T;
818  }
819  }
820  else {
821  if (n < 2) return;
822  DevPolygon(&poly);
823  }
824  }
825 }
long * xy
Definition: plotdev.h:16
void DevSetColor()
int nvertices
Definition: plotdev.h:15
Definition: plotdev.h:14
long X
Definition: actions.c:450
#define OUTLINE
Definition: scedmacs.h:14
void DevLine()
int NextPolygon(POLYGON *p)
Definition: polyclip.c:135
int char Type
Definition: actions.c:449
long Y
Definition: actions.c:450
void DevPolygon()
void FBPolygonClip ( long *  coord,
int *  n,
struct ka window 
)

Definition at line 829 of file init.c.

834 {
835  POLYGON poly;
836 
837  poly.nvertices = *n;
838  if (*n < 3) return;
839  poly.xy = coord;
840  PolygonClip(&poly,window->kaLeft,window->kaBottom,
841  window->kaRight,window->kaTop);
842 }
long kaRight
Definition: sced.h:112
long * xy
Definition: plotdev.h:16
long kaBottom
Definition: sced.h:112
int nvertices
Definition: plotdev.h:15
Definition: plotdev.h:14
long kaTop
Definition: sced.h:112
long kaLeft
Definition: sced.h:112
void PolygonClip(POLYGON *poly, long left, long bottom, long right, long top)
Definition: polyclip.c:71
void FBSetRubberBanding ( char  mode)

Definition at line 847 of file init.c.

851 {
852  /* need some hokum for button 3 box */
853 #ifdef __STDC__
854  static void (*func)(int,int,int,int);
855 #else
856  static void (*func)();
857 #endif
858  static int X, Y;
859  static int lastR;
860 
861  switch (mode) {
862  case 'l':
864  X = (int)SCursor.kcX;
865  Y = (int)SCursor.kcY;
866  DevSetGhost(func,X,Y);
867  return;
868 
869  case 'L':
870  func = ghost_line;
871  X = (int)SCursor.kcRawX;
872  Y = (int)SCursor.kcRawY;
873  DevSetGhost(func,X,Y);
874  return;
875 
876  case 'r':
878  X = (int)SCursor.kcX;
879  Y = (int)SCursor.kcY;
880  DevSetGhost(func,X,Y);
881  return;
882 
883  case 'R':
884  if (func) {
885  lastR = True;
887  (int)SCursor.kcRawX,(int)SCursor.kcRawY);
888  return;
889  }
890  func = ghost_box;
891  X = (int)SCursor.kcRawX;
892  Y = (int)SCursor.kcRawY;
893  DevSetGhost(func,X,Y);
894  return;
895 
896  case 's':
897  func = ghost_wires;
898  X = (int)SCursor.kcX;
899  Y = (int)SCursor.kcY;
900  DevSetGhost(func,X,Y);
901  return;
902 
903  case 'm':
904  func = ghost_move;
905  X = (int)SCursor.kcX;
906  Y = (int)SCursor.kcY;
907  DevSetGhost(func,X,Y);
908  return;
909 
910  case 'p':
911  func = ghost_place;
912  X = (int)SCursor.kcX;
913  Y = (int)SCursor.kcY;
914  DevSetGhost(func,X,Y);
915  return;
916 
917  case 0:
918  if (lastR) {
919  DevSetGhost(func,X,Y);
920  }
921  else {
922  DevSetGhost(NULL,0,0);
923 #ifdef __STDC__
924  func = (void(*)(int,int,int,int))NULL;
925 #else
926  func = (void(*)())NULL;
927 #endif
928  }
929  lastR = False;
930  return;
931  }
932 }
long kcRawY
Definition: sced.h:103
long kcRawX
Definition: sced.h:103
static void ghost_box_snap()
static void ghost_line_snap()
struct kc SCursor
Definition: init.c:21
long kcY
Definition: sced.h:102
long X
Definition: actions.c:450
#define NULL
Definition: spdefs.h:121
#define True
Definition: scedstub.c:16
static void ghost_place()
void DevSetGhost()
Definition: fteparse.h:37
static void ghost_box()
static void ghost_line()
long kcX
Definition: sced.h:102
static void ghost_move()
#define False
Definition: scedstub.c:15
static void ghost_wires()
long Y
Definition: actions.c:450
void FBText ( char  Mode,
int  RowOrX,
int  ColumnOrY,
char *  String 
)

Definition at line 771 of file init.c.

776 {
777  int i;
778  if(Mode == ROW_COLUMN) {
779  i = gi_maxy - RowOrX * gi_fntheight;
780  RowOrX = (ColumnOrY - 1) * gi_fntwidth;
781  ColumnOrY = i;
782  }
783  DevText(String,RowOrX,ColumnOrY);
784 }
void DevText()
#define gi_fntheight
Definition: scedmacs.h:57
#define ROW_COLUMN
Definition: scedmacs.h:15
#define gi_fntwidth
Definition: scedmacs.h:56
#define gi_maxy
Definition: scedmacs.h:59
static int get_window_coords ( )
static
static int get_window_coords ( long *  X,
long*  Y,
int  Clip 
)
static

Definition at line 1032 of file init.c.

1040 {
1041  if (InBox(*X,*Y,View->kvCoarseViewport)) {
1043  if (Clip)
1044  ClipToGridPoint(X,Y);
1045  return (True);
1046  }
1047  if (InBox(*X,*Y,View->kvFineViewport)) {
1048  PToL(View->kvFineWindow,X,Y);
1049  if (Clip)
1050  ClipToGridPoint(X,Y);
1051  return (True);
1052  }
1053  return (False);
1054 }
struct ka * kvCoarseWindow
Definition: sced.h:149
void PToL()
struct kv * View
Definition: init.c:17
int InBox()
struct ka * kvFineViewport
Definition: sced.h:148
long X
Definition: actions.c:450
struct ka * kvCoarseViewport
Definition: sced.h:150
struct ka * kvFineWindow
Definition: sced.h:147
#define True
Definition: scedstub.c:16
void ClipToGridPoint()
#define False
Definition: scedstub.c:15
long Y
Definition: actions.c:450
static void ghost_box ( )
static
static void ghost_box ( int  x,
int  y,
int  refx,
int  refy 
)
static

Definition at line 960 of file init.c.

963 {
964  struct ka BB;
965 
966  if (!get_window_coords((long*)&x,(long*)&y,False))
967  return;
968  BB.kaLeft = refx;
969  BB.kaBottom = refy;
970  BB.kaRight = x;
971  BB.kaTop = y;
974 }
void DevSetColor()
#define DrawingColor
Definition: sced.h:87
Definition: sced.h:111
static int get_window_coords()
void ShowEmptyBox()
long kaLeft
Definition: sced.h:112
#define False
Definition: scedstub.c:15
#define HighlightingColor
Definition: sced.h:74
static void ghost_box_snap ( )
static
static void ghost_box_snap ( int  x,
int  y,
int  refx,
int  refy 
)
static

Definition at line 978 of file init.c.

981 {
982  struct ka BB;
983 
984  if (!get_window_coords((long*)&x,(long*)&y,True))
985  return;
986  BB.kaLeft = refx;
987  BB.kaBottom = refy;
988  BB.kaRight = x;
989  BB.kaTop = y;
992 }
void DevSetColor()
#define DrawingColor
Definition: sced.h:87
Definition: sced.h:111
static int get_window_coords()
void ShowEmptyBox()
#define True
Definition: scedstub.c:16
long kaLeft
Definition: sced.h:112
#define HighlightingColor
Definition: sced.h:74
static void ghost_line ( )
static
static void ghost_line ( int  x,
int  y,
int  refx,
int  refy 
)
static

Definition at line 936 of file init.c.

939 {
940  if (!get_window_coords((long*)&x,(long*)&y,False))
941  return;
942  ShowLine(HighlightingColor,refx,refy,x,y);
944 }
void DevSetColor()
#define DrawingColor
Definition: sced.h:87
static int get_window_coords()
void ShowLine()
#define False
Definition: scedstub.c:15
#define HighlightingColor
Definition: sced.h:74
static void ghost_line_snap ( )
static
static void ghost_line_snap ( int  x,
int  y,
int  refx,
int  refy 
)
static

Definition at line 948 of file init.c.

951 {
952  if (!get_window_coords((long*)&x,(long*)&y,True))
953  return;
954  ShowLine(HighlightingColor,refx,refy,x,y);
956 }
void DevSetColor()
#define DrawingColor
Definition: sced.h:87
static int get_window_coords()
#define True
Definition: scedstub.c:16
void ShowLine()
#define HighlightingColor
Definition: sced.h:74
static void ghost_move ( )
static
static void ghost_move ( int  x,
int  y,
int  refx,
int  refy 
)
static

Definition at line 1008 of file init.c.

1011 {
1012  if (!get_window_coords((long*)&x,(long*)&y,True))
1013  return;
1014  ShowGhost(x,y,refx,refy);
1016 }
void DevSetColor()
#define DrawingColor
Definition: sced.h:87
void ShowGhost()
static int get_window_coords()
#define True
Definition: scedstub.c:16
static void ghost_place ( )
static
static void ghost_place ( int  x,
int  y,
int  refx,
int  refy 
)
static

Definition at line 1020 of file init.c.

1023 {
1024  if (!get_window_coords((long*)&x,(long*)&y,True))
1025  return;
1026  ShowNewInstance(x,y,refx,refy);
1028 }
void DevSetColor()
#define DrawingColor
Definition: sced.h:87
void ShowNewInstance()
static int get_window_coords()
#define True
Definition: scedstub.c:16
static void ghost_wires ( )
static
static void ghost_wires ( int  x,
int  y,
int  refx,
int  refy 
)
static

Definition at line 996 of file init.c.

999 {
1000  if (!get_window_coords((long*)&x,(long*)&y,True))
1001  return;
1002  ShowStretch(x,y,refx,refy);
1004 }
void ShowStretch()
void DevSetColor()
#define DrawingColor
Definition: sced.h:87
static int get_window_coords()
#define True
Definition: scedstub.c:16
char* Init ( )

Definition at line 35 of file init.c.

37 {
38  GRAPH *graph;
39 
40  /*
41  * Initialize for default values
42  */
43  if (ColorTable == NULL) {
44 
46 
52 
53  ColorTable = (struct kl *)malloc(16*sizeof(struct kl));
54  if (ColorTable == NULL)
55  MallocFailed();
56 
60 
64 
68 
72 
76 
80 
84 
88 
92 
96 
100 
104 
108 
109  ColorTable[ExtraColor1].klR = 255;
110  ColorTable[ExtraColor1].klG = 255;
111  ColorTable[ExtraColor1].klB = 255;
112 
113  ColorTable[DrawingColor].klR = 180;
116 
117  ColorTable[ExtraColor2].klR = 255;
118  ColorTable[ExtraColor2].klG = 255;
119  ColorTable[ExtraColor2].klB = 255;
120 
121 
122  if (CDInit()) {
123  /* can't call MallocFailed() yet */
124  fprintf(stderr,"CD memory allocation failure.\n");
125  return (NULL);
126  }
127  Readin();
128  CDSetLayer(1,'S',"CED");
129  }
130 
131  if (!(graph = NewGraph())) {
132  return (NULL);
133  }
134  graph->graphtype = GR_SCED;
135 
136  if (DevNewViewport(graph) == 1) {
137  DestroyGraph(graph->graphid);
138  return (NULL);
139  }
140  /* don't draw until later */
141  graph->redraw = RedisplaySCED;
142 
143  /* remember to pop on leaving sced */
144  PushGraphContext(graph);
145 
146  DevClear();
147 
148  InitParameters();
149  InitSignals();
150  return ((char*)graph);
151 }
void InitParameters()
Definition: init.c:172
#define PromptTextColor
Definition: sced.h:80
void CDSetLayer()
#define InstanceBBColor
Definition: sced.h:84
#define CoarseGridColor
Definition: sced.h:82
#define ExtraColor2
Definition: sced.h:88
#define InstanceNameColor
Definition: sced.h:85
#define FineGridColor
Definition: sced.h:83
char * malloc()
#define DrawingColor
Definition: sced.h:87
int kpGridDisplayed
Definition: sced.h:240
#define MenuSelectedColor
Definition: sced.h:77
void Readin()
Definition: init.c:603
void RedisplaySCED(GRAPH *graph)
Definition: init.c:645
int DevNewViewport()
void DevClear()
Definition: display.c:234
int kpGridLineStyle
Definition: sced.h:237
#define GR_SCED
Definition: ftegraph.h:23
int CDInit()
Definition: cd.c:114
void MallocFailed()
Definition: scedintr.c:857
int klR
Definition: sced.h:95
struct kp Parameters
Definition: init.c:19
int kpShowGridInLargeViewport
Definition: sced.h:246
Definition: sced.h:94
void PushGraphContext()
#define NULL
Definition: spdefs.h:121
int graphtype
Definition: ftegraph.h:31
int graphid
Definition: ftegraph.h:30
#define MenuHighlightingColor
Definition: sced.h:79
#define True
Definition: scedstub.c:16
#define ExtraColor1
Definition: sced.h:86
Definition: ftegraph.h:29
#define RESOLUTION
Definition: sced.h:36
struct kl * ColorTable
Definition: init.c:20
#define MenuSelectedPrefixColor
Definition: sced.h:78
int DestroyGraph()
#define MenuTextColor
Definition: sced.h:75
int klB
Definition: sced.h:95
#define MenuTextPrefixColor
Definition: sced.h:76
long kpGrid
Definition: sced.h:234
int klG
Definition: sced.h:95
#define BackgroundColor
Definition: sced.h:73
void(* redraw)()
Definition: ftegraph.h:70
int kpCursorShape
Definition: sced.h:296
int kpGridOnTop
Definition: sced.h:243
#define False
Definition: scedstub.c:15
#define MoreTextColor
Definition: sced.h:81
void InitSignals()
Definition: scedintr.c:845
GRAPH * NewGraph()
Definition: graphdb.c:59
#define HighlightingColor
Definition: sced.h:74
void InitCoarseWindow ( long  X,
long  Y,
long  Width 
)

Definition at line 265 of file init.c.

268 {
269  long diff;
270  int Layer;
271  double Wid2;
272  struct ka *Cw;
273 
274  Wid2 = Width/2;
275  diff = (long)((Wid2*View->kvCoarseViewport->kaHeight)/
277 
278  Cw = View->kvCoarseWindow;
279  Cw->kaX = X;
280  Cw->kaY = Y;
281  Cw->kaLeft = Cw->kaX - Wid2;
282  Cw->kaRight = Cw->kaX + Wid2;
283  Cw->kaBottom = Cw->kaY - diff;
284  Cw->kaTop = Cw->kaY + diff;
285  Cw->kaWidth = Cw->kaRight - Cw->kaLeft;
286  Cw->kaHeight = Cw->kaTop - Cw->kaBottom;
287 
289 }
long kaY
Definition: sced.h:113
struct ka * kvCoarseWindow
Definition: sced.h:149
long kaRight
Definition: sced.h:112
struct kv * View
Definition: init.c:17
long kaBottom
Definition: sced.h:112
double kvCoarseRatio
Definition: sced.h:155
Definition: sced.h:111
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
long kaLeft
Definition: sced.h:112
int Layer
Definition: cd.c:1908
double kaWidth
Definition: sced.h:114
long Y
Definition: actions.c:450
long kaX
Definition: sced.h:113
void InitFineWindow ( long  X,
long  Y 
)

Definition at line 293 of file init.c.

296 {
297  /* Width and height are fixed. */
298  long diff;
299  int Layer;
300  double Wid2;
301  struct ka *Fw;
302 
303  Wid2 = View->kvFineWindow->kaWidth/2;
304  diff = (long)((Wid2*View->kvFineViewport->kaHeight)/
306 
307  Fw = View->kvFineWindow;
308  Fw->kaX = X;
309  Fw->kaY = Y;
310  Fw->kaLeft = Fw->kaX - Wid2;
311  Fw->kaRight = Fw->kaX + Wid2;
312  Fw->kaBottom = Fw->kaY - diff;
313  Fw->kaTop = Fw->kaY + diff;
314  Fw->kaWidth = Fw->kaRight - Fw->kaLeft;
315  Fw->kaHeight = Fw->kaTop - Fw->kaBottom;
316 
318 }
long kaY
Definition: sced.h:113
long kaRight
Definition: sced.h:112
struct kv * View
Definition: init.c:17
double kvFineRatio
Definition: sced.h:154
long kaBottom
Definition: sced.h:112
Definition: sced.h:111
struct ka * kvFineViewport
Definition: sced.h:148
long X
Definition: actions.c:450
long kaTop
Definition: sced.h:112
struct ka * kvFineWindow
Definition: sced.h:147
double kaHeight
Definition: sced.h:114
long kaLeft
Definition: sced.h:112
int Layer
Definition: cd.c:1908
double kaWidth
Definition: sced.h:114
long Y
Definition: actions.c:450
long kaX
Definition: sced.h:113
void InitParameters ( )

Definition at line 172 of file init.c.

174 {
175  if (Parameters.kpCellName == NULL) {
193  Parameters.kpNumX = 1;
194  Parameters.kpNumY = 1;
195  Parameters.kpDX = 0;
196  Parameters.kpDY = 0;
198 
199  /*
200  * The fine window has a FIXED width and height.
201  * What should it be?
202  * PointingThreshold is the minimum value of ViewportWidth/WindowWidth
203  * such that it is still comfortable to point with lambda precision.
204  * If PointingThreshold == 7 and FineViewportWidth ~ 467 pixels,
205  * FineWindowWidth ~ 60 lambda.
206  * Most people have prefered 6 or 7.
207  */
209 
210  View = alloc(kv);
211  if (View == NULL) MallocFailed();
213  if (View->kvFineWindow == NULL) MallocFailed();
222 
225  }
226  SCursor.kcX = SCursor.kcPredX = 0;
227  SCursor.kcY = SCursor.kcPredY = 0;
228  /* can start out in FULLSCREEN or SPLITSCREEN mode */
230  TInit();
231  TStore();
232  InitViewport();
233  DefaultWindows();
234  SQInit();
235 }
int kvFineViewportOnBottom
Definition: sced.h:156
int kpPointingThreshold
Definition: sced.h:279
char kvControl
Definition: sced.h:157
struct ka * kvCoarseWindow
Definition: sced.h:149
int kpModified
Definition: sced.h:261
struct ka * kvSmallCoarseViewport
Definition: sced.h:152
struct kv * View
Definition: init.c:17
struct s * kpCellDesc
Definition: sced.h:207
char * kpCellName
Definition: sced.h:210
char * malloc()
struct kc SCursor
Definition: init.c:21
struct s * kpTopDesc
Definition: sced.h:213
Definition: sced.h:111
long kcY
Definition: sced.h:102
struct ka * kvFineViewport
Definition: sced.h:148
#define alloc(type)
Definition: cdmacs.h:21
struct ka * kvLargeCoarseViewport
Definition: sced.h:151
double kpDY
Definition: sced.h:228
void TInit()
Definition: xforms.c:23
void TStore()
Definition: xforms.c:331
void MallocFailed()
Definition: scedintr.c:857
#define CDSYMBOLCALL
Definition: cddefs.h:43
char * kpCommand
Definition: sced.h:219
Definition: sced.h:146
struct kp Parameters
Definition: init.c:19
void InitViewport()
Definition: init.c:358
#define NULL
Definition: spdefs.h:121
#define CDROUNDFLASH
Definition: cddefs.h:45
struct ka * kvFineWindow
Definition: sced.h:147
#define True
Definition: scedstub.c:16
long kcPredY
Definition: sced.h:102
int kpNumY
Definition: sced.h:226
char * kpTopName
Definition: sced.h:216
#define FULLSCREEN
Definition: sced.h:49
int kpRotationAngle
Definition: sced.h:282
void SQInit()
Definition: choose.c:682
#define CDWIRE
Definition: cddefs.h:47
int kpEnableSelectQRedisplay
Definition: sced.h:249
#define EOS
Definition: cdmacs.h:9
long kcX
Definition: sced.h:102
int kpNumX
Definition: sced.h:225
double kpDX
Definition: sced.h:227
long kcPredX
Definition: sced.h:102
#define False
Definition: scedstub.c:15
void DefaultWindows()
Definition: init.c:239
int kpLastCursorColumn
Definition: sced.h:293
#define CDPOLYGON
Definition: cddefs.h:44
char kpSelectTypes[8]
Definition: sced.h:273
#define CDLABEL
Definition: cddefs.h:46
#define CDBOX
Definition: cddefs.h:48
void InitViewport ( )

Definition at line 358 of file init.c.

360 {
361  struct ka *Vl, *Vs, *Vf;
362 
363  MenuViewport.kaLeft = 1;
365  MenuViewport.kaRight = 11;
366  MenuViewport.kaTop = 1;
367  /* save column width and height in X,Y integer fields */
368  MenuViewport.kaX = 5;
370  MenuViewport.kaTop + 1;
371 
372  /*
373  * The COARSE viewport is LARGE if fine-positioning isn't enabled.
374  * If it is, the LARGE COARSE viewport is split into a SMALL COARSE
375  * viewport and the FINE viewport.
376  */
378 
381  Vl->kaBottom = 2*gi_fntheight;
382  Vl->kaRight = gi_maxx;
383  Vl->kaTop = gi_maxy;
384  Vl->kaWidth = Vl->kaRight - Vl->kaLeft;
385  Vl->kaHeight = Vl->kaTop - Vl->kaBottom;
386 
388  Vs->kaLeft = Vl->kaLeft;
389  Vs->kaBottom = Vl->kaBottom + ((Vl->kaTop - Vl->kaBottom)*5)/12;
390  Vs->kaRight = Vl->kaRight;
391  Vs->kaTop = Vl->kaTop;
392  Vs->kaWidth = Vs->kaRight - Vs->kaLeft;
393  Vs->kaHeight = Vs->kaTop - Vs->kaBottom;
394 
395  Vf = View->kvFineViewport;
396  Vf->kaLeft = Vs->kaLeft;
397  Vf->kaBottom = Vl->kaBottom;
398  Vf->kaRight = Vs->kaRight;
399  Vf->kaTop = Vs->kaBottom - 1;
400  Vf->kaWidth = Vf->kaRight - Vf->kaLeft;
401  Vf->kaHeight = Vf->kaTop - Vf->kaBottom;
402  }
403  else {
404 
407  Vl->kaBottom = 2*gi_fntheight;
408  Vl->kaRight = gi_maxx;
409  Vl->kaTop = gi_maxy;
410  Vl->kaWidth = Vl->kaRight - Vl->kaLeft;
411  Vl->kaHeight = Vl->kaTop - Vl->kaBottom;
412 
414  Vs->kaLeft = Vl->kaLeft;
415  Vs->kaBottom = Vl->kaBottom;
416  Vs->kaRight = (gi_maxx - Vl->kaLeft)/2 + Vl->kaLeft;
417  Vs->kaTop = Vl->kaTop;
418  Vs->kaWidth = Vs->kaRight - Vs->kaLeft;
419  Vs->kaHeight = Vs->kaTop - Vs->kaBottom;
420 
421  Vf = View->kvFineViewport;
422  Vf->kaLeft = Vs->kaRight + 1;
423  Vf->kaBottom = Vl->kaBottom;
424  Vf->kaRight = Vl->kaRight;
425  Vf->kaTop = Vs->kaTop;
426  Vf->kaWidth = Vf->kaRight - Vf->kaLeft;
427  Vf->kaHeight = Vf->kaTop - Vf->kaBottom;
428  }
429 }
int kvFineViewportOnBottom
Definition: sced.h:156
long kaY
Definition: sced.h:113
long kaRight
Definition: sced.h:112
struct ka * kvSmallCoarseViewport
Definition: sced.h:152
struct kv * View
Definition: init.c:17
long kaBottom
Definition: sced.h:112
Definition: sced.h:111
struct ka * kvFineViewport
Definition: sced.h:148
struct ka * kvLargeCoarseViewport
Definition: sced.h:151
#define gi_fntheight
Definition: scedmacs.h:57
#define gi_maxx
Definition: scedmacs.h:58
long kaTop
Definition: sced.h:112
double kaHeight
Definition: sced.h:114
long kaLeft
Definition: sced.h:112
struct ka MenuViewport
Definition: init.c:18
#define gi_fntwidth
Definition: scedmacs.h:56
#define gi_numtextrows
Definition: scedmacs.h:60
double kaWidth
Definition: sced.h:114
long kaX
Definition: sced.h:113
#define gi_maxy
Definition: scedmacs.h:59
void InitVLT ( )

Definition at line 155 of file init.c.

157 {
158  int i;
159  double R,G,B;
160  double M = FBMAXINTENSITY;
161 
162  for (i = 0; i < 16; i++) {
163  R = ColorTable[i].klR/M;
164  G = ColorTable[i].klG/M;
165  B = ColorTable[i].klB/M;
166  DevDefineColor(i,R,G,B);
167  }
168 }
void DevDefineColor()
int klR
Definition: sced.h:95
#define G
Definition: parse.c:441
#define R
Definition: parse.c:444
struct kl * ColorTable
Definition: init.c:20
int klB
Definition: sced.h:95
#define FBMAXINTENSITY
Definition: scedmacs.h:48
int klG
Definition: sced.h:95
void Readin ( )

Definition at line 603 of file init.c.

605 {
606  FILE *fp;
607  int i,d1,d2,d3,d4;
608 
609  fp = POpen(INIT_FILE,"r",(char**)NULL);
610  if (fp == NULL)
611  return;
612  (void)fgets(TypeOut,80,fp);
613  if (TypeOut[0] != 'S'|| TypeOut[1] != 'C')
614  goto error;
615  for (i = 0; i < 16; i++) {
616  if (fscanf(fp,"%d %d %d %d\n",&d1,&d2,&d3,&d4) != 4)
617  goto error;
618  if (d1 < 0 || d1 > 15)
619  goto error;
620  if (d2 < 0 || d2 > 255)
621  goto error;
622  if (d3 < 0 || d3 > 255)
623  goto error;
624  if (d4 < 0 || d4 > 255)
625  goto error;
626  ColorTable[d1].klR = d2;
627  ColorTable[d1].klG = d3;
628  ColorTable[d1].klB = d4;
629  }
630  if (fscanf(fp,"%d %d %d %d\n",&d1,&d2,&d3,&d4) != 4)
631  goto error;
633  Parameters.kpGridOnTop = d2;
636  if (fgets(TypeOut,80,fp) != NULL)
638 error:
639  fclose(fp);
640  return;
641 }
#define INIT_FILE
Definition: sced.h:25
int kpGridDisplayed
Definition: sced.h:240
int kpGridLineStyle
Definition: sced.h:237
char TypeOut[200]
Definition: init.c:23
int klR
Definition: sced.h:95
struct kp Parameters
Definition: init.c:19
int kpShowGridInLargeViewport
Definition: sced.h:246
#define NULL
Definition: spdefs.h:121
struct kl * ColorTable
Definition: init.c:20
void SetCDPath()
int klB
Definition: sced.h:95
int klG
Definition: sced.h:95
int kpGridOnTop
Definition: sced.h:243
FILE * POpen()
void RedisplaySCED ( GRAPH graph)

Definition at line 645 of file init.c.

656 {
657  /* establish current graph so default graphic calls will work right */
658  PushGraphContext(graph);
659 
660  DevClear();
661 
662  InitViewport();
664  (long)View->kvCoarseWindow->kaWidth);
666  InitVLT();
667  ShowCommandMenu();
668  if (!RepaintMore())
670  RedrawPrompt();
673  PopGraphContext();
674 }
long kaY
Definition: sced.h:113
void Redisplay()
struct ka * kvCoarseWindow
Definition: sced.h:149
struct kv * View
Definition: init.c:17
void RedrawPrompt()
Definition: viewport.c:512
void DevClear()
Definition: display.c:234
void KbRepaint()
#define gi_fntheight
Definition: scedmacs.h:57
void InitFineWindow(long X, long Y)
Definition: init.c:293
void ShowCommandMenu()
Definition: viewport.c:121
struct kp Parameters
Definition: init.c:19
void InitVLT()
Definition: init.c:155
void InitViewport()
Definition: init.c:358
void PushGraphContext()
struct ka * kvFineWindow
Definition: sced.h:147
int RepaintMore()
Definition: moretext.c:222
void PopGraphContext()
Definition: graphdb.c:270
#define gi_fntwidth
Definition: scedmacs.h:56
#define gi_numtextrows
Definition: scedmacs.h:60
double kaWidth
Definition: sced.h:114
int kpLastCursorColumn
Definition: sced.h:293
void InitCoarseWindow(long X, long Y, long Width)
Definition: init.c:265
long kaX
Definition: sced.h:113
#define gi_maxy
Definition: scedmacs.h:59
void ResizeSCED ( GRAPH graph)

Definition at line 679 of file init.c.

682 {
683  /* do nothing */
684 }
void SetCurrentAOI ( struct ka Window)

Definition at line 433 of file init.c.

436 {
446  }
447  else
449 
451  FineLToP(Window->kaRight,Window->kaTop,CurrentAOI.aRF,CurrentAOI.aTF);
459  }
460  else
462 }
long aTF
Definition: sced.h:121
long kaRight
Definition: sced.h:112
struct kv * View
Definition: init.c:17
long kaBottom
Definition: sced.h:112
long aBF
Definition: sced.h:121
long aTC
Definition: sced.h:122
#define FineLToP(X, Y, XT, YT)
Definition: sced.h:379
long aLC
Definition: sced.h:122
struct ka * kvFineViewport
Definition: sced.h:148
long aLF
Definition: sced.h:121
struct ka * kvCoarseViewport
Definition: sced.h:150
int aInFine
Definition: sced.h:123
long kaTop
Definition: sced.h:112
#define True
Definition: scedstub.c:16
long aRC
Definition: sced.h:122
long kaLeft
Definition: sced.h:112
long aBC
Definition: sced.h:122
#define CoarseLToP(X, Y, XT, YT)
Definition: sced.h:373
#define ClipVP(Viewport, X, Y)
Definition: sced.h:385
#define And
Definition: cdmacs.h:14
struct a CurrentAOI
Definition: init.c:22
#define False
Definition: scedstub.c:15
long aRF
Definition: sced.h:121
int aInCoarse
Definition: sced.h:124
void SetPositioning ( )

Definition at line 322 of file init.c.

324 {
325  long X,Y,Width;
326 
327  if (View->kvControl != FULLSCREEN And
329  /*
330  * Split--enable fine positioning.
331  */
334  }
335  else {
336  /*
337  * Don't split--don't enable fine positioning.
338  */
341  }
342  Width = View->kvCoarseWindow->kaWidth;
343  X = View->kvCoarseWindow->kaX;
344  Y = View->kvCoarseWindow->kaY;
345  InitCoarseWindow(X,Y,Width);
346 
347  /* it is enough to just check the width */
348  if (Width <= View->kvFineWindow->kaWidth) {
349  View->kvFineWindow->kaWidth = Width - Width/4;
352  }
353  InitFineWindow(X,Y);
354 }
long kaY
Definition: sced.h:113
int kpPointingThreshold
Definition: sced.h:279
char kvControl
Definition: sced.h:157
#define SPLITSCREEN
Definition: sced.h:48
struct ka * kvCoarseWindow
Definition: sced.h:149
struct ka * kvSmallCoarseViewport
Definition: sced.h:152
struct kv * View
Definition: init.c:17
double kvCoarseRatio
Definition: sced.h:155
#define COARSEVIEWPORTONLY
Definition: sced.h:51
char kpRedisplayControl
Definition: sced.h:312
struct ka * kvFineViewport
Definition: sced.h:148
struct ka * kvLargeCoarseViewport
Definition: sced.h:151
void InitFineWindow(long X, long Y)
Definition: init.c:293
long X
Definition: actions.c:450
struct kp Parameters
Definition: init.c:19
struct ka * kvCoarseViewport
Definition: sced.h:150
struct ka * kvFineWindow
Definition: sced.h:147
double kaHeight
Definition: sced.h:114
#define FULLSCREEN
Definition: sced.h:49
#define And
Definition: cdmacs.h:14
double kaWidth
Definition: sced.h:114
void InitCoarseWindow(long X, long Y, long Width)
Definition: init.c:265
long Y
Definition: actions.c:450
long kaX
Definition: sced.h:113
void UpdateSCED ( )

Definition at line 570 of file init.c.

572 {
573  FILE *fp;
574  int i;
575  char *c;
576  extern char *MenuUPDAT;
577 
578  MenuSelect(MenuUPDAT);
579  fp = fopen(INIT_FILE,"w");
580  if (fp == NULL) {
581  ShowPrompt("Can't open file.");
582  return;
583  }
584  fprintf(fp,"SCED init file\n");
585  for (i = 0; i < 16; i++) {
586  fprintf(fp,"%d %3d %3d %3d\n",i,
587  ColorTable[i].klR,ColorTable[i].klG,ColorTable[i].klB);
588  }
589  fprintf(fp,"%d %d %d %d\n",Parameters.kpGridDisplayed,
593  c = PGetPath();
594  if (c && *c)
595  fprintf(fp,"%s\n",c);
596  fclose(fp);
597  ShowPrompt("Init file has been saved.");
598  MenuDeselect(MenuUPDAT);
599 }
#define INIT_FILE
Definition: sced.h:25
int kpGridDisplayed
Definition: sced.h:240
int kpGridLineStyle
Definition: sced.h:237
struct kp Parameters
Definition: init.c:19
void MenuDeselect()
int kpShowGridInLargeViewport
Definition: sced.h:246
#define NULL
Definition: spdefs.h:121
char * MenuUPDAT
Definition: scedintr.c:109
static double c
Definition: vectors.c:16
struct kl * ColorTable
Definition: init.c:20
int kpGridOnTop
Definition: sced.h:243
char * PGetPath()
Definition: paths.c:67
void MenuSelect()
void ShowPrompt(char *str)
Definition: scedstub.c:71

Variable Documentation

struct kl* ColorTable

Definition at line 20 of file init.c.

struct a CurrentAOI

Definition at line 22 of file init.c.

struct ka MenuViewport

Definition at line 18 of file init.c.

struct kp Parameters

Definition at line 19 of file init.c.

struct kc SCursor

Definition at line 21 of file init.c.

char TypeOut[200]

Definition at line 23 of file init.c.

struct kv* View

Definition at line 17 of file init.c.