28#ifndef GEANY_DOCUMENT_H
29#define GEANY_DOCUMENT_H 1
74#define GEANY_TYPE_DOCUMENT (document_get_type())
130#define documents ((GeanyDocument **)GEANY(documents_array)->pdata)
136#ifndef GEANY_DISABLE_DEPRECATED
137#define documents_foreach(i) foreach_document(i)
153#define foreach_document(i) \
154 for (i = 0; i < GEANY(documents_array)->len; i++)\
155 if (!documents[i]->is_valid)\
162#define DOC_VALID(doc_ptr) \
163 ((doc_ptr) != NULL && (doc_ptr)->is_valid)
170#define DOC_FILENAME(doc) \
171 (G_LIKELY((doc)->file_name != NULL) ? ((doc)->file_name) : GEANY_STRING_UNTITLED)
192 const gchar *forced_enc);
229#if defined(G_OS_WIN32)
230# define GEANY_DEFAULT_EOL_CHARACTER SC_EOL_CRLF
232# define GEANY_DEFAULT_EOL_CHARACTER SC_EOL_LF
262 gboolean readonly,
GeanyFiletype *ft,
const gchar *forced_enc);
271 gboolean scroll, GtkWidget *parent);
274 const gchar *replace_text,
GeanyFindFlags flags, gboolean search_backwards);
277 const gchar *original_find_text,
const gchar *original_replace_text,
GeanyFindFlags flags);
280 const gchar *original_find_text,
const gchar *original_replace_text,
GeanyFindFlags flags);
325 gpointer
data, GDestroyNotify free_func);
Interface to the edit control.
void document_init_doclist(void)
void document_update_tags(GeanyDocument *doc)
GeanyDocument * document_open_file_full(GeanyDocument *doc, const gchar *filename, gint pos, gboolean readonly, GeanyFiletype *ft, const gchar *forced_enc)
void document_redo(GeanyDocument *doc)
gboolean document_close_all(void)
GeanyDocument * document_clone(GeanyDocument *old_doc)
gint document_find_text(GeanyDocument *doc, const gchar *text, const gchar *original_text, GeanyFindFlags flags, gboolean search_backwards, GeanyMatchInfo **match_, gboolean scroll, GtkWidget *parent)
gboolean document_can_redo(GeanyDocument *doc)
GeanyDocument * document_new_file_if_non_open(void)
void document_grab_focus(GeanyDocument *doc)
void document_undo_add(GeanyDocument *doc, guint type, gpointer data)
void document_set_data_full(GeanyDocument *doc, const gchar *key, gpointer data, GDestroyNotify free_func)
gboolean document_search_bar_find(GeanyDocument *doc, const gchar *text, gboolean inc, gboolean backwards)
void document_highlight_tags(GeanyDocument *doc)
void document_show_tab(GeanyDocument *doc)
gboolean document_check_disk_status(GeanyDocument *doc, gboolean force)
GeanyDocument * document_find_by_sci(ScintillaObject *sci)
gboolean document_detect_indent_type(GeanyDocument *doc, GeanyIndentType *type_)
void document_try_focus(GeanyDocument *doc, GtkWidget *source_widget)
gpointer document_get_data(const GeanyDocument *doc, const gchar *key)
gint document_replace_text(GeanyDocument *doc, const gchar *find_text, const gchar *original_find_text, const gchar *replace_text, GeanyFindFlags flags, gboolean search_backwards)
void document_update_tag_list_in_idle(GeanyDocument *doc)
void document_apply_indent_settings(GeanyDocument *doc)
gboolean document_need_save_as(GeanyDocument *doc)
const gchar * document_get_status_widget_class(GeanyDocument *doc)
gboolean document_account_for_unsaved(void)
GeanyFilePrefs file_prefs
void document_reload_config(GeanyDocument *doc)
void document_undo(GeanyDocument *doc)
void document_set_data(GeanyDocument *doc, const gchar *key, gpointer data)
gboolean document_can_undo(GeanyDocument *doc)
GPtrArray * documents_array
gboolean document_detect_indent_width(GeanyDocument *doc, gint *width_)
void document_open_file_list(const gchar *data, gsize length)
gboolean document_reload_prompt(GeanyDocument *doc, const gchar *forced_enc)
void document_replace_sel(GeanyDocument *doc, const gchar *find_text, const gchar *replace_text, const gchar *original_find_text, const gchar *original_replace_text, GeanyFindFlags flags)
void document_update_tab_label(GeanyDocument *doc)
gint document_replace_all(GeanyDocument *doc, const gchar *find_text, const gchar *replace_text, const gchar *original_find_text, const gchar *original_replace_text, GeanyFindFlags flags)
void document_finalize(void)
GeanyDocument * document_index(gint idx)
Accessor function for GeanyData::documents_array items.
GType document_get_type(void)
GeanyDocument * document_get_current(void)
Finds the current document.
void document_set_encoding(GeanyDocument *doc, const gchar *new_encoding)
Sets the encoding of a document.
struct GeanyDocument GeanyDocument
Structure for representing an open tab with all its properties.
const GdkColor * document_get_status_color(GeanyDocument *doc)
Gets the status color of the document, or NULL if default widget coloring should be used.
gboolean document_save_file_as(GeanyDocument *doc, const gchar *utf8_fname)
Saves the document, detecting the filetype.
GeanyDocument * document_get_from_notebook_child(GtkWidget *page)
struct GeanyFilePrefs GeanyFilePrefs
File Prefs.
GeanyDocument * document_get_from_page(guint page_num)
Finds the document for the given notebook page page_num.
gint document_get_notebook_page(GeanyDocument *doc)
Gets the notebook page index for a document.
gboolean document_reload_force(GeanyDocument *doc, const gchar *forced_enc)
Reloads the document with the specified file encoding.
gboolean document_save_file(GeanyDocument *doc, gboolean force)
Saves the document.
void document_set_filetype(GeanyDocument *doc, GeanyFiletype *type)
Sets the filetype of the document (which controls syntax highlighting and tags)
void document_rename_file(GeanyDocument *doc, const gchar *new_filename)
Renames the file in doc to new_filename.
gint document_compare_by_display_name(gconstpointer a, gconstpointer b)
Compares documents by their display names.
gint document_compare_by_tab_order(gconstpointer a, gconstpointer b)
Compares documents by their tab order.
GeanyDocument * document_find_by_filename(const gchar *utf8_filename)
Finds a document with the given filename.
void document_open_files(const GSList *filenames, gboolean readonly, GeanyFiletype *ft, const gchar *forced_enc)
Opens each file in the list filenames.
gchar * document_get_basename_for_display(GeanyDocument *doc, gint length)
Returns the last part of the filename of the given GeanyDocument.
GeanyDocument * document_open_file(const gchar *locale_filename, gboolean readonly, GeanyFiletype *ft, const gchar *forced_enc)
Opens a document specified by locale_filename.
GeanyDocument * document_new_file(const gchar *filename, GeanyFiletype *ft, const gchar *text)
Creates a new document.
GeanyDocument * document_find_by_id(guint id)
Lookup an old document by its ID.
gboolean document_remove_page(guint page_num)
Removes the given notebook tab at page_num and clears all related information in the document list.
gboolean document_close(GeanyDocument *doc)
Closes the given document.
GeanyDocument * document_find_by_real_path(const gchar *realname)
Finds a document whose real_path field matches the given filename.
gint document_compare_by_tab_order_reverse(gconstpointer a, gconstpointer b)
Compares documents by their tab order, in reverse order.
void document_set_text_changed(GeanyDocument *doc, gboolean changed)
Updates the tab labels, the status bar, the window title and some save-sensitive buttons according to...
Editor-related functions for GeanyEditor.
GeanyIndentType
Whether to use tabs, spaces or both to indent.
Filetype detection, file extensions and filetype menu items.
Structure for representing an open tab with all its properties.
gchar * file_name
The UTF-8 encoded file name.
gboolean changed
Whether this document has been changed since it was last saved.
GeanyFiletype * file_type
The filetype for this document, it's only a reference to one of the elements of the global filetypes ...
gboolean has_tags
Whether this document supports source code symbols(tags) to show in the sidebar.
struct GeanyDocumentPrivate * priv
gboolean has_bom
Internally used flag to indicate whether the file of this document has a byte-order-mark.
gchar * real_path
The link-dereferenced, locale-encoded file name.
gchar * encoding
The encoding of the document, must be a valid string representation of an encoding,...
gboolean readonly
Whether this document is read-only.
gboolean is_valid
Flag used to check if this document is valid when iterating GeanyData::documents_array.
gint index
Index in the documents array.
GeanyEditor * editor
The editor associated with the document.
guint id
A pseudo-unique ID for this document.
TMSourceFile * tm_file
TMSourceFile object for this document, or NULL.
Editor-owned fields for each document.
gboolean reload_clean_doc_on_file_change
gboolean use_safe_file_saving
gboolean keep_edit_history_on_reload
gint default_new_encoding
gboolean show_keep_edit_history_on_reload_msg
gboolean tab_order_beside
gint default_open_encoding
gboolean gio_unsafe_save_backup
gboolean use_gio_unsafe_file_saving
gboolean strip_trailing_spaces
gboolean cmdline_new_files
gchar * extract_filetype_regex
gint default_eol_character
gboolean ensure_convert_new_lines
gboolean save_config_on_file_change
gboolean tab_close_switch_to_mru
The TMSourceFile structure represents the source file and its tags in the tag manager.