File: tedFormatTool.h

package info (click to toggle)
ted 2.6-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 7,928 kB
  • ctags: 8,734
  • sloc: ansic: 71,878; makefile: 2,363; sh: 159
file content (386 lines) | stat: -rw-r--r-- 10,337 bytes parent folder | download
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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
/************************************************************************/
/*									*/
/*  Format tool:							*/
/*									*/
/************************************************************************/

/************************************************************************/
/*									*/
/*  Resources shared by the different pages of a Format Tool.		*/
/*									*/
/************************************************************************/

typedef struct FormatPageResources
    {
    char *		fprSubjectName;
    char *		fprApplyToSubject;
    char *		fprRevert;

    char *		fprNextButtonText;
    char *		fprPrevButtonText;

    char *		fprSelectButtonText;
    char *		fprDeleteButtonText;

    char *		fprInsertButtonText;
    char *		fprAppendButtonText;
    } FormatPageResources;

/************************************************************************/
/*									*/
/*  Resources for the 'Row' page.					*/
/*									*/
/************************************************************************/

typedef struct RowPageResources
    {
    char *		rprHeightFree;
    char *		rprHeightAtLeast;
    char *		rprHeightExactly;

    char *		rprTopBorder;
    char *		rprBottomBorder;

    char *		rprCellMargin;
    char *		rprLeftIndent;
    } RowPageResources;

/************************************************************************/
/*									*/
/*  Resources for the 'Column' page.					*/
/*									*/
/************************************************************************/

typedef struct ColumnPageResources
    {
    char *		cprWidth;
    char *		cprLeftBorder;
    char *		cprRightBorder;
    } ColumnPageResources;

/************************************************************************/
/*									*/
/*  Resources for the 'Table' page.					*/
/*									*/
/************************************************************************/

typedef struct TablePageResources
    {
    char *		tprCellMargin;
    char *		tprLeftIndent;
    } TablePageResources;

/************************************************************************/
/*									*/
/*  Resources for the 'Paragraph; page.					*/
/*									*/
/************************************************************************/

typedef struct ParagraphPageResources
    {
    char *		pprParaFirstIndent;
    char *		pprParaLeftIndent;
    char *		pprParaRightIndent;

    char *		pprParaSpaceAbove;
    char *		pprParaSpaceBelow;

    char *		pprOnNewPage;
    char *		pprOnOnePage;

    char *		pprParaLineDistFree;
    char *		pprParaLineDistAtLeast;
    char *		pprParaLineDistExactly;

    char *		pprTopBorder;
    char *		pprBottomBorder;

    char *		pprParaAlignment;
    char *		pprParaAlignLeft;
    char *		pprParaAlignRight;
    char *		pprParaAlignCentered;
    char *		pprParaAlignJustified;
    } ParagraphPageResources;

/************************************************************************/
/*									*/
/*  Common structures for the array of subject pages on the format tool	*/
/*									*/
/************************************************************************/

typedef struct ToolSubject
    {
    Widget	tsItem;
    Widget	tsPage;

    Widget	tsPrevButton;
    Widget	tsNextButton;

    Widget	tsSelectButton;
    Widget	tsDeleteButton;

    Widget	tsInsertButton;
    Widget	tsAppendButton;

    Widget	tsRevertButton;
    Widget	tsApplyButton;
    } ToolSubject;

/************************************************************************/
/*									*/
/*  A compination of a pulldown menu and a text widget to manage a	*/
/*  height property.							*/
/*									*/
/************************************************************************/

typedef struct HeightChooser
    {
    Widget	hcMenu;
    Widget	hcPulldown;
    Widget	hcText;

    Widget	hcFreeItem;
    Widget	hcExactlyItem;
    Widget	hcAtLeastItem;
    } HeightChooser;

/************************************************************************/
/*									*/
/*  A paragraph tool, i.e. the 'Paragraph' page of the format tool.	*/
/*									*/
/************************************************************************/

typedef struct ParagraphTool
    {
    EditApplication *		ptApplication;

    ParagraphProperties		ptPropertiesSet;
    ParagraphProperties		ptPropertiesChosen;

    Widget			ptFirstIndentText;
    Widget			ptRightIndentText;
    Widget			ptLeftIndentText;

    Widget			ptOnNewPageToggle;
    Widget			ptOnOnePageToggle;

    Widget			ptSpaceAboveToggle;
    Widget			ptSpaceAboveText;

    Widget			ptSpaceBelowToggle;
    Widget			ptSpaceBelowText;

    Widget			ptTopBorderToggle;
    Widget			ptBottomBorderToggle;

    HeightChooser		ptLineDistChooser;

    Widget			ptAlignMenu;
    Widget			ptAlignPulldown;
    Widget			ptAlignLeftItem;
    Widget			ptAlignRightItem;
    Widget			ptAlignCenteredItem;
    Widget			ptAlignJustifiedItem;
    } ParagraphTool;

/************************************************************************/
/*									*/
/*  A row tool, i.e. the 'Row' page of the format tool.			*/
/*									*/
/************************************************************************/

