1 /*
2  * xed-document.h
3  * This file is part of xed
4  *
5  * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
6  * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi
7  * Copyright (C) 2002-2005 Paolo Maggi
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor,
22  * Boston, MA 02110-1301, USA.
23  */
24 
25 /*
26  * Modified by the xed Team, 1998-2005. See the AUTHORS file for a
27  * list of people on the xed Team.
28  * See the ChangeLog files for a list of changes.
29  *
30  * $Id$
31  */
32 
33 #ifndef __XED_DOCUMENT_H__
34 #define __XED_DOCUMENT_H__
35 
36 #include <gtksourceview/gtksource.h>
37 
38 G_BEGIN_DECLS
39 
40 #define XED_TYPE_DOCUMENT (xed_document_get_type())
41 
42 G_DECLARE_DERIVABLE_TYPE (XedDocument, xed_document, XED, DOCUMENT, GtkSourceBuffer)
43 
44 #define XED_METADATA_ATTRIBUTE_POSITION "metadata::xed-position"
45 #define XED_METADATA_ATTRIBUTE_ENCODING "metadata::xed-encoding"
46 #define XED_METADATA_ATTRIBUTE_LANGUAGE "metadata::xed-language"
47 
48 struct _XedDocumentClass
49 {
50     GtkSourceBufferClass parent_class;
51 
52     /* Signals */
53 
54     void (* cursor_moved)   (XedDocument *document);
55 
56     void (* load)           (XedDocument *document);
57 
58     void (* loaded)         (XedDocument *document);
59 
60     void (* save)           (XedDocument *document);
61 
62     void (* saved)          (XedDocument *document);
63 };
64 
65 XedDocument *xed_document_new (void);
66 
67 GtkSourceFile *xed_document_get_file (XedDocument *doc);
68 
69 GFile *xed_document_get_location (XedDocument *doc);
70 
71 void xed_document_set_location (XedDocument *doc,
72                                 GFile       *location);
73 
74 gchar *xed_document_get_uri_for_display (XedDocument *doc);
75 
76 gchar *xed_document_get_short_name_for_display (XedDocument *doc);
77 
78 void xed_document_set_short_name_for_display (XedDocument *doc,
79                                               const gchar *short_name);
80 
81 gchar *xed_document_get_content_type (XedDocument *doc);
82 
83 void xed_document_set_content_type (XedDocument *doc,
84                                     const gchar *content_type);
85 
86 gchar *xed_document_get_mime_type (XedDocument *doc);
87 
88 gboolean xed_document_get_readonly (XedDocument *doc);
89 
90 gboolean xed_document_is_untouched (XedDocument *doc);
91 gboolean xed_document_is_untitled (XedDocument *doc);
92 
93 gboolean xed_document_is_local (XedDocument *doc);
94 
95 gboolean xed_document_get_deleted (XedDocument *doc);
96 
97 gboolean xed_document_goto_line (XedDocument *doc,
98                                  gint         line);
99 
100 gboolean xed_document_goto_line_offset (XedDocument *doc,
101                                         gint         line,
102                                         gint         line_offset);
103 
104 void  xed_document_set_language (XedDocument       *doc,
105                                  GtkSourceLanguage *lang);
106 GtkSourceLanguage *xed_document_get_language (XedDocument *doc);
107 
108 const GtkSourceEncoding *xed_document_get_encoding (XedDocument *doc);
109 
110 GtkSourceNewlineType xed_document_get_newline_type (XedDocument *doc);
111 
112 gchar *xed_document_get_metadata (XedDocument *doc,
113                                   const gchar *key);
114 
115 void xed_document_set_metadata (XedDocument *doc,
116                                 const gchar *first_key,
117                                 ...);
118 
119 void xed_document_set_search_context (XedDocument            *doc,
120                                       GtkSourceSearchContext *search_context);
121 
122 GtkSourceSearchContext *xed_document_get_search_context (XedDocument *doc);
123 
124 G_END_DECLS
125 
126 #endif /* __XED_DOCUMENT_H__ */
127