File: window.h

package info (click to toggle)
oleo 1.6-16
  • links: PTS
  • area: main
  • in suites: potato
  • size: 2,640 kB
  • ctags: 3,139
  • sloc: ansic: 39,221; yacc: 1,737; sh: 362; makefile: 88
file content (200 lines) | stat: -rw-r--r-- 6,264 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200

#ifndef WINDOWH
#define WINDOWH

/*	Copyright (C) 1992, 1993 Free Software Foundation, Inc.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this software; see the file COPYING.  If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
/*  t. lord	Mon Aug 10 14:51:25 1992	*/

#include "cell.h"
#include "line.h"

/* The tty windows datastructures: */


struct window
{
  /* Do not change these directly. */
  int id;
  int win_over;			/* Where the data in this window starts */
  int win_down;			/*   on the screen.  */
  struct rng screen;		/* Cells visible. recenter_* updates this. */
  int flags;			/* You must use io_set_win_flags and perhaps */
				/*   io_recenter_cur_win */

  /* Number of lines of spreadsheet that can fit in this window.
     This only changes when the screen is resized,
     win->flags&WIN_EDGES changes, or a window is either
     created or destroyed */
  int numr;
  
  /* Number of text columns that can fit in this window.
     This changes when the screen is resized,
     win->flags&WIN_EDGES changes, a window is created or
     destoryed, or win->lh_wid changes.  In the last case
     win->numc+win->lh_wid remains a constant. */
  int numc;
  
  /* 
   * Number of columns and rows for right and bottom edges. 
   * As this changes, numc and numr change accordingly.
   */
  int bottom_edge_r;
  int right_edge_c;

  /* These values may be changed at any time. */
  /* -1 if this window isn't linked to any others, else
     contains the index into wins of the window this one is
     linked to */
  int link;

  /* Number of columns taken up by the row numbers at the
     left hand edge of the screen.  Zero if edges is
     win->flags&WIN_EDGES is off (by definition).  Seven (or
     five) if win->flags&WIN_PAG_HZ (to make things easier).
     Ranges between three "R9 " to seven "R32767 " depending on
     the number of the highest row on the screen.  */
  int lh_wid;

  
  /* Cursor row/column in this window */
  /* Note that the external variables curow, cucol are used for
     the currently active cursor position, so if you want
     cwin->curow and cwin->cucol to be accurate, you have to
     set them yourself. */
  CELLREF win_curow;
  CELLREF win_cucol;

  VOIDSTAR *win_slops;	/* Slops in this window (tty only) */
};

struct mouse_event
{
  int seq;
  int row;
  int col;
  int button;
  int downp;
  int location;			/* See #defines, below. */
  CELLREF r;
  CELLREF c;
  struct mouse_event * next;
  struct mouse_event * prev;
};

/* Window flags:
   0x01	Locked horizontally
   0x02	Locked vertically
   0x04	Page Horizontally
   0x08	Page Vertically
   0x10	Edges disabled
   0x20	Edges standout
   */
#define WIN_LCK_HZ	0x01
#define WIN_LCK_VT	0x02
#define WIN_PAG_HZ	0x04
#define WIN_PAG_VT	0x08
#define WIN_EDGES	0x10
#define WIN_EDGE_REV	0x20

/* Do not change these directly. */
extern int scr_lines;
extern int scr_cols;
extern int input;		/* An approximation that makes sense. */
extern int status;
extern int user_input;		/* What the user actually asked for. */
extern int user_status;
extern int formulas_visible;
extern int input_rows;
extern int status_rows;
extern int label_rows;
extern int label_emcols;


extern int nwin;
extern struct window * wins;
extern struct window * cwin;


extern struct mouse_event last_mouse_event;

extern int info_rows;		/* The height of one row of info in a */
				/* multi-line message. */

/* This is stored as the button number when a dequeue failes. */
#define MOUSE_QERROR	-1
/* These are the possible mouse locations. */
#define MOUSE_ON_INPUT    -1
#define MOUSE_ON_STATUS   -2
#define MOUSE_ON_EDGE	  -3

#define MOUSE_CHAR '\034'

#if PROTOTYPES
extern int win_label_cols (struct window * win, CELLREF hr);
extern int win_label_rows (struct window * win);
extern void io_set_label_size (int r, int c);
extern void io_set_scr_size (int lines, int cols);
extern void io_set_input_rows (int n);
extern void io_set_status_rows (int n);
extern void io_set_input_status (int inp, int stat, int redraw);
extern void io_set_cwin (struct window *win);
extern void io_pr_cell (CELLREF r, CELLREF c, CELL *cp);
extern void io_redo_region (struct rng * rng);
extern void io_win_open (int hv, int where);
extern void io_win_close (struct window *win);
extern void io_move_cell_cursor (CELLREF rr, CELLREF cc);
extern void io_shift_cell_cursor (int dirn, int repeat);
extern void io_scroll_cell_cursor (int magic, int repeat);
extern void io_recenter_cur_win (void);
extern void io_recenter_all_win (void);
extern void io_set_win_flags (struct window *w, int f);
extern void io_write_window_config (struct line * out);
extern void io_read_window_config (char * line);
extern int enqueue_mouse_event (int r, int c, int button, int downp);
extern void dequeue_mouse_event (struct mouse_event *out, int seq);
extern void io_init_windows (int sl, int sc, int ui, int us, int ir, int sr,
		 int lr, int lc) ;
#else /* PROTOTYPES */
extern int win_label_cols ();
extern int win_label_rows ();
extern void io_set_label_size ();
extern void io_set_scr_size ();
extern void io_set_input_rows ();
extern void io_set_status_rows ();
extern void io_set_input_status ();
extern void io_set_cwin ();
extern void io_pr_cell ();
extern void io_redo_region ();
extern void io_win_open ();
extern void io_win_close ();
extern void io_move_cell_cursor ();
extern void io_shift_cell_cursor ();
extern void io_scroll_cell_cursor ();
extern void io_recenter_cur_win ();
extern void io_recenter_all_win ();
extern void io_set_win_flags ();
extern void io_write_window_config ();
extern void io_read_window_config ();
extern int enqueue_mouse_event ();
extern void dequeue_mouse_event ();
extern void io_init_windows () ;
#endif /* PROTOTYPES */


#endif