From 147cf2977ab29d1ab9b9d776ceff5b73a10ac297 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Janouch?= Date: Sat, 4 Dec 2010 14:23:55 +0100 Subject: Initial LdDocument implementation. The document maintains a list of LdDocumentObject objects. --- src/ld-document.h | 71 ++++++++++++++++++++++--------------------------------- 1 file changed, 28 insertions(+), 43 deletions(-) (limited to 'src/ld-document.h') diff --git a/src/ld-document.h b/src/ld-document.h index 32eb0c4..12d59cb 100644 --- a/src/ld-document.h +++ b/src/ld-document.h @@ -14,7 +14,7 @@ G_BEGIN_DECLS -#define LD_TYPE_DOCUMENT (ld_library_get_type ()) +#define LD_TYPE_DOCUMENT (ld_document_get_type ()) #define LD_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST \ ((obj), LD_TYPE_DOCUMENT, LdDocument)) #define LD_DOCUMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST \ @@ -28,6 +28,7 @@ G_BEGIN_DECLS typedef struct _LdDocument LdDocument; typedef struct _LdDocumentClass LdDocumentClass; +typedef struct _LdDocumentPrivate LdDocumentPrivate; /** @@ -39,62 +40,46 @@ struct _LdDocument { /*< private >*/ GObject parent_instance; + LdDocumentPrivate *priv; }; struct _LdDocumentClass { /*< private >*/ GObjectClass parent_class; + + guint changed_signal; }; GType ld_document_get_type (void) G_GNUC_CONST; LdDocument *ld_document_new (void); -gboolean ld_document_new_from_file (const char *file_name, GError *error); -gboolean ld_document_save_to_file (const char *file_name, GError *error); - -#if 0 -/* ===== Data proposal ===================================================== */ -typedef struct _LdDocumentPrivate LdDocumentPrivate; +void ld_document_clear (LdDocument *self); +gboolean ld_document_load_from_file (LdDocument *self, + const gchar *filename, GError *error); +gboolean ld_document_save_to_file (LdDocument *self, + const gchar *filename, GError *error); + +GSList *ld_document_get_objects (LdDocument *self); +void ld_document_insert_object (LdDocument *self, + LdDocumentObject *object, gint pos); +void ld_document_remove_object (LdDocument *self, + LdDocumentObject *object); + +GSList *ld_document_get_selection (LdDocument *self); +void ld_document_selection_add (LdDocument *self, + LdDocumentObject *object, gint pos); +void ld_document_selection_remove (LdDocument *self, + LdDocumentObject *object); /* - * LdDocumentPrivate: - * @objects: All the objects in the document. - * @selection: All currently selected objects. - */ -struct _LdDocumentPrivate -{ - GSList *objects; - GSList *selection; -}; - -/* ===== Interface proposal ================================================ */ -/* The contents of the document have changed. */ -signal document-changed (...) - -/* Add a symbol to the document at specified coordinates. */ -/* TODO: Should the coordinates be double or int? */ -void -ld_document_add_symbol (LdSymbol *symbol, x, y); - -/* Parse a document in JSON and insert it into the document. */ -gboolean -ld_document_insert_json (LdDocument *self, GError *error); - -/* TODO: Create an interface for a list of this object: */ -/* NOTE: In the future, labels will be also supported. */ -LdDocumentSymbol - -/* TODO: Create an interface for wires between pins of various symbols. */ - -/* TODO: Create an interface for object selection. */ -ld_document_selection_... - -gchar * -ld_document_selection_get_json (LdDocument *self); - -#endif /* 0 */ +GSList *ld_document_get_connections (LdDocument *self); +void ld_document_connection_add (LdDocument *self, + LdConnection *connection, gint pos); +void ld_document_connection_remove (LdDocument *self, + LdConnection *connection); +*/ G_END_DECLS -- cgit v1.2.3