-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-
/*
- * (GLABELS) Label and Business Card Creation program for GNOME
- *
- * label_object.c: GLabels label object base class
+ * label-object.c
+ * Copyright (C) 2001-2009 Jim Evins <evins@snaught.com>.
*
- * Copyright (C) 2001-2007 Jim Evins <evins@snaught.com>.
+ * This file is part of gLabels.
*
- * This program is free software; you can redistribute it and/or modify
+ * gLabels is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * gLabels is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * along with gLabels. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include <config.h>
#include "label-object.h"
-#include <glib/gmem.h>
-#include <glib/gstrfuncs.h>
-#include <glib/gmessages.h>
+#include <glib.h>
#include <math.h>
#include "marshal.h"
#define DEFAULT_SHADOW_Y_OFFSET (3.6)
#define DEFAULT_SHADOW_OPACITY (0.5)
+
/*========================================================*/
/* Private types. */
/*========================================================*/
FLIP_ROTATE,
TOP,
BOTTOM,
+ REMOVED,
LAST_SIGNAL
};
+
/*========================================================*/
/* Private globals. */
/*========================================================*/
static guint instance = 0;
+
/*========================================================*/
/* Private function prototypes. */
/*========================================================*/
gdouble h);
-\f
/*****************************************************************************/
/* Boilerplate object stuff. */
/*****************************************************************************/
G_DEFINE_TYPE (glLabelObject, gl_label_object, G_TYPE_OBJECT);
+
static void
gl_label_object_class_init (glLabelObjectClass *class)
{
gl_marshal_VOID__VOID,
G_TYPE_NONE,
0);
+ signals[REMOVED] =
+ g_signal_new ("removed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (glLabelObjectClass, removed),
+ NULL, NULL,
+ gl_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
gl_debug (DEBUG_LABEL, "END");
}
+
static void
gl_label_object_init (glLabelObject *object)
{
gl_debug (DEBUG_LABEL, "END");
}
+
static void
gl_label_object_finalize (GObject *object)
{
glLabelObject *label_object = GL_LABEL_OBJECT (object);
- glLabel *parent;
gl_debug (DEBUG_LABEL, "START");
g_return_if_fail (object && GL_IS_LABEL_OBJECT (object));
- parent = label_object->parent;
- gl_label_remove_object (parent, label_object);
-
g_free (label_object->priv->name);
g_free (label_object->priv);
gl_debug (DEBUG_LABEL, "END");
}
+
/*****************************************************************************/
/* New label object. */
/*****************************************************************************/
return G_OBJECT (object);
}
+
/*****************************************************************************/
/* Duplicate object. */
/*****************************************************************************/
return dst_object;
}
+
/*****************************************************************************/
/* Emit "changed" signal (for derived objects). */
/*****************************************************************************/
gl_debug (DEBUG_LABEL, "END");
}
+
/*****************************************************************************/
/* Set parent label of object. */
/*****************************************************************************/
gl_debug (DEBUG_LABEL, "END");
}
+
/*****************************************************************************/
/* Get parent label of object. */
/*****************************************************************************/
return object->parent;
}
+
+/*****************************************************************************/
+/* Set remove object from parent. */
+/*****************************************************************************/
+void
+gl_label_object_remove (glLabelObject *object)
+{
+ glLabel *parent;
+
+ gl_debug (DEBUG_LABEL, "START");
+
+ g_return_if_fail (object && GL_IS_LABEL_OBJECT (object));
+
+ parent = object->parent;
+ if ( parent != NULL ) {
+ g_signal_handlers_disconnect_by_func (parent,
+ G_CALLBACK(merge_changed_cb),
+ object);
+ gl_label_remove_object (parent, object);
+
+ g_signal_emit (G_OBJECT(object), signals[REMOVED], 0);
+
+ g_object_unref (G_OBJECT(object));
+ }
+
+
+ gl_debug (DEBUG_LABEL, "END");
+}
+
+
/*****************************************************************************/
/* Set name of object. */
/*****************************************************************************/
gl_debug (DEBUG_LABEL, "END");
}
+
/*****************************************************************************/
/* Get name of object. */
/*****************************************************************************/
return g_strdup(object->priv->name);
}
+
/*****************************************************************************/
/* Set position of object. */
/*****************************************************************************/
gl_debug (DEBUG_LABEL, "END");
}
+
/*****************************************************************************/
/* Set position of object relative to old position. */
/*****************************************************************************/
gl_debug (DEBUG_LABEL, "END");
}
+
/*****************************************************************************/
/* Get position of object. */
/*****************************************************************************/
gl_debug (DEBUG_LABEL, "END");
}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. Default set size method. */
/*---------------------------------------------------------------------------*/
}
}
+
/*****************************************************************************/
/* Set size of object. */
/*****************************************************************************/
gl_debug (DEBUG_LABEL, "END");
}
+
/*****************************************************************************/
/* Set size of object honoring current aspect ratio. */
/*****************************************************************************/
gl_debug (DEBUG_LABEL, "END");
}
+
/*****************************************************************************/
/* Get raw size method (don't let object content adjust size). */
/*****************************************************************************/
*h = object->priv->h;
}
+
/*****************************************************************************/
/* Get size of object. */
/*****************************************************************************/
gl_debug (DEBUG_LABEL, "END");
}
+
/*****************************************************************************/
/* Get extent of object. */
/*****************************************************************************/
gl_debug (DEBUG_LABEL, "END");
}
+
/*****************************************************************************/
/* Can text properties be set for this object? */
/*****************************************************************************/
}
+
/*****************************************************************************/
/* Set font family for all text contained in object. */
/*****************************************************************************/
gl_debug (DEBUG_LABEL, "END");
}
+
/****************************************************************************/
/* Set font size for all text contained in object. */
/****************************************************************************/
gl_debug (DEBUG_LABEL, "END");
}
+
/****************************************************************************/
/* Set font weight for all text contained in object. */
/****************************************************************************/
gl_debug (DEBUG_LABEL, "END");
}
+
/****************************************************************************/
/* Set font italic flag for all text contained in object. */
/****************************************************************************/
gl_debug (DEBUG_LABEL, "END");
}
+
/****************************************************************************/
/* Set text alignment for all text contained in object. */
/****************************************************************************/
gl_debug (DEBUG_LABEL, "END");
}
+
/****************************************************************************/
/* Set text line spacing for all text contained in object. */
/****************************************************************************/
gl_debug (DEBUG_LABEL, "END");
}
+
/****************************************************************************/
/* Set text color for all text contained in object. */
/****************************************************************************/
gl_debug (DEBUG_LABEL, "END");
}
+
/*****************************************************************************/
/* Get font family for all text contained in object. */
/*****************************************************************************/
return ret;
}
+
/****************************************************************************/
/* Get font size for all text contained in object. */
/****************************************************************************/
return ret;
}
+
/****************************************************************************/
/* Get font weight for all text contained in object. */
/****************************************************************************/
return ret;
}
+
/****************************************************************************/
/* Get font italic flag for all text contained in object. */
/****************************************************************************/
return ret;
}
+
/****************************************************************************/
/* Get text alignment for all text contained in object. */
/****************************************************************************/
return ret;
}
+
/****************************************************************************/
/* Get text line spacing for all text contained in object. */
/****************************************************************************/
return ret;
}
+
/****************************************************************************/
/* Get text color for all text contained in object. */
/****************************************************************************/
return ret;
}
+
/*****************************************************************************/
/* Can fill properties be set for this object? */
/*****************************************************************************/
}
+
/****************************************************************************/
/* Set fill color for object. */
/****************************************************************************/
gl_debug (DEBUG_LABEL, "END");
}
+
/****************************************************************************/
/* Get fill color for object. */
/****************************************************************************/
return ret;
}
+
/*****************************************************************************/
/* Can line color property be set for this object? */
/*****************************************************************************/
}
+
/****************************************************************************/
/* Set line color for object. */
/****************************************************************************/
gl_debug (DEBUG_LABEL, "END");
}
+
/****************************************************************************/
/* Get line color for object. */
/****************************************************************************/
return ret;
}
+
/*****************************************************************************/
/* Can line width property be set for this object? */
/*****************************************************************************/
}
+
/****************************************************************************/
/* Set line width for object. */
/****************************************************************************/
gl_debug (DEBUG_LABEL, "END");
}
+
/****************************************************************************/
/* Get line width for object. */
/****************************************************************************/
return ret;
}
+
/****************************************************************************/
/* Set shadow state of object. */
/****************************************************************************/
gl_debug (DEBUG_LABEL, "END");
}
+
/****************************************************************************/
/* Get shadow state of object. */
/****************************************************************************/
return object->priv->shadow_state;
}
+
/****************************************************************************/
/* Set offset of object's shadow. */
/****************************************************************************/
gl_debug (DEBUG_LABEL, "END");
}
+
/****************************************************************************/
/* Get offset of object's shadow. */
/****************************************************************************/
gl_debug (DEBUG_LABEL, "END");
}
+
/****************************************************************************/
/* Set color of object's shadow. */
/****************************************************************************/
gl_debug (DEBUG_LABEL, "END");
}
+
/****************************************************************************/
/* Get color of object's shadow. */
/****************************************************************************/
return gl_color_node_dup (object->priv->shadow_color_node);
}
+
/****************************************************************************/
/* Set opacity of object's shadow. */
/****************************************************************************/
gl_debug (DEBUG_LABEL, "END");
}
+
/****************************************************************************/
/* Get opacity of object's shadow. */
/****************************************************************************/
return object->priv->shadow_opacity;
}
+
/****************************************************************************/
/* Flip object horizontally. */
/****************************************************************************/
gl_debug (DEBUG_LABEL, "END");
}
+
/****************************************************************************/
/* Flip object vertically. */
/****************************************************************************/
gl_debug (DEBUG_LABEL, "END");
}
+
/****************************************************************************/
/* Rotate object. */
/****************************************************************************/
gl_debug (DEBUG_LABEL, "END");
}
+
/****************************************************************************/
/* Set raw affine */
/****************************************************************************/
object->priv->matrix = *matrix;
}
+
/****************************************************************************/
/* Get raw affine */
/****************************************************************************/
*matrix = object->priv->matrix;
}
+
/****************************************************************************/
/* Bring label object to front/top. */
/****************************************************************************/
gl_debug (DEBUG_LABEL, "END");
}
+
/****************************************************************************/
/* Send label object to rear/bottom. */
/****************************************************************************/
gl_debug (DEBUG_LABEL, "END");
}
+
/*--------------------------------------------------------------------------*/
/* PRIVATE. Label's merge data changed callback. */
/*--------------------------------------------------------------------------*/
gl_label_object_emit_changed (object);
}
+
/*****************************************************************************/
/* Draw object */
/*****************************************************************************/
gl_debug (DEBUG_LABEL, "END");
}
+
+
+
+/*
+ * Local Variables: -- emacs
+ * mode: C -- emacs
+ * c-basic-offset: 8 -- emacs
+ * tab-width: 8 -- emacs
+ * indent-tabs-mode: nil -- emacs
+ * End: -- emacs
+ */