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 #ifndef NEDIT_FILE_H_INCLUDED
28 #define NEDIT_FILE_H_INCLUDED
29
30 #include "nedit.h"
31
32 #include "../util/getfiles.h"
33
34 #include <X11/Intrinsic.h>
35
36
37 #define CREATE 1
38 #define SUPPRESS_CREATE_WARN 2
39 #define PREF_READ_ONLY 4
40
41 #define PROMPT_SBC_DIALOG_RESPONSE 0
42 #define YES_SBC_DIALOG_RESPONSE 1
43 #define NO_SBC_DIALOG_RESPONSE 2
44
45 typedef struct DefaultEncoding {
46 char *locale;
47 char *encoding;
48 } DefaultEncoding;
49
50 typedef struct FileContent {
51 struct stat statbuf;
52 char *content;
53 size_t length;
54 int readonly;
55 int hasBOM;
56 int fileFormat;
57 int isdir;
58 int isblk;
59 int allocerror;
60 int iconverror;
61 int closeerror;
62 int skipped;
63 int err;
64 EncError *enc_errors;
65 size_t num_enc_errors;
66 char encoding[
MAX_ENCODING_LENGTH];
67 } FileContent;
68
69
70 WindowInfo *EditNewFile(WindowInfo *inWindow,
char *geometry,
int iconic,
71 const char *languageMode,
const char *defaultPath);
72 WindowInfo *EditExistingFile(WindowInfo *inWindow,
const char *name,
73 const char *path,
const char *encoding,
const char *filter,
int flags,
74 char *geometry,
int iconic,
const char *languageMode,
int tabbed,
75 int bgOpen);
76 void RevertToSaved(WindowInfo *window,
char *newEncoding);
77 int SaveWindow(WindowInfo *window);
78 int SaveWindowAs(WindowInfo *window, FileSelection *file);
79 int CloseAllFilesAndWindows(
void);
80 int CloseFileAndWindow(WindowInfo *window,
int preResponse);
81 void PrintWindow(WindowInfo *window,
int selectedOnly);
82 void PrintString(
const char *string,
int length, Widget parent,
const char *jobName);
83 int WriteBackupFile(WindowInfo *window);
84 int IncludeFile(WindowInfo *window,
const char *name,
const char *encoding,
const char *filter_name);
85 int PromptForExistingFile(WindowInfo *window,
char *prompt, FileSelection *file);
86 int PromptForNewFile(WindowInfo *window,
char *prompt, FileSelection *file,
87 int *fileFormat);
88 int CheckReadOnly(WindowInfo *window);
89 void RemoveBackupFile(WindowInfo *window);
90 void UniqueUntitledName(
char *name);
91 void CheckForChangesToFile(WindowInfo *window);
92
93 const char * DetectEncoding(
const char *buf,
size_t len,
const char *def);
94
95 int GetFileContent(Widget shell,
const char *path,
const char *encoding,
const char *filter_name, FileContent *content);
96
97 #endif
98