#ifndef NEDIT_FILE_H_INCLUDED
#define NEDIT_FILE_H_INCLUDED
#include "nedit.h"
#include "../util/getfiles.h"
#include <X11/Intrinsic.h>
#define CREATE 1
#define SUPPRESS_CREATE_WARN 2
#define PREF_READ_ONLY 4
#define PROMPT_SBC_DIALOG_RESPONSE 0
#define YES_SBC_DIALOG_RESPONSE 1
#define NO_SBC_DIALOG_RESPONSE 2
typedef struct DefaultEncoding {
char *locale;
char *encoding;
} DefaultEncoding;
typedef struct FileContent {
struct stat statbuf;
char *content;
size_t length;
int readonly;
int hasBOM;
int fileFormat;
int isdir;
int isblk;
int allocerror;
int iconverror;
int closeerror;
int skipped;
int err;
EncError *enc_errors;
size_t num_enc_errors;
char encoding[
MAX_ENCODING_LENGTH];
} FileContent;
WindowInfo *EditNewFile(WindowInfo *inWindow,
char *geometry,
int iconic,
const char *languageMode,
const char *defaultPath);
WindowInfo *EditExistingFile(WindowInfo *inWindow,
const char *name,
const char *path,
const char *encoding,
const char *filter,
int flags,
char *geometry,
int iconic,
const char *languageMode,
int tabbed,
int bgOpen);
void RevertToSaved(WindowInfo *window,
char *newEncoding);
int SaveWindow(WindowInfo *window);
int SaveWindowAs(WindowInfo *window, FileSelection *file);
int CloseAllFilesAndWindows(
void);
int CloseFileAndWindow(WindowInfo *window,
int preResponse);
void PrintWindow(WindowInfo *window,
int selectedOnly);
void PrintString(
const char *string,
int length, Widget parent,
const char *jobName);
int WriteBackupFile(WindowInfo *window);
int IncludeFile(WindowInfo *window,
const char *name,
const char *encoding,
const char *filter_name);
int PromptForExistingFile(WindowInfo *window,
char *prompt, FileSelection *file);
int PromptForNewFile(WindowInfo *window,
char *prompt, FileSelection *file,
int *fileFormat);
int CheckReadOnly(WindowInfo *window);
void RemoveBackupFile(WindowInfo *window);
void UniqueUntitledName(
char *name);
void CheckForChangesToFile(WindowInfo *window);
const char * DetectEncoding(
const char *buf,
size_t len,
const char *def);
int GetFileContent(Widget shell,
const char *path,
const char *encoding,
const char *filter_name, FileContent *content);
#endif