typedef struct RowTool
    {
    EditApplication *		rtApplication;

    RowProperties		rtPropertiesSet;
    RowProperties		rtPropertiesChosen;

    int				rtCol0;
    int				rtCol1;
    int				rtRow00;
    int				rtRow0;
    int				rtRow1;
    int				rtRow11;

    int				rtPageRight;
    int				rtPageLeftMargin;

    Widget			rtNumberText;
    HeightChooser		rtHeightChooser;
    Widget			rtCellMarginText;
    Widget			rtLeftIndentText;

    Widget			rtHeightFreeItem;
    Widget			rtHeightAtLeastItem;
    Widget			rtHeightExactlyItem;

    Widget			rtTopBorderToggle;
    Widget			rtBottomBorderToggle;
    } RowTool;

/************************************************************************/
/*									*/
/*  A column tool, i.e. the 'Column' page of the format tool.		*/
/*									*/
/************************************************************************/

typedef struct ColumnTool
    {
    EditApplication *		ctApplication;

    int				ctCol0;
    int				ctCol1;
    int				ctRow00;
    int				ctRow0;
    int				ctRow1;
    int				ctRow11;

    int				ctPageRight;
    int				ctPageLeftMargin;

    RowProperties		ctPropertiesSet;
    RowProperties		ctPropertiesChosen;

    Widget			ctNumberText;
    Widget			ctWidthText;

    Widget			ctLeftBorderToggle;
    Widget			ctRightBorderToggle;
    } ColumnTool;

/************************************************************************/
/*									*/
/*  A table tool, i.e. the 'Table' page of the format tool.		*/
/*									*/
/************************************************************************/

typedef struct TableTool
    {
    EditApplication *		ttApplication;

    RowProperties		ttPropertiesSet;
    RowProperties		ttPropertiesChosen;

    int				ttCol0;
    int				ttCol1;
    int				ttRow00;
    int				ttRow0;
    int				ttRow1;
    int				ttRow11;

    int				ttPageRight;
    int				ttPageLeftMargin;

    Widget			ttCellMarginText;
    Widget			ttLeftIndentText;
    } TableTool;

/************************************************************************/
/*									*/
/*  Routine declarations.						*/
/*									*/
/************************************************************************/

extern void tedFormatRefreshHeightChooser(	HeightChooser *	hc,
						int		height );

extern void tedFormatHeightChosen(	Widget			w,
					HeightChooser *		hc,
					int			defaultValue );

extern Widget tedFormatMakePage(	ToolSubject *		ts,
					Widget			pageParent );

extern void tedFormatMakeHeightRow(	Widget *		pRow,
					void *			through,
					Widget			parent,
					HeightChooser *		hc,
					XtCallbackProc		callback );

extern void tedFormatMakeButtonRow(	Widget *		pRow,
					Widget			parent,
					Widget *		pLeftButton,
					Widget *		pRightButton,
					char *			leftLabel,
					char *			rightLabel,
					XtCallbackProc		leftCallback,
					XtCallbackProc		rightCallback,
					void *			through );

extern void tedFormatMakeParagraphPage(	ParagraphTool *			pt,
					Widget				parent,
					const ParagraphPageResources * ppr,
					ToolSubject *			ts,
					const FormatPageResources *	fpr );

extern void tedFormatFinishParagraphPage( ParagraphTool *		pt,
					const ParagraphPageResources *	ppr );

extern void tedFormatFinishRowPage( 	RowTool *			rt,
					const RowPageResources *	rpr );

extern void tedFormatFillParagraphChoosers( ParagraphTool *		pt,
					const ParagraphPageResources *	ppr );

extern void tedFormatFillHeightChooser(	HeightChooser *		hc,
					XtCallbackProc		callback,
					void *			voidtft,
					const char *		freeText,
					const char *		atLeastText,
					const char *		exactlyText );

extern int tedFormatToolGetHeight(	int *		pHeight,
					HeightChooser *	hc );

extern void tedFormatReflectBorder(	Widget				toggle,
					const BorderProperties *	bp );

extern void tedFormatMakeRowPage(	RowTool *			rt,
					Widget				parent,
					const RowPageResources *	rpr,
					ToolSubject *			ts,
					const FormatPageResources *	fpr );

extern void tedFormatFillRowChoosers(	RowTool *			rt,
					const RowPageResources *	rpr );

extern void tedFormatToolRefreshParagraphPage(	ParagraphTool *	pt );

extern void tedFormatMakeTablePage(	TableTool *		tt,
					Widget			pageParent,
					TablePageResources *	tpr,
					ToolSubject *		ts,
					FormatPageResources *	fpr );

extern int tedFormatToolGetRowLeftIndent( const RowProperties *	rp,
					const int		pageLeftMargin,
					int *			pValue,
					Widget			w );

extern int tedFormatToolGetGapWidth(	const RowProperties *	rp,
					int *			pValue,
					Widget			w );

extern void tedFormatMakeColumnPage(	ColumnTool *		ct,
					Widget			pageParent,
					ColumnPageResources *	cpr,
					ToolSubject *		ts,
					FormatPageResources *	fpr );

extern void tedFormatToolRefreshTablePage(	TableTool *	tt );
extern void tedFormatToolRefreshColumnPage(	ColumnTool *	ct );
extern void tedFormatToolRefreshRowPage(	RowTool *	rt );

extern void tedFormatToggleBorder(	BorderProperties *	bp,
					int			set );

extern void tedFormatMakeToggleRow(	Widget *		pRow,
					Widget			parent,
					Widget *		pLeftToggle,
					Widget *		pRightToggle,
					char *			leftText,
					char *			rightText,
					XtCallbackProc		leftCallback,
					XtCallbackProc		rightCallback,
					void *			through );