1 /************************************************************************/
2 /*									*/
3 /*  Header file for internal use by the FileChooser implementation.	*/
4 /*									*/
5 /************************************************************************/
6 
7 #   include	"appFrame.h"
8 #   include	"guiOptionmenu.h"
9 
10 /************************************************************************/
11 /*									*/
12 /*  For opening/saving documents.					*/
13 /*									*/
14 /************************************************************************/
15 
16 #   define	ACIrespNONE	0
17 #   define	ACIrespSAVE	1
18 #   define	ACIrespCANCEL	2
19 #   define	ACIrespOPEN	3
20 #   define	ACIrespFAILURE	4
21 
22 typedef struct AppFileChooserResources
23     {
24     char *			acrNoFilenameMessage;
25     char *			acrIsDirecoryMessage;
26     char *			acrNotWritableMessage;
27     char *			acrNotReadableMessage;
28     char *			acrOverwriteMessage;
29     char *			acrNoSuchDirMessage;
30     } AppFileChooserResources;
31 
32 typedef int (*APP_OPEN_DOCUMENT)(	EditApplication *	ea,
33 					void *			through,
34 					APP_WIDGET		relative,
35 					APP_WIDGET		option,
36 					const MemoryBuffer *	filename );
37 
38 typedef int (*APP_SAVE_DOCUMENT)(	EditDocument *		ed,
39 					void *			through,
40 					APP_WIDGET		relative,
41 					APP_WIDGET		option,
42 					int			format,
43 					const MemoryBuffer *	filename );
44 
45 typedef struct AppChooserInformation
46     {
47 #   ifdef USE_MOTIF
48     AppDialog				aciDialog;
49 #   endif
50 #   ifdef USE_GTK
51 #	ifdef GTK_RESPONSE_ACCEPT
52 	    APP_WIDGET			aciWidget;
53 #	endif
54 	    AppDialog			aciDialog;
55 #	    define 			aciWidget aciDialog.adTopWidget
56 #	else
57 #   endif
58 
59     EditApplication *			aciApplication;
60     EditDocument *			aciDocument;
61     MemoryBuffer			aciFilename;
62     void *				aciThrough;
63     APP_OPEN_DOCUMENT			aciOpenDocument;
64     APP_SAVE_DOCUMENT			aciSaveDocument;
65     const AppFileExtension *		aciExtensions;
66     int					aciExtensionCount;
67     AppOptionmenu			aciFilterOptionmenu;
68     APP_WIDGET				aciOption;
69     APP_WIDGET				aciRelativeTo;
70     int					aciFormat;
71 
72     const AppFileChooserResources *	aciResources;
73     } AppChooserInformation;
74 
75 #   define FILE_CHOOSER_CAN_OPEN( afe ) ( \
76       (     (afe)->afeUseFlags & APPFILE_CAN_OPEN )		&& \
77       ( ! ( (afe)->afeUseFlags & APPFILE_IS_BASIC_TYPE ) )	&& \
78       ( ! ( (afe)->afeUseFlags & APPFILE_HIDE_OPEN ) )		)
79 
80 /************************************************************************/
81 /*									*/
82 /*  Procedure declarations.						*/
83 /*									*/
84 /************************************************************************/
85 
86 extern void appFileChooserGetTexts(	EditApplication *		ea,
87 					AppChooserInformation *		aci );
88 
89 extern int appFileChooserTestNameForOpen(
90 				const AppChooserInformation *	aci );
91 
92 extern int appFileChooserTestNameForWrite(
93 				const AppChooserInformation *	aci );
94 
95 extern int appChooserSaveFilename(	AppChooserInformation *	aci,
96 					const MemoryBuffer *	filename,
97 					const char *		extension );
98 
99 extern int appRunSaveChooser(	APP_WIDGET		option,
100 				APP_WIDGET		relative,
101 				unsigned int		useFlags,
102 				APP_SAVE_DOCUMENT	saveDocument,
103 				EditDocument *		ed,
104 				void *			through );
105 
106 extern int appRunPrintToFileChooser(
107 				APP_WIDGET		option,
108 				APP_WIDGET		relative,
109 				APP_SAVE_DOCUMENT	saveDocument,
110 				EditDocument *		ed,
111 				void *			through );
112 
113 extern void appRunOpenChooser(	APP_WIDGET		option,
114 				APP_WIDGET		relative,
115 				int			extensionCount,
116 				AppFileExtension *	openExtensions,
117 				const char *		defaultFilter,
118 				const MemoryBuffer *	dir,
119 				APP_OPEN_DOCUMENT	openDocument,
120 				EditApplication *	ea,
121 				void *			through );
122 
123 extern int appFileFilterGetDescriptions(
124 				EditApplication *	ea,
125 				AppFileExtension *	extensions,
126 				int			extensionCount );
127 
128 extern int appFileChooserConfirmOverWrite(
129 				const AppChooserInformation *	aci,
130 				const char *			filename );
131 
132 extern int appChooserOpenDocument(	EditApplication *	ea,
133 					void *			through,
134 					APP_WIDGET		relative,
135 					APP_WIDGET		option,
136 					const MemoryBuffer *	filename );
137 
138