1 | /*
|
---|
2 | =============================================================================
|
---|
3 | ctcpos.c -- character text cursor positioning
|
---|
4 | Version 12 -- 1989-11-15 -- D.N. Lynx Crowe
|
---|
5 | =============================================================================
|
---|
6 | */
|
---|
7 |
|
---|
8 | #include "stddefs.h"
|
---|
9 | #include "graphdef.h"
|
---|
10 | #include "vsdd.h"
|
---|
11 | #include "hwdefs.h"
|
---|
12 | #include "macros.h"
|
---|
13 | #include "patch.h"
|
---|
14 |
|
---|
15 | #include "midas.h"
|
---|
16 |
|
---|
17 | short ctcsw; /* text cursor status */
|
---|
18 |
|
---|
19 | extern short CurLine; /* current patch display line */
|
---|
20 | extern short cxval, cyval; /* patch text cursor x, y */
|
---|
21 | extern short stcrow, stccol; /* patch text cursor row,col */
|
---|
22 | extern short vtcrow, vtccol; /* menu text cursor row,col */
|
---|
23 |
|
---|
24 | extern unsigned *obj9; /* patch cursor object pointer */
|
---|
25 | extern unsigned *obj11; /* menu cursor object pointer */
|
---|
26 |
|
---|
27 | short mtcoldc; /* previous cursor column location */
|
---|
28 | short mtcoldr; /* previous cursor row location */
|
---|
29 |
|
---|
30 | /* |
---|
31 |
|
---|
32 | */
|
---|
33 |
|
---|
34 | /*
|
---|
35 | =============================================================================
|
---|
36 | ctcpos() -- position the patch text cursor at ('row', 'col')
|
---|
37 | =============================================================================
|
---|
38 | */
|
---|
39 |
|
---|
40 | void ctcpos(short row, short col)
|
---|
41 | {
|
---|
42 | register short nrow;
|
---|
43 |
|
---|
44 | if (ctcsw) {
|
---|
45 |
|
---|
46 | if (v_regs[5] & 0x0180) /* point at the control bank */
|
---|
47 | vbank(0);
|
---|
48 |
|
---|
49 | nrow = CurLine + 7;
|
---|
50 |
|
---|
51 | if (stcrow EQ DATAROW) /* turn off old cursor */
|
---|
52 | vclrav(obj9, nrow, stccol, C_ULINE, 48);
|
---|
53 |
|
---|
54 | if (row EQ DATAROW) /* turn on new cursor */
|
---|
55 | vsetav(obj9, nrow, col, C_ULINE, 48);
|
---|
56 | }
|
---|
57 |
|
---|
58 | stcrow = row; /* update cursor position */
|
---|
59 | stccol = col;
|
---|
60 | }
|
---|
61 |
|
---|
62 | /* |
---|
63 |
|
---|
64 | */
|
---|
65 |
|
---|
66 | /*
|
---|
67 | =============================================================================
|
---|
68 | ctcoff() -- turn off the patch text cursor
|
---|
69 | =============================================================================
|
---|
70 | */
|
---|
71 |
|
---|
72 | void ctcoff(void)
|
---|
73 | {
|
---|
74 | if (v_regs[5] & 0x0180) /* point at the control bank */
|
---|
75 | vbank(0);
|
---|
76 |
|
---|
77 | if (stcrow EQ DATAROW) /* turn off cursor */
|
---|
78 | vclrav(obj9, CurLine + 7, stccol, C_ULINE, 48);
|
---|
79 |
|
---|
80 | ctcsw = FALSE;
|
---|
81 | }
|
---|
82 |
|
---|
83 | /*
|
---|
84 | =============================================================================
|
---|
85 | ctcon() -- turn on the patch text cursor
|
---|
86 | =============================================================================
|
---|
87 | */
|
---|
88 |
|
---|
89 | void ctcon(void)
|
---|
90 | {
|
---|
91 | if (v_regs[5] & 0x0180) /* point at the control bank */
|
---|
92 | vbank(0);
|
---|
93 |
|
---|
94 | if (stcrow EQ DATAROW) { /* turn on cursor */
|
---|
95 |
|
---|
96 | ctcsw = TRUE;
|
---|
97 | vsetav(obj9, CurLine + 7, stccol, C_ULINE, 48);
|
---|
98 | }
|
---|
99 | }
|
---|
100 |
|
---|
101 | /* |
---|
102 |
|
---|
103 | */
|
---|
104 |
|
---|
105 | /*
|
---|
106 | =============================================================================
|
---|
107 | mtcpos() -- position the menu text cursor at ('row', 'col')
|
---|
108 | =============================================================================
|
---|
109 | */
|
---|
110 |
|
---|
111 | void mtcpos(short row, short col)
|
---|
112 | {
|
---|
113 | if (v_regs[5] & 0x0180) /* point at the control bank */
|
---|
114 | vbank(0);
|
---|
115 |
|
---|
116 | if (inrange(mtcoldr, 19, 23)) { /* turn off old cursor */
|
---|
117 |
|
---|
118 | vclrav(obj11, mtcoldr - 18, mtcoldc, C_ULINE, 64);
|
---|
119 |
|
---|
120 | mtcoldr = 0; /* void old cursor location */
|
---|
121 | mtcoldc = 0;
|
---|
122 | }
|
---|
123 |
|
---|
124 | if (inrange(row, 19, 23)) { /* turn on new cursor */
|
---|
125 |
|
---|
126 | vsetav(obj11, row - 18, col, C_ULINE, 64);
|
---|
127 |
|
---|
128 | mtcoldr = row; /* keep track of new cursor */
|
---|
129 | mtcoldc = col;
|
---|
130 | }
|
---|
131 |
|
---|
132 | vtcrow = row; /* update cursor position */
|
---|
133 | vtccol = col;
|
---|
134 | }
|
---|
135 |
|
---|
136 | /*
|
---|
137 | =============================================================================
|
---|
138 | mtcoff() -- turn off the menu text cursor
|
---|
139 | =============================================================================
|
---|
140 | */
|
---|
141 |
|
---|
142 | void mtcoff(void)
|
---|
143 | {
|
---|
144 | if (v_regs[5] & 0x0180) /* point at the control bank */
|
---|
145 | vbank(0);
|
---|
146 |
|
---|
147 | if (inrange(mtcoldr, 19, 23)) /* turn off cursor */
|
---|
148 | vclrav(obj11, mtcoldr - 18, mtcoldc, C_ULINE, 64);
|
---|
149 | }
|
---|