Introduce LdRectangle, LdPoint and LdPointArray.

Remove LdCanvasRect and LdSymbolArea.
This commit is contained in:
2011-01-08 06:44:40 +01:00
parent 0b3f6503bb
commit 96f7710c25
12 changed files with 344 additions and 147 deletions

View File

@@ -2,7 +2,7 @@
* ld-symbol.c
*
* This file is a part of logdiag.
* Copyright Přemysl Janouch 2010. All rights reserved.
* Copyright Přemysl Janouch 2010 - 2011. All rights reserved.
*
* See the file LICENSE for licensing information.
*
@@ -12,6 +12,7 @@
#include "config.h"
#include "ld-types.h"
#include "ld-symbol.h"
#include "ld-symbol-category.h"
#include "ld-library.h"
@@ -82,7 +83,7 @@ ld_symbol_class_init (LdSymbolClass *klass)
*/
pspec = g_param_spec_boxed ("area", "Area",
"The area of this symbol.",
LD_TYPE_SYMBOL_AREA, G_PARAM_READABLE);
LD_TYPE_RECTANGLE, G_PARAM_READABLE);
g_object_class_install_property (object_class, PROP_AREA, pspec);
}
@@ -108,7 +109,7 @@ ld_symbol_get_property (GObject *object, guint property_id,
break;
case PROP_AREA:
{
LdSymbolArea area;
LdRectangle area;
ld_symbol_get_area (self, &area);
g_value_set_boxed (value, &area);
@@ -171,7 +172,7 @@ ld_symbol_get_human_name (LdSymbol *self)
* Get the area of the symbol.
*/
void
ld_symbol_get_area (LdSymbol *self, LdSymbolArea *area)
ld_symbol_get_area (LdSymbol *self, LdRectangle *area)
{
LdSymbolClass *klass;
@@ -202,51 +203,3 @@ ld_symbol_draw (LdSymbol *self, cairo_t *cr)
g_return_if_fail (klass->draw != NULL);
klass->draw (self, cr);
}
/**
* ld_symbol_area_copy:
* @self: An #LdSymbolArea structure.
*
* Makes a copy of the structure.
* The result must be freed by ld_symbol_area_free().
*
* Return value: A copy of @self.
**/
LdSymbolArea *
ld_symbol_area_copy (const LdSymbolArea *self)
{
LdSymbolArea *new_area;
g_return_val_if_fail (self != NULL, NULL);
new_area = g_slice_new (LdSymbolArea);
*new_area = *self;
return new_area;
}
/**
* ld_symbol_area_free:
* @self: An #LdSymbolArea structure.
*
* Frees the structure created with ld_symbol_area_copy().
**/
void
ld_symbol_area_free (LdSymbolArea *self)
{
g_return_if_fail (self != NULL);
g_slice_free (LdSymbolArea, self);
}
GType
ld_symbol_area_get_type (void)
{
static GType our_type = 0;
if (our_type == 0)
our_type = g_boxed_type_register_static
(g_intern_static_string ("LdSymbolArea"),
(GBoxedCopyFunc) ld_symbol_area_copy,
(GBoxedFreeFunc) ld_symbol_area_free);
return our_type;
}