2010-09-17 18:48:02 +02:00
|
|
|
/*
|
2010-09-17 19:03:03 +02:00
|
|
|
* ld-document.h
|
2010-09-17 18:48:02 +02:00
|
|
|
*
|
|
|
|
* This file is a part of logdiag.
|
|
|
|
* Copyright Přemysl Janouch 2010. All rights reserved.
|
|
|
|
*
|
|
|
|
* See the file LICENSE for licensing information.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2010-09-17 19:16:53 +02:00
|
|
|
#ifndef __LD_DOCUMENT_H__
|
|
|
|
#define __LD_DOCUMENT_H__
|
2010-09-17 18:48:02 +02:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
|
2010-09-17 19:16:53 +02:00
|
|
|
#define LD_TYPE_DOCUMENT (ld_symbol_library_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 \
|
|
|
|
((klass), LD_TYPE_DOCUMENT, LdDocumentClass))
|
|
|
|
#define LD_IS_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE \
|
|
|
|
((obj), LD_TYPE_DOCUMENT))
|
|
|
|
#define LD_IS_DOCUMENT_CLASS(klass) (G_TYPE_CHECK_INSTANCE_TYPE \
|
|
|
|
((klass), LD_TYPE_DOCUMENT))
|
|
|
|
#define LD_DOCUMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS \
|
|
|
|
((obj), LD_DOCUMENT, LdDocumentClass))
|
2010-09-17 18:48:02 +02:00
|
|
|
|
2010-09-17 19:16:53 +02:00
|
|
|
typedef struct _LdDocument LdDocument;
|
|
|
|
typedef struct _LdDocumentClass LdDocumentClass;
|
2010-09-17 18:48:02 +02:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2010-09-17 19:16:53 +02:00
|
|
|
* LdDocument:
|
2010-09-18 08:55:13 +02:00
|
|
|
*
|
|
|
|
* A document object.
|
2010-09-17 18:48:02 +02:00
|
|
|
*/
|
2010-09-17 19:16:53 +02:00
|
|
|
struct _LdDocument
|
2010-09-17 18:48:02 +02:00
|
|
|
{
|
|
|
|
/*< private >*/
|
|
|
|
GObject parent_instance;
|
|
|
|
|
|
|
|
/*< public >*/
|
|
|
|
};
|
|
|
|
|
2010-09-17 19:16:53 +02:00
|
|
|
struct _LdDocumentClass
|
2010-09-17 18:48:02 +02:00
|
|
|
{
|
|
|
|
GObjectClass parent_class;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-09-17 19:16:53 +02:00
|
|
|
GType ld_document_get_type (void) G_GNUC_CONST;
|
2010-09-17 18:48:02 +02:00
|
|
|
|
2010-09-17 19:16:53 +02:00
|
|
|
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);
|
2010-09-17 18:48:02 +02:00
|
|
|
|
|
|
|
#if 0
|
2010-09-18 08:55:13 +02:00
|
|
|
/* ===== Data proposal ===================================================== */
|
|
|
|
typedef struct _LdDocumentPrivate LdDocumentPrivate;
|
|
|
|
|
2010-09-17 18:48:02 +02:00
|
|
|
/*
|
2010-09-17 19:16:53 +02:00
|
|
|
* LdDocumentPrivate:
|
2010-09-17 18:48:02 +02:00
|
|
|
* @objects: All the objects in the document.
|
2010-09-18 08:55:13 +02:00
|
|
|
* @selection: All currently selected objects.
|
2010-09-17 18:48:02 +02:00
|
|
|
*/
|
2010-09-17 19:16:53 +02:00
|
|
|
struct _LdDocumentPrivate
|
2010-09-17 18:48:02 +02:00
|
|
|
{
|
|
|
|
GSList *objects;
|
2010-09-18 08:55:13 +02:00
|
|
|
GSList *selection;
|
2010-09-17 18:48:02 +02:00
|
|
|
};
|
|
|
|
|
2010-09-18 08:55:13 +02:00
|
|
|
/* ===== 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);
|
2010-09-17 18:48:02 +02:00
|
|
|
|
2010-09-18 08:55:13 +02:00
|
|
|
/* TODO: Create an interface for a list of this object: */
|
|
|
|
/* NOTE: In the future, labels will be also supported. */
|
2010-09-17 19:16:53 +02:00
|
|
|
LdDocumentSymbol
|
2010-09-17 18:48:02 +02:00
|
|
|
|
2010-09-18 08:55:13 +02:00
|
|
|
/* TODO: Create an interface for wires between pins of various symbols. */
|
2010-09-17 18:48:02 +02:00
|
|
|
|
2010-09-18 08:55:13 +02:00
|
|
|
/* TODO: Create an interface for object selection. */
|
2010-09-17 19:16:53 +02:00
|
|
|
ld_document_selection_...
|
2010-09-18 08:55:13 +02:00
|
|
|
|
|
|
|
gchar *
|
2010-09-17 19:16:53 +02:00
|
|
|
ld_document_selection_get_json (LdDocument *self);
|
2010-09-18 08:55:13 +02:00
|
|
|
|
2010-09-17 18:48:02 +02:00
|
|
|
#endif /* 0 */
|
|
|
|
|
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
2010-09-17 19:16:53 +02:00
|
|
|
#endif /* ! __LD_DOCUMENT_H__ */
|
|
|
|
|