GtkWidget *
gl_view_new (glLabel *label)
{
- glView *view = g_object_new (gl_view_get_type (), NULL);
+ glView *view;
gl_debug (DEBUG_VIEW, "START");
+ g_return_val_if_fail (label && GL_IS_LABEL (label), NULL);
+
+ view = g_object_new (gl_view_get_type (), NULL);
view->label = label;
gl_view_construct (view);
gl_view_construct_canvas (glView *view)
{
gdouble scale;
- glLabel *label = view->label;
+ glLabel *label;
gdouble label_width, label_height;
GdkColor *bg_color;
gl_debug (DEBUG_VIEW, "START");
- g_return_val_if_fail (GL_IS_VIEW (view), NULL);
- g_return_val_if_fail (label != NULL, NULL);
+ g_return_val_if_fail (view && GL_IS_VIEW (view), NULL);
+ g_return_val_if_fail (view->label && GL_IS_LABEL (view->label), NULL);
+
+ label = view->label;
gtk_widget_push_colormap (gdk_rgb_get_colormap ());
view->canvas = gnome_canvas_new_aa ();
static void
draw_layers (glView *view)
{
+ g_return_if_fail (view && GL_IS_VIEW (view));
+ g_return_if_fail (view->label && GL_IS_LABEL (view->label));
+
draw_bg_fg_layers (view);
draw_grid_layer (view);
draw_markup_layer (view);
glLabelObject *object;
glViewObject *view_object;
+ g_return_if_fail (view && GL_IS_VIEW (view));
+ g_return_if_fail (view->label && GL_IS_LABEL (view->label));
+
group = gnome_canvas_root (GNOME_CANVAS (view->canvas));
view->label_group = GNOME_CANVAS_GROUP(
gnome_canvas_item_new (group,
{
GnomeCanvasGroup *group;
+ g_return_if_fail (view && GL_IS_VIEW (view));
+
group = gnome_canvas_root (GNOME_CANVAS (view->canvas));
view->highlight_group = GNOME_CANVAS_GROUP(
gnome_canvas_item_new (group,
glTemplate *template;
GnomeCanvasGroup *group;
+ g_return_if_fail (view && GL_IS_VIEW (view));
+ g_return_if_fail (view->label && GL_IS_LABEL (view->label));
+
group = gnome_canvas_root (GNOME_CANVAS (view->canvas));
view->bg_group = GNOME_CANVAS_GROUP(
gnome_canvas_item_new (group,
"y", 0.0,
NULL));
- label = view->label;
+ label = view->label;
template = gl_label_get_template (label);
switch (template->label.style) {
static void
draw_bg_fg_rect (glView *view)
{
- glLabel *label = view->label;
+ glLabel *label;
glTemplate *template;
gdouble w, h;
GnomeCanvasItem *item;
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
- g_return_if_fail (label != NULL);
+ g_return_if_fail (view && GL_IS_VIEW (view));
+ g_return_if_fail (view->label && GL_IS_LABEL (view->label));
+
+ label = view->label;
gl_label_get_size (label, &w, &h);
template = gl_label_get_template (label);
static void
draw_bg_fg_rounded_rect (glView *view)
{
- glLabel *label = view->label;
+ glLabel *label;
GnomeCanvasPoints *points;
gint i_coords, i_theta;
glTemplate *template;
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
- g_return_if_fail (label != NULL);
+ g_return_if_fail (view && GL_IS_VIEW (view));
+ g_return_if_fail (view->label && GL_IS_LABEL (view->label));
+
+ label = view->label;
gl_label_get_size (label, &w, &h);
template = gl_label_get_template (label);
static void
draw_bg_fg_round (glView *view)
{
- glLabel *label = view->label;
+ glLabel *label;
glTemplate *template;
gdouble r;
GnomeCanvasItem *item;
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
- g_return_if_fail (label != NULL);
+ g_return_if_fail (view && GL_IS_VIEW (view));
+ g_return_if_fail (view->label && GL_IS_LABEL(view->label));
+ label = view->label;
template = gl_label_get_template (label);
r = template->label.round.r;
static void
draw_bg_fg_cd (glView *view)
{
- glLabel *label = view->label;
+ glLabel *label;
glTemplate *template;
gdouble r1, r2;
GnomeCanvasItem *item;
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
- g_return_if_fail (label != NULL);
+ g_return_if_fail (view && GL_IS_VIEW (view));
+ g_return_if_fail (view->label && GL_IS_LABEL (view->label));
+ label = view->label;
template = gl_label_get_template (label);
r1 = template->label.cd.r1;
static void
draw_bg_fg_cd_bc (glView *view)
{
- glLabel *label = view->label;
+ glLabel *label;
glTemplate *template;
GnomeCanvasPoints *points;
gint i_coords, i_theta;
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
- g_return_if_fail (label != NULL);
+ g_return_if_fail (view && GL_IS_VIEW (view));
+ g_return_if_fail (view->label && GL_IS_LABEL (view->label));
+
+ label = view->label;
template = gl_label_get_template (label);
gl_label_get_size (label, &w, &h);
GList *p;
glTemplateMarkup *markup;
+ g_return_if_fail (view && GL_IS_VIEW (view));
+ g_return_if_fail (view->label && GL_IS_LABEL (view->label));
+
group = gnome_canvas_root (GNOME_CANVAS (view->canvas));
view->markup_group = GNOME_CANVAS_GROUP(
gnome_canvas_item_new (group,
"x", 0.0,
"y", 0.0,
NULL));
- label = view->label;
+
+ label = view->label;
template = gl_label_get_template (label);
for ( p=template->label.any.markups; p != NULL; p=p->next ) {
glLabel *label;
glTemplate *template;
- label = view->label;
+ g_return_if_fail (view && GL_IS_VIEW (view));
+ g_return_if_fail (view->label && GL_IS_LABEL (view->label));
+
+ label = view->label;
template = gl_label_get_template (label);
switch (template->label.style) {
draw_markup_margin_rect (glView *view,
glTemplateMarkupMargin *margin)
{
- glLabel *label = view->label;
+ glLabel *label;
glTemplate *template;
gdouble w, h, m;
GnomeCanvasItem *item;
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
- g_return_if_fail (label != NULL);
+ g_return_if_fail (view && GL_IS_VIEW (view));
+ g_return_if_fail (view->label && GL_IS_LABEL (view->label));
+
+ label = view->label;
gl_label_get_size (label, &w, &h);
template = gl_label_get_template (label);
draw_markup_margin_rounded_rect (glView *view,
glTemplateMarkupMargin *margin)
{
- glLabel *label = view->label;
+ glLabel *label;
GnomeCanvasPoints *points;
gint i_coords, i_theta;
glTemplate *template;
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
- g_return_if_fail (label != NULL);
+ g_return_if_fail (view && GL_IS_VIEW (view));
+ g_return_if_fail (view->label && GL_IS_LABEL (view->label));
+
+ label = view->label;
gl_label_get_size (label, &w, &h);
template = gl_label_get_template (label);
draw_markup_margin_round (glView *view,
glTemplateMarkupMargin *margin)
{
- glLabel *label = view->label;
+ glLabel *label;
glTemplate *template;
gdouble r, m;
GnomeCanvasItem *item;
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
- g_return_if_fail (label != NULL);
+ g_return_if_fail (view && GL_IS_VIEW (view));
+ g_return_if_fail (view->label && GL_IS_LABEL (view->label));
+ label = view->label;
template = gl_label_get_template (label);
r = template->label.round.r;
draw_markup_margin_cd (glView *view,
glTemplateMarkupMargin *margin)
{
- glLabel *label = view->label;
+ glLabel *label;
glTemplate *template;
gdouble m, r1, r2;
GnomeCanvasItem *item;
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
- g_return_if_fail (label != NULL);
+ g_return_if_fail (view && GL_IS_VIEW (view));
+ g_return_if_fail (view->label && GL_IS_LABEL (view->label));
+ label = view->label;
template = gl_label_get_template (label);
r1 = template->label.cd.r1;
draw_markup_margin_cd_bc (glView *view,
glTemplateMarkupMargin *margin)
{
- glLabel *label = view->label;
+ glLabel *label;
glTemplate *template;
gdouble m, r1, r2;
GnomeCanvasPoints *points;
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
- g_return_if_fail (label != NULL);
+ g_return_if_fail (view && GL_IS_VIEW (view));
+ g_return_if_fail (view->label && GL_IS_LABEL (view->label));
+ label = view->label;
template = gl_label_get_template (label);
gl_label_get_size (label, &w, &h);
x0 = w/2.0;
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
+ g_return_if_fail (view && GL_IS_VIEW (view));
points = gnome_canvas_points_new (2);
points->coords[0] = line->x1;
/*****************************************************************************/
void gl_view_show_grid (glView *view)
{
+ g_return_if_fail (view && GL_IS_VIEW (view));
+
gnome_canvas_item_show (GNOME_CANVAS_ITEM(view->grid_group));
}
/*****************************************************************************/
void gl_view_hide_grid (glView *view)
{
+ g_return_if_fail (view && GL_IS_VIEW (view));
+
gnome_canvas_item_hide (GNOME_CANVAS_ITEM(view->grid_group));
}
void gl_view_set_grid_spacing (glView *view,
gdouble spacing)
{
+ g_return_if_fail (view && GL_IS_VIEW (view));
+
view->grid_spacing = spacing;
gtk_object_destroy (GTK_OBJECT(view->grid_group));
/*****************************************************************************/
void gl_view_show_markup (glView *view)
{
+ g_return_if_fail (view && GL_IS_VIEW (view));
+
gnome_canvas_item_show (GNOME_CANVAS_ITEM(view->markup_group));
}
/*****************************************************************************/
void gl_view_hide_markup (glView *view)
{
+ g_return_if_fail (view && GL_IS_VIEW (view));
+
gnome_canvas_item_hide (GNOME_CANVAS_ITEM(view->markup_group));
}
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
+ g_return_if_fail (view && GL_IS_VIEW (view));
if (!cursor) {
cursor = gdk_cursor_new (GDK_LEFT_PTR);
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
+ g_return_if_fail (view && GL_IS_VIEW (view));
switch (type) {
case GL_LABEL_OBJECT_BOX:
{
gl_debug (DEBUG_VIEW, "START");
+ g_return_if_fail (view && GL_IS_VIEW (view));
+
select_object_real (view, view_object);
g_signal_emit (G_OBJECT(view), signals[SELECTION_CHANGED], 0);
{
gl_debug (DEBUG_VIEW, "START");
+ g_return_if_fail (view && GL_IS_VIEW (view));
+
unselect_object_real (view, view_object);
g_signal_emit (G_OBJECT(view), signals[SELECTION_CHANGED], 0);
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
+ g_return_if_fail (view && GL_IS_VIEW (view));
/* 1st unselect anything already selected. */
for (p = view->selected_object_list; p != NULL; p = p_next) {
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
+ g_return_if_fail (view && GL_IS_VIEW (view));
for (p = view->selected_object_list; p != NULL; p = p_next) {
p_next = p->next;
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
+ g_return_if_fail (view && GL_IS_VIEW (view));
g_return_if_fail ((x1 <= x2) && (y1 <= y2));
for (p = view->object_list; p != NULL; p = p->next) {
{
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
+ g_return_if_fail (view && GL_IS_VIEW (view));
g_return_if_fail (GL_IS_VIEW_OBJECT (view_object));
if (!gl_view_is_object_selected (view, view_object)) {
{
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
+ g_return_if_fail (view && GL_IS_VIEW (view));
g_return_if_fail (GL_IS_VIEW_OBJECT (view_object));
gl_view_object_hide_highlight (view_object);
gl_debug (DEBUG_VIEW, "");
- g_return_val_if_fail (GL_IS_VIEW (view), FALSE);
+ g_return_val_if_fail (view && GL_IS_VIEW (view), FALSE);
item = gnome_canvas_get_item_at (GNOME_CANVAS (view->canvas), x, y);
GnomeCanvasItem *parent;
GnomeCanvasItem *root_group;
+ g_return_val_if_fail (view && GL_IS_VIEW (view), FALSE);
+
root_group = GNOME_CANVAS_ITEM(gnome_canvas_root (GNOME_CANVAS (view->canvas)));
for ( parent=item->parent; parent && (parent!=root_group); parent=parent->parent) {
{
gl_debug (DEBUG_VIEW, "");
- g_return_val_if_fail (GL_IS_VIEW (view), FALSE);
+ g_return_val_if_fail (view && GL_IS_VIEW (view), FALSE);
g_return_val_if_fail (GL_IS_VIEW_OBJECT (view_object), FALSE);
if (g_list_find (view->selected_object_list, view_object) == NULL) {
{
gl_debug (DEBUG_VIEW, "");
- g_return_val_if_fail (GL_IS_VIEW (view), FALSE);
+ g_return_val_if_fail (view && GL_IS_VIEW (view), FALSE);
if (view->selected_object_list == NULL) {
return TRUE;
{
gl_debug (DEBUG_VIEW, "");
- g_return_val_if_fail (GL_IS_VIEW (view), FALSE);
+ g_return_val_if_fail (view && GL_IS_VIEW (view), FALSE);
if (view->selected_object_list == NULL)
return FALSE;
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
+ g_return_if_fail (view && GL_IS_VIEW (view));
for (p = view->selected_object_list; p != NULL; p = p_next) {
p_next = p->next;
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
+ g_return_if_fail (view && GL_IS_VIEW (view));
if (gl_view_is_selection_atomic (view)) {
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
+ g_return_if_fail (view && GL_IS_VIEW (view));
for (p = view->selected_object_list; p != NULL; p = p->next) {
view_object = GL_VIEW_OBJECT (p->data);
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
+ g_return_if_fail (view && GL_IS_VIEW (view));
for (p = view->selected_object_list; p != NULL; p = p->next) {
view_object = GL_VIEW_OBJECT (p->data);
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
+ g_return_if_fail (view && GL_IS_VIEW (view));
for (p = view->selected_object_list; p != NULL; p = p->next) {
view_object = GL_VIEW_OBJECT (p->data);
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
+ g_return_if_fail (view && GL_IS_VIEW (view));
for (p = view->selected_object_list; p != NULL; p = p->next) {
view_object = GL_VIEW_OBJECT (p->data);
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
+ g_return_if_fail (view && GL_IS_VIEW (view));
for (p = view->selected_object_list; p != NULL; p = p->next) {
view_object = GL_VIEW_OBJECT (p->data);
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
+ g_return_if_fail (view && GL_IS_VIEW (view));
for (p = view->selected_object_list; p != NULL; p = p->next) {
view_object = GL_VIEW_OBJECT (p->data);
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
+ g_return_if_fail (view && GL_IS_VIEW (view));
for (p = view->selected_object_list; p != NULL; p = p->next) {
view_object = GL_VIEW_OBJECT (p->data);
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
+ g_return_if_fail (view && GL_IS_VIEW (view));
g_return_if_fail (!gl_view_is_selection_empty (view) &&
!gl_view_is_selection_atomic (view));
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
+ g_return_if_fail (view && GL_IS_VIEW (view));
g_return_if_fail (!gl_view_is_selection_empty (view) &&
!gl_view_is_selection_atomic (view));
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
+ g_return_if_fail (view && GL_IS_VIEW (view));
g_return_if_fail (!gl_view_is_selection_empty (view) &&
!gl_view_is_selection_atomic (view));
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
+ g_return_if_fail (view && GL_IS_VIEW (view));
g_return_if_fail (!gl_view_is_selection_empty (view) &&
!gl_view_is_selection_atomic (view));
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
+ g_return_if_fail (view && GL_IS_VIEW (view));
g_return_if_fail (!gl_view_is_selection_empty (view) &&
!gl_view_is_selection_atomic (view));
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
+ g_return_if_fail (view && GL_IS_VIEW (view));
g_return_if_fail (!gl_view_is_selection_empty (view) &&
!gl_view_is_selection_atomic (view));
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
+ g_return_if_fail (view && GL_IS_VIEW (view));
g_return_if_fail (!gl_view_is_selection_empty (view));
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
+ g_return_if_fail (view && GL_IS_VIEW (view));
g_return_if_fail (!gl_view_is_selection_empty (view));
{
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
+ g_return_if_fail (view && GL_IS_VIEW (view));
gl_view_copy (view);
gl_view_delete_selection (view);
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
+ g_return_if_fail (view && GL_IS_VIEW (view));
if (view->selected_object_list) {
{
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
+ g_return_if_fail (view && GL_IS_VIEW (view));
gtk_selection_convert (GTK_WIDGET (view->invisible),
clipboard_atom, GDK_SELECTION_TYPE_STRING,
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
+ g_return_if_fail (view && GL_IS_VIEW (view));
/* Find index of current scale (or best match) */
i_min = 1; /* start with 2nd largest scale */
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
+ g_return_if_fail (view && GL_IS_VIEW (view));
/* Find index of current scale (or best match) */
i_min = 0; /* start with largest scale */
{
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
+ g_return_if_fail (view && GL_IS_VIEW (view));
g_return_if_fail (scale > 0.0);
view->scale = scale * HOME_SCALE;
{
gl_debug (DEBUG_VIEW, "");
- g_return_val_if_fail (GL_IS_VIEW (view), 1.0);
+ g_return_val_if_fail (view && GL_IS_VIEW (view), 1.0);
return view->scale / HOME_SCALE;
}
{
gl_debug (DEBUG_VIEW, "");
- g_return_val_if_fail (GL_IS_VIEW (view), FALSE);
+ g_return_val_if_fail (view && GL_IS_VIEW (view), FALSE);
return view->scale <= scales[N_SCALES-1];
}
{
gl_debug (DEBUG_VIEW, "");
- g_return_if_fail (GL_IS_VIEW (view));
+ g_return_if_fail (view && GL_IS_VIEW (view));
if (view->merge_props_dialog != NULL) {
gtk_widget_show_all (view->merge_props_dialog);
gl_debug (DEBUG_VIEW, "");
+ g_return_val_if_fail (view && GL_IS_VIEW (view), FALSE);
+
/* emit pointer signals regardless of state */
switch (event->type) {
case GDK_MOTION_NOTIFY:
gl_debug (DEBUG_VIEW, "");
+ g_return_val_if_fail (view && GL_IS_VIEW (view), FALSE);
+
switch (event->type) {
case GDK_BUTTON_PRESS:
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
+ g_return_if_fail (view && GL_IS_VIEW (view));
menu = gtk_menu_new ();
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
+ g_return_if_fail (view && GL_IS_VIEW (view));
menu = gtk_menu_new ();
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
+ g_return_if_fail (view && GL_IS_VIEW (view));
if (gl_view_is_selection_empty (view)) {
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
+ g_return_if_fail (view && GL_IS_VIEW (view));
view->have_selection = FALSE;
g_object_unref (view->selection_data);
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
+ g_return_if_fail (view && GL_IS_VIEW (view));
if (view->have_selection) {
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (GL_IS_VIEW (view));
+ g_return_if_fail (view && GL_IS_VIEW (view));
if (selection_data->length < 0) {
return;