Updated Spanish translation
[anjuta-git-plugin.git] / plugins / sourceview / anjuta-document.h
blob57ddb68e1b28464f74a70c4b5c8ed4478aa1b722
1 /*
2 * anjuta-document.h
3 * This file is part of anjuta
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
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.
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.
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 Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA.
26 * Modified by the anjuta Team, 1998-2005. See the AUTHORS file for a
27 * list of people on the anjuta Team.
28 * See the ChangeLog files for a list of changes.
30 * $Id$
33 #ifndef __ANJUTA_DOCUMENT_H__
34 #define __ANJUTA_DOCUMENT_H__
36 #include <gtk/gtk.h>
37 #include <gtksourceview/gtksourcebuffer.h>
38 #include <libgnomevfs/gnome-vfs.h>
40 #include <libanjuta/anjuta-encodings.h>
42 G_BEGIN_DECLS
45 * Type checking and casting macros
47 #define ANJUTA_TYPE_DOCUMENT (anjuta_document_get_type())
48 #define ANJUTA_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ANJUTA_TYPE_DOCUMENT, AnjutaDocument))
49 #define ANJUTA_DOCUMENT_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ANJUTA_TYPE_DOCUMENT, AnjutaDocument const))
50 #define ANJUTA_DOCUMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), ANJUTA_TYPE_DOCUMENT, AnjutaDocumentClass))
51 #define ANJUTA_IS_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), ANJUTA_TYPE_DOCUMENT))
52 #define ANJUTA_IS_DOCUMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ANJUTA_TYPE_DOCUMENT))
53 #define ANJUTA_DOCUMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), ANJUTA_TYPE_DOCUMENT, AnjutaDocumentClass))
55 /* Private structure type */
56 typedef struct _AnjutaDocumentPrivate AnjutaDocumentPrivate;
59 * Main object structure
61 typedef struct _AnjutaDocument AnjutaDocument;
63 struct _AnjutaDocument
65 GtkSourceBuffer buffer;
67 /*< private > */
68 AnjutaDocumentPrivate *priv;
72 * Class definition
74 typedef struct _AnjutaDocumentClass AnjutaDocumentClass;
76 struct _AnjutaDocumentClass
78 GtkSourceBufferClass parent_class;
80 /* Signals */ // CHECK: ancora da rivedere
82 void (* cursor_moved) (AnjutaDocument *document);
84 /* Document load */
85 void (* loading) (AnjutaDocument *document,
86 GnomeVFSFileSize size,
87 GnomeVFSFileSize total_size);
89 void (* loaded) (AnjutaDocument *document,
90 const GError *error);
92 /* Document save */
93 void (* saving) (AnjutaDocument *document,
94 GnomeVFSFileSize size,
95 GnomeVFSFileSize total_size);
97 void (* saved) (AnjutaDocument *document,
98 const GError *error);
103 typedef enum
105 /* save file despite external modifications */
106 ANJUTA_DOCUMENT_SAVE_IGNORE_MTIME = 1 << 0,
108 /* write the file directly without attempting to backup */
109 ANJUTA_DOCUMENT_SAVE_IGNORE_BACKUP = 1 << 1,
111 /* preserve previous backup file, needed to support autosaving */
112 ANJUTA_DOCUMENT_SAVE_PRESERVE_BACKUP = 1 << 2
113 } AnjutaDocumentSaveFlags;
116 #define ANJUTA_DOCUMENT_ERROR anjuta_document_error_quark ()
118 enum
120 /* start at GNOME_VFS_NUM_ERRORS since we use GnomeVFSResult
121 * for the error codes */
122 ANJUTA_DOCUMENT_ERROR_EXTERNALLY_MODIFIED = GNOME_VFS_NUM_ERRORS,
123 ANJUTA_DOCUMENT_ERROR_NOT_REGULAR_FILE,
124 ANJUTA_DOCUMENT_ERROR_CANT_CREATE_BACKUP,
125 ANJUTA_DOCUMENT_NUM_ERRORS
128 GQuark anjuta_document_error_quark (void);
130 GType anjuta_document_get_type (void) G_GNUC_CONST;
132 AnjutaDocument *anjuta_document_new (void);
134 gchar *anjuta_document_get_uri (AnjutaDocument *doc);
136 gchar *anjuta_document_get_uri_for_display
137 (AnjutaDocument *doc);
138 gchar *anjuta_document_get_short_name_for_display
139 (AnjutaDocument *doc);
141 gboolean anjuta_document_get_readonly (AnjutaDocument *doc);
143 void anjuta_document_load (AnjutaDocument *doc,
144 const gchar *uri,
145 const AnjutaEncoding *encoding,
146 gint line_pos,
147 gboolean create);
149 gboolean anjuta_document_load_cancel (AnjutaDocument *doc);
151 void anjuta_document_save (AnjutaDocument *doc,
152 AnjutaDocumentSaveFlags flags);
154 void anjuta_document_save_as (AnjutaDocument *doc,
155 const gchar *uri,
156 const AnjutaEncoding *encoding,
157 AnjutaDocumentSaveFlags flags);
159 gboolean anjuta_document_goto_line (AnjutaDocument *doc,
160 gint line);
163 const AnjutaEncoding
164 *anjuta_document_get_encoding (AnjutaDocument *doc);
166 gchar* anjuta_document_get_current_word(AnjutaDocument* doc,
167 gboolean end_position);
170 G_END_DECLS
172 #endif /* __ANJUTA_DOCUMENT_H__ */