Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

open-axiom repository from github

24005 views
1
/*
2
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
3
All rights reserved.
4
Copyright (C) 2007-2010, Gabriel Dos Reis.
5
All rights reserved.
6
7
Redistribution and use in source and binary forms, with or without
8
modification, are permitted provided that the following conditions are
9
met:
10
11
- Redistributions of source code must retain the above copyright
12
notice, this list of conditions and the following disclaimer.
13
14
- Redistributions in binary form must reproduce the above copyright
15
notice, this list of conditions and the following disclaimer in
16
the documentation and/or other materials provided with the
17
distribution.
18
19
- Neither the name of The Numerical Algorithms Group Ltd. nor the
20
names of its contributors may be used to endorse or promote products
21
derived from this software without specific prior written permission.
22
23
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
24
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
26
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
27
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
29
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
*/
35
36
#ifndef _EXTENT_H_
37
#define _EXTENT_H_ 1
38
39
#include "openaxiom-c-macros.h"
40
#include "hyper.h"
41
42
/*
43
* This file contains global macros extern declarations for the extent
44
* computation routines found in extent1.c and extent2.c.
45
*/
46
47
/*
48
* Definitions of standard text formatting dimensions, etc.
49
* dimensions given in pixels
50
*/
51
52
#define left_margin 20
53
#define non_scroll_right_margin_space 20
54
#define scroll_right_margin_space 40
55
#define bottom_margin 15
56
#define top_margin 5
57
#define scroll_top_margin top_margin
58
#define scrollingTopMargin 5
59
#define inter_line_space 5
60
#define inter_word_space 5
61
#define term_punct_space 5
62
#define paragraph_space 30
63
#define box_space 3
64
#define horiz_line_space 3
65
#define spadcom_indent 30
66
#define min_inter_column_space 10
67
#define box_width 3
68
#define dash_width 5
69
#define dash_y 4
70
71
extern void compute_header_extent(HyperDocPage * page);
72
extern void compute_footer_extent(HyperDocPage * page);
73
extern void compute_scrolling_extent(HyperDocPage * page);
74
extern void compute_title_extent(HyperDocPage * page);
75
extern void compute_text_extent(TextNode * node);
76
extern void init_extents(void );
77
extern void init_text(void );
78
extern void init_title_extents(HyperDocPage * page);
79
extern void insert_bitmap_file(TextNode * node);
80
extern void insert_pixmap_file(TextNode * node);
81
extern int max_x(TextNode * node , int Ender);
82
extern int plh(int height);
83
extern void start_newline(int distance , TextNode * node);
84
extern int text_height(TextNode * node , int Ender);
85
extern int text_width(TextNode * node , int Ender);
86
extern int total_width(TextNode * node , int Ender);
87
extern int trailing_space(TextNode * node);
88
89
/* next two from display.h. Reorg! */
90
91
extern short int gDisplayRegion;
92
extern int gRegionOffset;
93
94
#define not_in_scroll (!(gDisplayRegion == Scrolling))
95
96
#define visible(y, h) \
97
(not_in_scroll || ((y) + gRegionOffset + gWindow->page->scroll_off \
98
<= gWindow->scrollheight && \
99
(y) + gRegionOffset + gWindow->page->scroll_off - (h) >= 0))
100
101
#define pix_visible(y, h) \
102
(not_in_scroll || ((y) + gRegionOffset + gWindow->page->scroll_off - h + \
103
line_height < gWindow->page->bot_scroll_margin \
104
- gWindow->page->top_scroll_margin && \
105
(y) + gRegionOffset + gWindow->page->scroll_off >= 0))
106
107
#define above(y) ((y) + gWindow->page->scroll_off < gWindow->page->top_scroll_margin)
108
#define below(y) ((y) + gWindow->page->scroll_off >= gWindow->page->bot_scroll_margin)
109
110
111
/* Variables for the formatting state */
112
113
extern int right_margin_space;
114
extern int right_margin;
115
extern int indent;
116
extern int item_indent;
117
extern int text_x;
118
extern int text_y;
119
extern int y_off;
120
extern int scroll_bot;
121
extern int need_scroll_up_button;
122
extern int need_scroll_down_button;
123
extern int item_space;
124
extern int present_line_height;
125
extern int past_line_height;
126
extern int line_height; /* space between lines */
127
extern int normal_text_height; /* space between lines */
128
extern int space_width; /* the maximum width of a character */
129
extern int word_off_height; /* the diff between text height and */
130
131
132
/*
133
* externs from extent1.c
134
*/
135
136
extern short int gExtentRegion;
137
138
extern short int gInAxiomCommand; /* true iff we are in a \spadcommand */
139
extern short int gInDesc;
140
extern short int gInItem; /* true iff we are in a \item */
141
extern short int gInLine; /* true iff there have been words printed */
142
extern short int gInTable;
143
144
extern TextNode *gLineNode;
145
146
#endif
147
148