diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2010-12-04 14:23:55 +0100 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2010-12-05 15:15:52 +0100 |
commit | 147cf2977ab29d1ab9b9d776ceff5b73a10ac297 (patch) | |
tree | 750ca363eb0d62af7d9ce45ca5ac301d097b3b5e /src/ld-document.h | |
parent | 7a0b280854582a6a2a62185c2b73510e00f7579f (diff) | |
download | logdiag-147cf2977ab29d1ab9b9d776ceff5b73a10ac297.tar.gz logdiag-147cf2977ab29d1ab9b9d776ceff5b73a10ac297.tar.xz logdiag-147cf2977ab29d1ab9b9d776ceff5b73a10ac297.zip |
Initial LdDocument implementation.
The document maintains a list of LdDocumentObject objects.
Diffstat (limited to 'src/ld-document.h')
-rw-r--r-- | src/ld-document.h | 71 |
1 files changed, 28 insertions, 43 deletions
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 |