1 /************************************************************************/
2 /*									*/
3 /*  Basic structures for a Gui document manipulator application.	*/
4 /*									*/
5 /************************************************************************/
6 
7 #   ifndef	APP_FRAME_H
8 #   define	APP_FRAME_H
9 
10 #   include	<stdio.h>
11 
12 #   include	"appGuiBase.h"
13 #   include	"appGuiResource.h"
14 
15 #   include	<sioGeneral.h>
16 #   include	<geo2DInteger.h>
17 #   include	<utilDocumentGeometry.h>
18 #   include	<utilPrinter.h>
19 #   include	"appIcons.h"
20 #   include	"guiWidgets.h"
21 #   include	<drawDrawingSurface.h>
22 #   include	<psPostScriptFontList.h>
23 
24 # ifdef __cplusplus
25 extern "C"
26     {
27 # endif
28 
29 struct PrintGeometry;
30 struct PrintJob;
31 
32 /************************************************************************/
33 /*									*/
34 /*  For configuring texts of 'Really' dialogs.				*/
35 /*									*/
36 /************************************************************************/
37 
38 typedef struct AppFileMessageResources
39     {
40 					/********************************/
41 					/*  Format for 'New' title	*/
42 					/********************************/
43     char *		afmrNamelessTitleFormat;
44 					/********************************/
45 					/*  Really Close? Dialog.	*/
46 					/********************************/
47     char *		afmrReallyCloseQuestion;
48     char *		afmrReallyCloseSaveIt;
49     char *		afmrReallyCloseDontSave;
50     char *		afmrReallyCloseCancel;
51 					/********************************/
52 					/*  Really Quit? Dialog.	*/
53 					/********************************/
54     char *		afmrReallyQuitQuestion;
55     char *		afmrReallyQuitReview;
56     char *		afmrReallyQuitAnyway;
57     char *		afmrReallyQuitCancel;
58 					/********************************/
59 					/*  Messages about  a file.	*/
60 					/********************************/
61     char *		afmrFileNoAccess;
62     char *		afmrFileReadOnly;
63     char *		afmrNoSuchFileMessage;
64     char *		afmrFileNotWritable;
65     char *		afmrMakeItQuestion;
66     } AppFileMessageResources;
67 
68 typedef struct AppMenuItem
69     {
70     const char *	amiTextResName;
71     const char *	amiItemText;
72 
73     const char *	amiKeyResName;
74     const char *	amiKey;
75 
76     const char *	amiKeyTextResName;
77     const char *	amiKeyText;
78 
79     MenuItemType	amiItemType;
80     APP_MENU_CALLBACK_T	amiCallback;
81     APP_WIDGET		amiOptionWidget;
82     } AppMenuItem;
83 
84 /************************************************************************/
85 /*									*/
86 /*  Kinds of files that an application can open.			*/
87 /*									*/
88 /************************************************************************/
89 
90 #   define	APPFILE_CAN_OPEN	0x01
91 #   define	APPFILE_CAN_SAVE	0x02
92 #   define	APPFILE_IS_BASIC_TYPE	0x04
93 #   define	APPFILE_HIDE_OPEN	0x08
94 
95 typedef struct AppFileExtension
96     {
97     const char *	afeId;
98     const char *	afeFilter;
99     const char *	afeDescription;
100     const char *	afeExtension;
101     unsigned int	afeUseFlags;
102     } AppFileExtension;
103 
104 typedef struct SelectRectangle
105     {
106     int				srDirection;
107 #				define DOCselNONE	0
108 
109 #				define DOCselN		1
110 #				define DOCselE		2
111 #				define DOCselS		3
112 #				define DOCselW		4
113 
114     DocumentRectangle		srSelected;
115     DocumentRectangle		srLTM; /* left/top margins */
116     DocumentRectangle		srRBM; /* right/bottom margins */
117     } SelectRectangle;
118 
119 typedef struct EditDocument
120     {
121     struct EditApplication *	edApplication;
122 
123     MemoryBuffer		edFilename;
124     MemoryBuffer		edTitle;
125     int				edFormat;
126     int				edFileReadOnly;
127 				/**
128 				 *  Unique number. Can be used to distinguish
129 				 *  EditDocuments wilhout remembering pointers
130 				 */
131     unsigned int		edDocumentId;
132 
133     AppToplevel			edToplevel;
134 
135     APP_WIDGET			edMenuBar;
136     APP_WIDGET			edMainWindow;
137     APP_WIDGET				edFileMenu;
138     APP_WIDGET				edFileMenuButton;
139     APP_WIDGET					edFileCloseOption;
140     APP_WIDGET				edEditMenu;
141     APP_WIDGET				edEditMenuButton;
142     APP_WIDGET				edWindowMenu;
143     APP_WIDGET				edWindowMenuButton;
144     APP_WIDGET				edHelpMenu;
145     APP_WIDGET				edHelpMenuButton;
146 
147     APP_WIDGET			edToolbar;
148     APP_WIDGET			edScrolledWindow;
149     APP_WIDGET				edVerticalScrollbar;
150     APP_WIDGET				edHorizontalScrollbar;
151     APP_WIDGET				edWorkWidget;
152 #   ifdef USE_GTK
153     GtkAdjustment *			edVerticalAdjustment;
154     GtkAdjustment *			edHorizontalAdjustment;
155 #   endif
156     DocumentWidget			edDocumentWidget;
157     struct DrawingSurface *		edDrawingSurface;
158 
159     APP_WIDGET				edLeftRulerWidget;
160     APP_WIDGET				edTopRulerWidget;
161     APP_WIDGET				edRightRulerWidget;
162     APP_WIDGET				edBottomRulerWidget;
163 
164     void *				edLeftRuler;
165     void *				edTopRuler;
166     void *				edRightRuler;
167     void *				edBottomRuler;
168 
169     int					edLeftRulerWidePixels;
170     int					edTopRulerHighPixels;
171     int					edRightRulerWidePixels;
172     int					edBottomRulerHighPixels;
173 
174     int				edHasBeenChanged;
175     int				edIsReadonly;
176     int				edIsVisible;
177 
178 				    /**
179 				     *  The (pixel) rectangle that the whole
180 				     *  document would occupy on screen.
181 				     *  I.E: On a huge screen without
182 				     *  scrollbars. X0 and X0 are 0 by
183 				     *  definition.
184 				     */
185     DocumentRectangle		edFullRect;
186 				    /**
187 				     *  The (pixel) rectangle of the document
188 				     *  that is visible ob screen. Together
189 				     *  with edFullRect, it determines the
190 				     *  positions of the scrollbars.
191 				     */
192     DocumentRectangle		edVisibleRect;
193 
194 				    /**
195 				     *  The color to draw where the window is
196 				     *  not covered by the document.
197 				     */
198     RGB8Color			edBackgroundColor;
199 
200     void *			edPrivateData;
201 
202     struct AppSelectionTargetType *
203 				edTargetTypes;
204     int				edTargetTypeCount;
205 
206     int				edMapped;	/*  Struggle with fvwm	*/
207     int				edNotYetDrawn;	/*  For FirstVisible	*/
208 
209     SelectRectangle		edSelectRectangle;
210     } EditDocument;
211 
212 /************************************************************************/
213 /*									*/
214 /*  Special calls to the aplication.					*/
215 /*									*/
216 /************************************************************************/
217 
218 typedef struct SpecialCall
219     {
220     const char *	scCall;
221     int			(*scExecuteCall)(
222 					struct EditApplication *	ea,
223 					const char *			prog,
224 					const char *			call,
225 					int				argc,
226 					char **				argv );
227 				/****************************************/
228 				/*  Returns the number of parameters	*/
229 				/*  consumed or -1 on failure.		*/
230 				/****************************************/
231     } SpecialCall;
232 
233 /************************************************************************/
234 /*									*/
235 /*  Describes the application.						*/
236 /*									*/
237 /*  1)  Descriptive members.						*/
238 /*  2)  Allocated at run time.						*/
239 /*									*/
240 /************************************************************************/
241 
242 typedef struct EditApplication
243     {
244     /*  1  */
245     const char *	eaApplicationName;
246     const char *	eaOptionalComponents;
247     const char *	eaNameAndVersion;
248     const char *	eaReference;
249     const char *	eaPlatformCompiled;
250     const char *	eaHostDateCompiled;
251 
252 			/**
253 			 *  The Application Icon
254 			 */
255     const char *	eaMainIcon;
256 			/**
257 			 *  The Image on the Splash Screen
258 			 */
259     const char *	eaMainPicture;
260     AppFileExtension *	eaFileExtensions;
261     int			eaFileExtensionCount;
262     const char *	eaDefaultFileFilter;
263     void *			eaResourceData;
264     AppConfigurableResource *	eaResourceTable;
265     int				eaResourceCount;
266     AppConfigurableResource *	eaFileMessageResourceTable;
267     int				eaFileMessageResourceCount;
268     const SpecialCall *		eaSpecialCalls;
269     int				eaSpecialCallCount;
270     int				eaCreateNewFromCommand;
271 
272     double		eaMagnification;
273 
274     int			eaLeftRulerWidthMM;
275     int			eaTopRulerHeightMM;
276     int			eaRightRulerWidthMM;
277     int			eaBottomRulerHeightMM;
278 
279     int			eaLeftRulerWidthMultiple;
280     int			eaTopRulerHeightMultiple;
281     int			eaRightRulerWidthMultiple;
282     int			eaBottomRulerHeightMultiple;
283 
284     const char *	eaUnitString;
285     const char *	eaPaperString;
286     const char *	eaLeftMarginString;
287     const char *	eaTopMarginString;
288     const char *	eaRightMarginString;
289     const char *	eaBottomMarginString;
290     int			eaUnitInt;
291     DocumentGeometry	eaDefaultDocumentGeometry;
292 
293     char **		eaAppFileMenuText;
294     AppMenuItem *	eaAppFileMenuItems;
295     int			eaAppFileMenuItemCount;
296 
297     char **		eaAppWinMenuText;
298     AppMenuItem *	eaAppWinMenuItems;
299     int			eaAppWinMenuItemCount;
300 
301     char **		eaDocFileMenuText;
302     AppMenuItem *	eaDocFileMenuItems;
303     int			eaDocFileMenuItemCount;
304 
305     char **		eaDocEditMenuText;
306     AppMenuItem *	eaDocEditMenuItems;
307     int			eaDocEditMenuItemCount;
308 
309     char **		eaDocWindowMenuText;
310     AppMenuItem *	eaDocWindowMenuItems;
311     int			eaDocWindowMenuItemCount;
312 
313     char **		eaDocHelpMenuText;
314     AppMenuItem *	eaDocHelpMenuItems;
315     int			eaDocHelpMenuItemCount;
316 
317     char **		eaAppHelpMenuText;
318     AppMenuItem *	eaAppHelpMenuItems;
319     int			eaAppHelpMenuItemCount;
320 
321     void *		(*eaMakePrivateData)( void );
322 
323     int			(*eaMakeDocumentWidget)(
324 				struct EditApplication *	ea,
325 				EditDocument *			ed );
326     int			(*eaOpenDocument)(
327 				struct EditApplication *	ea,
328 				void *				privateData,
329 				int *				pFormat,
330 				APP_WIDGET			relative,
331 				APP_WIDGET			option,
332 				int				readOnly,
333 				int				suggestStdin,
334 				int				formatHint,
335 				const MemoryBuffer *		filename );
336     int			(*eaNewDocument)(
337 				EditDocument *			ed,
338 				const MemoryBuffer *		filename );
339     int			(*eaLayoutDocument)(
340 				DocumentRectangle *		drScreen,
341 				DocumentRectangle *		drVisible,
342 				void *				privateData,
343 				int				format,
344 				DrawingSurface			ds,
345 				const PostScriptFontList *	psfl,
346 				const DocumentGeometry *	defDg );
347     int			(*eaFinishDocumentSetup)(
348 				EditDocument *			ed );
349     void		(*eaDocumentFirstVisible)(
350 				EditDocument *			ed );
351     int			(*eaCanSaveDocument)(
352 				const void *			privateData,
353 				int				format );
354     int			(*eaSaveDocument)(
355 				struct EditApplication *	ea,
356 				DrawingSurface			ds,
357 				const void *			privateData,
358 				int				format,
359 				const MemoryBuffer *		documentTitle,
360 				int				suggestStdout,
361 				const MemoryBuffer *		filename,
362 				int				isDocName );
363     void		(*eaFreeDocument)(
364 				void *				privateData,
365 				int				format );
366     void		(*eaSuggestPageSetup)(
367 				struct PrintGeometry *		pg,
368 				void *				privateData,
369 				int				sheetSize );
370     int			(*eaPrintDocument)(
371 				SimpleOutputStream *		sos,
372 				const struct PrintJob *		pj,
373 				const struct PrintGeometry *	pg );
374     void		(*eaDrawRectangle)(
375 				EditDocument *			ed,
376 				DocumentRectangle *		drClip,
377 				int				ox,
378 				int				oy );
379 
380     void		(*eaVisibleDocumentCountChanged)(
381 				    struct EditApplication *	ea,
382 				    int				from,
383 				    int				to );
384 
385     void		(*eaMakePrivateApplicationMenus)(
386 				    struct EditApplication *	ea,
387 				    APP_WIDGET			menubar );
388 
389     void		(*eaMakePrivateDocumentMenus)(
390 				    struct EditApplication *	ea,
391 				    EditDocument *		ed,
392 				    APP_WIDGET			menubar );
393 
394     void		(*eaDocCopy)( EditDocument *);
395     void		(*eaDocCut)( EditDocument *);
396     void		(*eaDocSelAll)( EditDocument * );
397 
398     void		(*eaSetPageLayout)(
399 				    struct EditDocument *	ed,
400 				    const PropertyMask *	setMask,
401 				    const DocumentGeometry *	dgNew,
402 				    int				wholeDocument );
403 
404 			/************************************************/
405 			/*  User input on the document widget:		*/
406 			/************************************************/
407     APP_EVENT_HANDLER_T	eaDocumentMouseHandler;
408     APP_EVENT_HANDLER_T	eaDocumentScrollHandler;
409     void		(*eaDocGotString)(	void *		voided,
410 						const char *	value,
411 						int		length );
412     void		(*eaDocGotKey)(		void *		voided,
413 						int		key,
414 						unsigned int	state );
415     APP_EVENT_HANDLER_T	eaObserveFocus;
416 
417     APP_SCROLLBAR_CALLBACK_T	eaDocHorizontalScrollbarCallback;
418     APP_SCROLLBAR_CALLBACK_T	eaDocVerticalScrollbarCallback;
419 
420     void		(*eaScrollTopRuler) (	void *, APP_WIDGET, int );
421 				    /**
422 				     *  Adapt to a change in size of the
423 				     *  document: Remember the visible range.
424 				     */
425     void		(*eaSetTopRulerRange)(	void *		voidtr,
426 						APP_WIDGET	w,
427 						int		docX1,
428 						int		docVisX0,
429 						int		docVisX1 );
430 
431     void		(*eaScrollLeftRuler) (	void *, APP_WIDGET, int );
432     void		(*eaSetLeftRulerRange)(	void *		voidtr,
433 						APP_WIDGET	w,
434 						int		docY1,
435 						int		docVisY0,
436 						int		docVisY1 );
437 
438     void		(*eaScrollRightRuler) (	void *, APP_WIDGET, int );
439     void		(*eaSetRightRulerRange)(	void *	voidtr,
440 						APP_WIDGET	w,
441 						int		docY1,
442 						int		docVisY0,
443 						int		docVisY1 );
444 
445     void		(*eaScrollBottomRuler) ( void *, APP_WIDGET, int );
446 				    /**
447 				     *  Adapt to a change in size of the
448 				     *  document: Remember the visible range.
449 				     */
450     void		(*eaSetBottomRulerRange)( void *	voidtr,
451 						APP_WIDGET	w,
452 						int		docX1,
453 						int		docVisX0,
454 						int		docVisX1 );
455 
456     int			(*eaSetTopRuler)(	EditDocument *	ed );
457     int			(*eaSetLeftRuler)(	EditDocument *	ed );
458     int			(*eaSetRightRuler)(	EditDocument *	ed );
459     int			(*eaSetBottomRuler)(	EditDocument *	ed );
460 
461     void		(*eaFreeTopRuler)(
462 					void *			topRuler );
463     void		(*eaFreeLeftRuler)(
464 					void *			leftRuler );
465     void		(*eaFreeRightRuler)(
466 					void *			rightRuler );
467     void		(*eaFreeBottomRuler)(
468 					void *			bottomRuler );
469 
470     struct AppSelectionType *	eaDocSelectionTypes;
471     int				eaDocSelectionTypeCount;
472 
473     struct AppSelectionType *	eaAppSelectionTypes;
474     int				eaAppSelectionTypeCount;
475 
476     PrintDestination *	eaPrintDestinations;
477     int			eaPrintDestinationCount;
478     int			eaDefaultPrintDestination;
479     int			eaPrintDestinationsCollected;
480 
481     NamedPicture *	eaNamedPictures;
482     int			eaNamedPictureCount;
483 
484     APP_ATOM		eaCloseAtom;
485 
486     unsigned int	eaNextDocumentId;
487 
488 				/**
489 				 *  Culture name (Language and teritory)
490 				 *  determined at startup.
491 				 */
492     char *			eaLocaleName;
493 
494     /*  2  */
495 #   ifdef USE_MOTIF
496     XtAppContext		eaContext;
497 #   endif
498 
499     int				eaScreenPixelsWide;
500     int				eaScreenPixelsHigh;
501     double			eaPixelsPerTwip;
502 
503     AppToplevel			eaToplevel;
504 	APP_INPUT_METHOD	eaInputMethod;
505 	APP_CURSOR		eaDocumentCursor;
506     APP_WIDGET			eaMainWindow;
507     APP_WIDGET			eaMenuBar;
508     APP_WIDGET			eaFileMenu;
509     APP_WIDGET			eaFileMenuButton;
510     APP_WIDGET			eaWinMenu;
511     APP_WIDGET			eaWinMenuButton;
512     APP_WIDGET			eaHelpMenu;
513     APP_WIDGET			eaHelpMenuButton;
514 
515     void *			eaPageTool;
516     void *			eaPrintDialog;
517 
518     int				eaArgc;
519     char **			eaArgv;
520 
521     EditDocument *		eaCurrentDocument;
522     EditDocument **		eaOpenDocuments;
523     int				eaOpenCount;
524     int				eaVisibleDocumentCount;
525     int				eaMainVisibleAsAbout;
526 
527     char *			eaAfmDirectory;
528     char *			eaFontDirectory;
529     char *			eaGhostscriptFontmap;
530     char *			eaGhostscriptFontToXmapping;
531     int				eaGhostscriptMappingsRead;
532     char *			eaCustomPrintCommand;
533     char *			eaCustomPrinterName;
534     char *			eaCustomPrintCommand2;
535     char *			eaCustomPrinterName2;
536     char *			eaAuthor;
537     char *			eaFocusColor;
538 
539     int				eaUsePostScriptFiltersInt;
540     int				eaUsePostScriptIndexedImagesInt;
541     int				ea7BitsPostScriptInt;
542     int				eaSkipEmptyPagesInt;
543     int				eaSkipBlankPagesInt;
544     int				eaOmitHeadersOnEmptyPagesInt;
545     int				eaAvoidFontconfigInt;
546     int				eaPreferBase35FontsInt;
547     int				eaEmbedFontsInt;
548     int				eaUseKerningInt;
549     int				eaStyleToolInt;
550 
551     AppFileMessageResources	eaFileMessageResources;
552 
553     char *			eaMagnificationString;
554     char *			eaUsePostScriptFiltersString;
555     char *			eaUsePostScriptIndexedImagesString;
556     char *			ea7BitsPostScriptString;
557     char *			eaSkipEmptyPagesString;
558     char *			eaSkipBlankPagesString;
559     char *			eaOmitHeadersOnEmptyPagesString;
560     char *			eaAvoidFontconfigString;
561     char *			eaPreferBase35FontsString;
562     char *			eaEmbedFontsString;
563     char *			eaUseKerningString;
564     char *			eaStyleToolString;
565 
566     char *			eaCustomPsSetupFilename;
567 
568     char *			eaLeftRulerWidthMMString;
569     char *			eaTopRulerHeightMMString;
570     char *			eaRightRulerWidthMMString;
571     char *			eaBottomRulerHeightMMString;
572 
573     int				eaGotPaste;
574 
575     PostScriptFontList		eaPostScriptFontList;
576 
577     void *			eaSystemProperties;
578     void *			eaUserProperties;
579 
580     int				eaGotResourceTable;
581     int				eaGotFileMessageResourceTable;
582     int				eaGotApplicationResources;
583     } EditApplication;
584 
585 /************************************************************************/
586 /*									*/
587 /*  Describes types of content for Copy/Paste.				*/
588 /*  The order is the order of desirability for the application.		*/
589 /*									*/
590 /************************************************************************/
591 
592 typedef void (*APP_FORGET_COPY)( APP_WIDGET		w,
593 				void *			through,
594 				APP_EVENT *		event );
595 
596 typedef struct AppSelectionTargetType
597     {
598     const char *	asttTargetString;		/*  ContentType	*/
599     APP_ATOM		asttTargetAtom;
600     APP_PASTE_REPLY	asttUsePaste;
601     APP_GIVE_COPY	asttGiveCopy;
602     } AppSelectionTargetType;
603 
604 typedef struct AppSelectionType
605     {
606     const char *		astSelectionString;	/*  What	*/
607     APP_ATOM			astSelectionAtom;
608 
609     AppSelectionTargetType *	astTargetTypes;
610     int				astTargetTypeCount;
611 
612     APP_FORGET_COPY		astForgetCopy;
613     } AppSelectionType;
614 
615 /************************************************************************/
616 /*									*/
617 /*  Routine declarations.						*/
618 /*									*/
619 /************************************************************************/
620 
621 extern APP_WIDGET appMakeMenu(		APP_WIDGET *		pButton,
622 					AppToplevel *		at,
623 					EditApplication *	ea,
624 					APP_WIDGET		parent,
625 					const char *		itemText,
626 					int			isHelp,
627 					AppMenuItem *		items,
628 					int			itemCount,
629 					void *			through );
630 
631 extern EditDocument * appOpenDocumentFile(
632 					EditApplication *	ea,
633 					APP_WIDGET		relative,
634 					APP_WIDGET		option,
635 					int			readOnly,
636 					int			suggestStdin,
637 					int			formatHint,
638 					const MemoryBuffer *	filename );
639 
640 extern EditDocument * appOpenDocument(	EditApplication *	ea,
641 					APP_WIDGET		relative,
642 					APP_WIDGET		option,
643 					int			readOnly,
644 					const MemoryBuffer *	filename );
645 
646 extern int appNewDocument(	EditApplication *	ea,
647 				const MemoryBuffer *	filename );
648 
649 extern int appMain(	EditApplication *	ea,
650 			int			argc,
651 			char *			argv[] );
652 
653 extern void appSetDocument(	EditApplication *	ea,
654 				EditDocument *		ed );
655 
656 extern void appRemoveDocument(	EditApplication *	ea,
657 				EditDocument *		ed );
658 
659 extern void appCloseDocument(	EditDocument *		ed );
660 
661 extern void appSetCurrentDocument(	EditApplication *	ea,
662 					EditDocument *		ed );
663 
664 extern void appDocToFront(	APP_WIDGET		option,
665 				void *			voided,
666 				void *			e );
667 
668 extern void appDocumentChanged(	EditDocument *		ed,
669 				int			changed );
670 
671 void appQuitApplication(	APP_WIDGET		option,
672 				APP_WIDGET		relative,
673 				EditApplication *	ea );
674 
675 extern APP_MENU_CALLBACK_H( appAppFileQuit, option, voidea, e );
676 
677 extern void appDocVisible(	EditApplication *	ea,
678 				EditDocument *		ed,
679 				int			visible );
680 
681 extern APP_MENU_CALLBACK_H( appAppFileOpen, option, voidea, e );
682 extern APP_MENU_CALLBACK_H( appAppFileNew, option, voidea, e );
683 
684 extern void appDocSetScrollbarValues(	EditDocument *	ed );
685 
686 extern void appMouseWheelUp(		EditDocument *	ed );
687 extern void appMouseWheelDown(		EditDocument *	ed );
688 extern APP_EVENT_HANDLER_H( appScrollEventHandler, w, voided, scrollEvent );
689 
690 extern APP_MENU_CALLBACK_H( appDocFileSaveAs, option, voided, e );
691 
692 extern APP_MENU_CALLBACK_H( appDocFileNew, option, voided, e );
693 extern APP_MENU_CALLBACK_H( appDocFileOpen, option, voided, e );
694 extern APP_MENU_CALLBACK_H( appDocFileSave, option, voided, e );
695 extern APP_MENU_CALLBACK_H( appDocFileClose, option, voided, e );
696 extern APP_MENU_CALLBACK_H( appDocFileQuit, option, voided, e );
697 extern APP_MENU_CALLBACK_H( appDocEditCopy, option, voided, e );
698 extern APP_MENU_CALLBACK_H( appDocEditCut, option, voided, e );
699 extern APP_MENU_CALLBACK_H( appDocEditSelAll, option, voided, e );
700 
701 extern APP_CLOSE_CALLBACK_H( appDocFileCloseCallback, w, voided );
702 extern APP_CLOSE_CALLBACK_H( appAppWmClose, w, voidea );
703 
704 extern void appRunReallyCloseDialog(	APP_WIDGET		option,
705 					EditDocument *		ed );
706 
707 extern int appRunReallyQuitDialog(	APP_WIDGET		option,
708 					APP_WIDGET		relative,
709 					EditApplication *	ea );
710 
711 extern void appMakeDocVisible(	EditApplication *	ea,
712 				EditDocument *		ed );
713 
714 extern void appShowDefaultsEditor(	APP_WIDGET	prefOption,
715 					void *		voidea );
716 
717 extern int appGetImagePixmap(	EditApplication *	ea,
718 				const char *		name,
719 				APP_BITMAP_IMAGE *	pImage,
720 				APP_BITMAP_MASK *	pMask );
721 
722 extern void appDiscardImagePixmaps(	EditApplication *	ea );
723 
724 extern int appSetDocumentFilename(	EditDocument *		ed,
725 					const MemoryBuffer *	filename );
726 
727 extern int appSetDocumentTitle(		EditDocument *		ed,
728 					const MemoryBuffer *	title );
729 
730 extern int appFinishDocumentSetup(	EditDocument *		ed );
731 
732 extern int appSetupDocument(		EditApplication *	ea,
733 					EditDocument *		ed );
734 
735 extern void appRenameDocumentOptions(	EditApplication *	ea,
736 					EditDocument *		ed,
737 					const MemoryBuffer *	title );
738 
739 extern void * appMakePageTool(	EditApplication *	ea,
740 				APP_WIDGET		printOption,
741 				const char *		pixmapName );
742 
743 extern void appShowPageTool(		EditApplication *	ea );
744 
745 extern void appPageToolSetProperties(	void *				voidapt,
746 					const DocumentGeometry *	dg );
747 
748 extern void appEnablePageTool(		void *		voidapt,
749 					int		enabled );
750 
751 extern void appRunPrintDialog(		EditDocument *		ed,
752 					const DocumentGeometry * dgDocument,
753 					int			pageCount,
754 					int			firstSelected,
755 					int			lastSelected,
756 					APP_WIDGET		printOption,
757 					const char *		pixmapName );
758 
759 extern int appPrintDocument(	int				printer,
760 				const struct PrintJob *		pj );
761 
762 extern void appDocPrintToFile(	APP_WIDGET			option,
763 				APP_WIDGET			panel,
764 				EditDocument *			ed,
765 				const struct PrintGeometry *	pg );
766 
767 APP_MENU_CALLBACK_H( appDocAbout, option, voided, e );
768 
769 extern APP_EVENT_HANDLER_H( appDocCopyPasteHandler, w, voided, event );
770 extern APP_EVENT_HANDLER_H( appAppGotPasteCall, w, voided, event );
771 
772 # ifdef USE_GTK
773 
774 extern void appDocGotPasteReplyGtk(	GtkWidget *		w,
775 					GtkSelectionData *	gsd,
776 					guint			time,
777 					void *			voided );
778 
779 extern void appAppGotPasteReplyGtk(	GtkWidget *		w,
780 					GtkSelectionData *	gsd,
781 					guint			time,
782 					void *			voidea );
783 # endif
784 
785 extern int appDocReleaseSelection(	EditDocument *		ed,
786 					const char *		selection );
787 
788 extern int appDocOwnSelection(	EditDocument *			ed,
789 				const char *			selection,
790 				AppSelectionTargetType * 	targets,
791 				int				targetCount );
792 
793 extern int appDocAskForPaste(	EditDocument *		ed,
794 				const char *		selection );
795 
796 extern int appAppAskForPaste(	EditApplication *	ea,
797 				const char *		selection );
798 
799 APP_SCROLLBAR_CALLBACK_H( appDocHorizontalScrollbarCallback, bar, voided, e );
800 APP_SCROLLBAR_CALLBACK_H( appDocVerticalScrollbarCallback, bar, voided, e );
801 
802 extern void appReportSaveFailure(	EditApplication *	ea,
803 					APP_WIDGET		option,
804 					APP_WIDGET		relative,
805 					const MemoryBuffer *	filename );
806 
807 extern void appMakeVerticalDialog(	AppDialog *		ad,
808 					APP_WIDGET *		pPaned,
809 					EditApplication *	ea,
810 					APP_CLOSE_CALLBACK_T	closeCallback,
811 					APP_DESTROY_CALLBACK_T	destroyCallback,
812 					void *			through );
813 
814 extern int appCallPrintFunction( SimpleOutputStream *		sos,
815 				const struct PrintJob *		pj );
816 
817 extern int appImgMakeFileExtensions(	AppFileExtension **	pAfeList,
818 					int *			pAfeCount );
819 
820 extern int appMakeDocumentWidget(	EditApplication *	ea,
821 					EditDocument *		ed );
822 
823 extern APP_EVENT_HANDLER_H( appDocExposeHandler, w, d, exposeEvent );
824 
825 extern int appFileConvert(	EditApplication *	ea,
826 				const MemoryBuffer *	fromName,
827 				const MemoryBuffer *	toName );
828 
829 extern int appPrintToFile(	EditApplication *	ea,
830 				const char *		fromName,
831 				const char *		toName,
832 				const char *		paperString );
833 
834 extern int appPrintToPrinter(	EditApplication *	ea,
835 				const char *		fromName,
836 				const char *		toName,
837 				const char *		paperString );
838 
839 APP_DESTROY_CALLBACK_H( appDestroyEditDocument, w, voided );
840 
841 extern void appScrollToRectangle( EditDocument *		ed,
842 				const DocumentRectangle *	dr,
843 				int *				pScrolledX,
844 				int *				pScrolledY );
845 
846 extern void appMakeVerticalTool( APP_WIDGET *		pShell,
847 				APP_WIDGET *		pPaned,
848 				EditApplication *	ea,
849 				APP_BITMAP_IMAGE	iconPixmap,
850 				APP_BITMAP_MASK		iconMask,
851 				int			userResizable,
852 				APP_WIDGET		option,
853 				APP_CLOSE_CALLBACK_T	closeCallback,
854 				void *			through );
855 
856 extern void appGuiGetResourceValues(
857 				int *				pGotResources,
858 				EditApplication *		ea,
859 				void *				pValues,
860 				AppConfigurableResource *	acr,
861 				int				acrCount );
862 
863 extern void appSetResourceDefaults(
864 				EditApplication *		ea,
865 				AppConfigurableResource *	acr,
866 				int				acrCount );
867 
868 extern int appGuiInitApplication(	EditApplication *	ea,
869 					int *			pArgc,
870 					char ***		pArgv );
871 
872 extern void appShowShellWidget(		EditApplication *	ea,
873 					APP_WIDGET		shell );
874 
875 /************************************************************************/
876 /*									*/
877 /*  Names of the X11 events.						*/
878 /*									*/
879 /************************************************************************/
880 
881 extern void appDocumentRulerWidth(	EditApplication *	ea,
882 					EditDocument *		ed );
883 
884 extern int appFinishDocumentWindow(	EditDocument *		ed );
885 
886 extern void appGuiSetShellTitle(	APP_WIDGET		shell,
887 					const MemoryBuffer *	title );
888 
889 extern void appGuiSetIconTitle(		APP_WIDGET		shell,
890 					const MemoryBuffer *	title );
891 
892 extern APP_WIDGET appSetMenuItem(	APP_WIDGET		menu,
893 					AppToplevel *		at,
894 					AppMenuItem *		ami,
895 					void *			target );
896 
897 extern APP_WIDGET appSetMenuSeparator(	APP_WIDGET		menu,
898 					AppToplevel *		at,
899 					AppMenuItem *		ami,
900 					void *			target );
901 
902 extern APP_WIDGET appSetToggleMenuItem(	APP_WIDGET		menu,
903 					AppToplevel *		at,
904 					AppMenuItem *		ami,
905 					void *			target );
906 
907 extern APP_WIDGET appMakeMenuInParent(	APP_WIDGET *		pButton,
908 					AppToplevel *		at,
909 					APP_WIDGET		menuBar,
910 					const char *		itemText,
911 					int			isHelp );
912 
913 extern void appGuiRunDialog( 		AppDialog *		ad,
914 					int			initial,
915 					EditApplication *	ea );
916 
917 extern void appGuiBreakDialog( 		AppDialog *		ad,
918 					int			response );
919 
920 extern void appGuiSetDefaultButtonForDialog(	AppDialog *	ad,
921 						APP_WIDGET	button );
922 
923 extern void appGuiSetCancelButtonForDialog(	AppDialog *	ad,
924 						APP_WIDGET	button );
925 
926 extern void appGuiShowDialog(			EditApplication * ea,
927 						AppDialog *	ad,
928 						APP_WIDGET	relative );
929 
930 extern void appGuiHideDialog(			AppDialog *	ad );
931 
932 extern void appDocFillMenu(		EditDocument *		ed );
933 
934 extern void appRunDragLoop(	APP_WIDGET		w,
935 				EditApplication *	ea,
936 				APP_EVENT *		downEvent,
937 				APP_EVENT_HANDLER_T	upHandler,
938 				APP_EVENT_HANDLER_T	moveHandler,
939 				int			timerInterval,
940 				APP_TIMER_CALLBACK	timerHandler,
941 				void *			through );
942 
943 extern void appGuiSetFocusChangeHandler( APP_WIDGET		shell,
944 					APP_EVENT_HANDLER_T	handler,
945 					void *			through );
946 
947 extern void appGuiSetToggleItemState(	APP_WIDGET		toggle,
948 					int			set );
949 
950 extern void appSetDestroyCallback(	APP_WIDGET		shell,
951 					APP_DESTROY_CALLBACK_T	destroyCallback,
952 					void *			through );
953 
954 extern void appSetCloseCallback(	APP_WIDGET		shell,
955 					EditApplication *	ea,
956 					APP_CLOSE_CALLBACK_T	closeCallback,
957 					void *			through );
958 
959 extern void appGuiSetToggleItemLabel(	APP_WIDGET		toggle,
960 					const char *		label );
961 
962 extern int appFormatDocumentTitle(	MemoryBuffer *		windowTitle,
963 					MemoryBuffer *		iconTitle,
964 					EditApplication *	ea,
965 					const MemoryBuffer *	title );
966 
967 extern APP_EVENT_HANDLER_H( appDocConfigure, w, voided, event );
968 
969 extern void appSetWindowsItemState(	APP_WIDGET	menu,
970 					EditDocument *	ed,
971 					int		changed );
972 
973 extern void appRemoveWindowsOption(	APP_WIDGET		menu,
974 					EditDocument *		oldEd );
975 
976 extern void appRenameWindowsOption(	APP_WIDGET		menu,
977 					EditDocument *		ed,
978 					const MemoryBuffer *	title );
979 
980 extern void appAllocateCopyPasteTargetAtoms(	EditApplication *	ea );
981 
982 extern APP_GIVE_COPY( appDocReplyToCopyRequest, w, gsd, voided );
983 
984 extern void appCopyPixmapValue(	APP_SELECTION_EVENT *	event,
985 				APP_BITMAP_IMAGE	pixmapCopied );
986 
987 extern void appGetApplicationResourceValues(	EditApplication *	ea );
988 
989 extern void appDocExposeRectangle(
990 				const EditDocument *		ed,
991 				const DocumentRectangle *	drChanged,
992 				int				scrolledX,
993 				int				scrolledY );
994 
995 extern void appPrintJobForEditDocument(	struct PrintJob *		pj,
996 					EditDocument *			ed,
997 					const struct PrintGeometry *	pg );
998 
999 extern void appApplicationSettingsToPrintGeometry(
1000 					struct PrintGeometry *	pg,
1001 					EditApplication *	ea );
1002 
1003 extern int appDocumentTestCanSave(
1004 				EditApplication *		ea,
1005 				const AppFileExtension *	afe,
1006 				void *				privateData,
1007 				unsigned int			useFlags,
1008 				int				format );
1009 
1010 extern int appDocumentGetSaveFormat(
1011 				int *				pSuggestStdout,
1012 				EditApplication *		ea,
1013 				const MemoryBuffer *		filename,
1014 				void *				privateData,
1015 				unsigned int			useFlags,
1016 				int				format );
1017 
1018 extern int appFileCanOpen(	const EditApplication *		ea,
1019 				int				format );
1020 
1021 int appDocumentGetOpenFormat(	int *				pSuggestStdin,
1022 				const AppFileExtension *	testExts,
1023 				int				testExtCount,
1024 				const MemoryBuffer *		filename,
1025 				int				format );
1026 
1027 extern int appPostScriptFontCatalog(		EditApplication *	ea );
1028 
1029 extern int appGetPrintDestinations(		EditApplication *	ea );
1030 
1031 extern int appReadSystemProperties(	EditApplication *	ea );
1032 extern int appReadUserProperties(	EditApplication *	ea );
1033 extern int appSetUserProperty(		EditApplication *	ea,
1034 					const char *		name,
1035 					const char *		value );
1036 
1037 extern int appSetSystemProperty(	EditApplication *	ea,
1038 					const char *		name,
1039 					const char *		value );
1040 
1041 extern int appGuiSetFrameTitle(		APP_WIDGET		w,
1042 					const char *		title );
1043 
1044 extern void appDocScrollToY(		EditDocument *		ed,
1045 					int			y );
1046 extern void appDocScrollToX(		EditDocument *		ed,
1047 					int			x );
1048 
1049 extern void appGuiFocusToWidget(	APP_WIDGET		w );
1050 
1051 extern const AppSelectionType * appDocGetSelectionType(
1052 				const EditApplication *		ea,
1053 				const char *			selection );
1054 
1055 extern void appInitSelectRectangle(	SelectRectangle *	sr );
1056 
1057 extern void guiShowMenuOption(		APP_WIDGET		w,
1058 					int			visible );
1059 
1060 extern int appSaveToPs(			EditApplication *	ea,
1061 					DrawingSurface		ds,
1062 					SimpleOutputStream *	sos,
1063 					void *			privateData,
1064 					const MemoryBuffer *	documentTitle,
1065 					int			format );
1066 
1067 extern int appMakeDocumentWindow(	EditDocument **		pEd,
1068 					EditApplication *	ea,
1069 					int			readOnly,
1070 					const MemoryBuffer *	title,
1071 					const MemoryBuffer *	filename );
1072 
1073 extern void appGetPixelsPerTwip(	EditApplication *	ea );
1074 
1075 extern int appDocSaveDocument(	EditDocument *		ed,
1076 				void *			through,
1077 				APP_WIDGET		relative,
1078 				APP_WIDGET		option,
1079 				int			format,
1080 				const MemoryBuffer *	filename );
1081 
1082 extern int appDetermineBoolean(	int *			pIval,
1083 				const char *		sVal );
1084 
1085 # ifdef __cplusplus
1086     }
1087 # endif
1088 
1089 #   endif
1090