summaryrefslogtreecommitdiff
path: root/src/ld-symbol.c
blob: 15b9ab5b2f39f4b40a603e5db69fc97bce093b63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/*
 * ld-symbol.c
 *
 * This file is a part of logdiag.
 * Copyright Přemysl Janouch 2010. All rights reserved.
 *
 * See the file LICENSE for licensing information.
 *
 */

#include <gtk/gtk.h>

#include "config.h"

#include "ld-symbol-library.h"
#include "ld-symbol-category.h"
#include "ld-symbol.h"


/**
 * SECTION:ld-symbol
 * @short_description: A symbol.
 * @see_also: #LdDocument, #LdCanvas
 *
 * #LdSymbol represents a symbol in the #LdDocument that is in turn
 * drawn onto the #LdCanvas.
 */

/*
 * LdSymbolPrivate:
 * @library: The parent LdSymbolLibrary.
 * The library contains the real function for rendering.
 */
struct _LdSymbolPrivate
{
	LdSymbolLibrary *library;
};

G_DEFINE_TYPE (LdSymbol, ld_symbol, G_TYPE_OBJECT);

static void
ld_symbol_finalize (GObject *gobject);


static void
ld_symbol_class_init (LdSymbolClass *klass)
{
	GObjectClass *object_class;

	object_class = G_OBJECT_CLASS (klass);
	object_class->finalize = ld_symbol_finalize;

	g_type_class_add_private (klass, sizeof (LdSymbolPrivate));
}

static void
ld_symbol_init (LdSymbol *self)
{
	self->priv = G_TYPE_INSTANCE_GET_PRIVATE
		(self, LD_TYPE_SYMBOL_LIBRARY, LdSymbolPrivate);
}

static void
ld_symbol_finalize (GObject *gobject)
{
	LdSymbol *self;

	self = LD_SYMBOL (gobject);
	g_object_unref (self->priv->library);

	/* Chain up to the parent class. */
	G_OBJECT_CLASS (ld_symbol_parent_class)->finalize (gobject);
}

/**
 * ld_symbol_new:
 * @library: A library object.
 * @filename: The file from which the symbol will be loaded.
 *
 * Load a symbol from a file into the library.
 */
LdSymbol *ld_symbol_new (LdSymbolLibrary *library,
	const gchar *filename)
{
	LdSymbol *symbol;

	symbol = g_object_new (LD_TYPE_SYMBOL, NULL);
	/* TODO: Use the filename, Luke. */

	symbol->priv->library = library;
	g_object_ref (library);
}

/**
 * ld_symbol_build_identifier:
 * @self: A symbol object.
 *
 * Build an identifier for the symbol.
 * The identifier is in the format "Category/Category/Symbol".
 */
char *
ld_symbol_build_identifier (LdSymbol *self)
{
	return NULL;
}

/**
 * ld_symbol_draw:
 * @self: A symbol object.
 * @surface: A cairo surface to be drawn on.
 * @param: Parameters for the symbol in a table.
 * @x: The X coordinate on the surface.
 * @y: The Y coordinate on the surface.
 * @zoom: Zoom ratio.
 *
 * Draw the symbol onto a Cairo surface.
 */
void
ld_symbol_draw (LdSymbol *self, cairo_t *surface,
	GHashTable *param, gint x, gint y, gdouble zoom)
{
	return;
}