[3ae31e9] | 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 | ctcpos(row, col)
|
---|
| 41 | register short row, col;
|
---|
| 42 | {
|
---|
| 43 | register short nrow;
|
---|
| 44 |
|
---|
| 45 | if (ctcsw) {
|
---|
| 46 |
|
---|
| 47 | if (v_regs[5] & 0x0180) /* point at the control bank */
|
---|
| 48 | vbank(0);
|
---|
| 49 |
|
---|
| 50 | nrow = CurLine + 7;
|
---|
| 51 |
|
---|
| 52 | if (stcrow EQ DATAROW) /* turn off old cursor */
|
---|
| 53 | vclrav(obj9, nrow, stccol, C_ULINE, 48);
|
---|
| 54 |
|
---|
| 55 | if (row EQ DATAROW) /* turn on new cursor */
|
---|
| 56 | vsetav(obj9, nrow, col, C_ULINE, 48);
|
---|
| 57 | }
|
---|
| 58 |
|
---|
| 59 | stcrow = row; /* update cursor position */
|
---|
| 60 | stccol = col;
|
---|
| 61 | }
|
---|
| 62 |
|
---|
| 63 | /* |
---|
| 64 |
|
---|
| 65 | */
|
---|
| 66 |
|
---|
| 67 | /*
|
---|
| 68 | =============================================================================
|
---|
| 69 | ctcoff() -- turn off the patch text cursor
|
---|
| 70 | =============================================================================
|
---|
| 71 | */
|
---|
| 72 |
|
---|
| 73 | ctcoff()
|
---|
| 74 | {
|
---|
| 75 | if (v_regs[5] & 0x0180) /* point at the control bank */
|
---|
| 76 | vbank(0);
|
---|
| 77 |
|
---|
| 78 | if (stcrow EQ DATAROW) /* turn off cursor */
|
---|
| 79 | vclrav(obj9, CurLine + 7, stccol, C_ULINE, 48);
|
---|
| 80 |
|
---|
| 81 | ctcsw = FALSE;
|
---|
| 82 | }
|
---|
| 83 |
|
---|
| 84 | /*
|
---|
| 85 | =============================================================================
|
---|
| 86 | ctcon() -- turn on the patch text cursor
|
---|
| 87 | =============================================================================
|
---|
| 88 | */
|
---|
| 89 |
|
---|
| 90 | ctcon()
|
---|
| 91 | {
|
---|
| 92 | if (v_regs[5] & 0x0180) /* point at the control bank */
|
---|
| 93 | vbank(0);
|
---|
| 94 |
|
---|
| 95 | if (stcrow EQ DATAROW) { /* turn on cursor */
|
---|
| 96 |
|
---|
| 97 | ctcsw = TRUE;
|
---|
| 98 | vsetav(obj9, CurLine + 7, stccol, C_ULINE, 48);
|
---|
| 99 | }
|
---|
| 100 | }
|
---|
| 101 |
|
---|
| 102 | /* |
---|
| 103 |
|
---|
| 104 | */
|
---|
| 105 |
|
---|
| 106 | /*
|
---|
| 107 | =============================================================================
|
---|
| 108 | mtcpos() -- position the menu text cursor at ('row', 'col')
|
---|
| 109 | =============================================================================
|
---|
| 110 | */
|
---|
| 111 |
|
---|
| 112 | mtcpos(row, col)
|
---|
| 113 | register short row, col;
|
---|
| 114 | {
|
---|
| 115 | if (v_regs[5] & 0x0180) /* point at the control bank */
|
---|
| 116 | vbank(0);
|
---|
| 117 |
|
---|
| 118 | if (inrange(mtcoldr, 19, 23)) { /* turn off old cursor */
|
---|
| 119 |
|
---|
| 120 | vclrav(obj11, mtcoldr - 18, mtcoldc, C_ULINE, 64);
|
---|
| 121 |
|
---|
| 122 | mtcoldr = 0; /* void old cursor location */
|
---|
| 123 | mtcoldc = 0;
|
---|
| 124 | }
|
---|
| 125 |
|
---|
| 126 | if (inrange(row, 19, 23)) { /* turn on new cursor */
|
---|
| 127 |
|
---|
| 128 | vsetav(obj11, row - 18, col, C_ULINE, 64);
|
---|
| 129 |
|
---|
| 130 | mtcoldr = row; /* keep track of new cursor */
|
---|
| 131 | mtcoldc = col;
|
---|
| 132 | }
|
---|
| 133 |
|
---|
| 134 | vtcrow = row; /* update cursor position */
|
---|
| 135 | vtccol = col;
|
---|
| 136 | }
|
---|
| 137 |
|
---|
| 138 | /*
|
---|
| 139 | =============================================================================
|
---|
| 140 | mtcoff() -- turn off the menu text cursor
|
---|
| 141 | =============================================================================
|
---|
| 142 | */
|
---|
| 143 |
|
---|
| 144 | mtcoff()
|
---|
| 145 | {
|
---|
| 146 | if (v_regs[5] & 0x0180) /* point at the control bank */
|
---|
| 147 | vbank(0);
|
---|
| 148 |
|
---|
| 149 | if (inrange(mtcoldr, 19, 23)) /* turn off cursor */
|
---|
| 150 | vclrav(obj11, mtcoldr - 18, mtcoldc, C_ULINE, 64);
|
---|
| 151 | }
|
---|