-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-
/*
- * (GLABELS) Label and Business Card Creation program for GNOME
- *
- * view.c: GLabels View module
+ * view.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 "view.h"
#include <glib/gi18n.h>
-#include <gtk/gtkscrolledwindow.h>
-#include <gtk/gtklayout.h>
-#include <gtk/gtkselection.h>
-#include <gtk/gtkinvisible.h>
+#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <string.h>
#include <math.h>
#include "debug.h"
+
/*==========================================================================*/
/* Private macros and constants. */
/*==========================================================================*/
#define POINTS_PER_MM 2.83464566929
+
/*==========================================================================*/
/* Private types. */
/*==========================================================================*/
static gboolean key_press_event_cb (glView *view,
GdkEventKey *event);
-\f
+
/****************************************************************************/
/* Boilerplate Object stuff. */
/****************************************************************************/
G_DEFINE_TYPE (glView, gl_view, GTK_TYPE_VBOX);
+
static void
gl_view_class_init (glViewClass *class)
{
gl_debug (DEBUG_VIEW, "END");
}
+
static void
gl_view_init (glView *view)
{
gl_debug (DEBUG_VIEW, "END");
}
+
static void
gl_view_finalize (GObject *object)
{
gl_debug (DEBUG_VIEW, "END");
}
+
/****************************************************************************/
/* NEW view object. */
/****************************************************************************/
return GTK_WIDGET (view);
}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. Construct composite widget. */
/*---------------------------------------------------------------------------*/
gl_debug (DEBUG_VIEW, "END");
}
+
/*---------------------------------------------------------------------------*/
/* PRIAVTE. Calculate 1:1 scale for screen. */
/*---------------------------------------------------------------------------*/
return scale;
}
+
/*---------------------------------------------------------------------------*/
/* Schedule canvas update. */
/*---------------------------------------------------------------------------*/
gl_debug (DEBUG_VIEW, "END");
}
+
/*---------------------------------------------------------------------------*/
/* Schedule canvas region update. */
/*---------------------------------------------------------------------------*/
gl_debug (DEBUG_VIEW, "END");
}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. Expose handler. */
/*---------------------------------------------------------------------------*/
return FALSE;
}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. Realize handler. */
/*---------------------------------------------------------------------------*/
gl_debug (DEBUG_VIEW, "END");
}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. Size allocation changed callback. */
/*---------------------------------------------------------------------------*/
}
-
/*---------------------------------------------------------------------------*/
/* PRIVATE. Screen changed callback. */
/*---------------------------------------------------------------------------*/
gl_debug (DEBUG_VIEW, "END");
}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. Handle label changed event. */
/*---------------------------------------------------------------------------*/
gl_view_select_object (view, view_object);
}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. Create, draw and order layers. */
/*---------------------------------------------------------------------------*/
}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. Draw background */
/*---------------------------------------------------------------------------*/
cairo_fill (cr);
}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. Draw grid lines. */
/*---------------------------------------------------------------------------*/
gl_debug (DEBUG_VIEW, "END");
}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. Draw markup layer. */
/*---------------------------------------------------------------------------*/
}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. Draw objects layer. */
/*---------------------------------------------------------------------------*/
gl_label_draw (view->label, cr, TRUE, NULL);
}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. Draw foreground */
/*---------------------------------------------------------------------------*/
cairo_stroke (cr);
}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. Create highlight layer. */
/*---------------------------------------------------------------------------*/
cairo_restore (cr);
}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. Draw select region layer. */
/*---------------------------------------------------------------------------*/
}
}
+
/*****************************************************************************/
/* Show grid. */
/*****************************************************************************/
gl_view_update (view);
}
+
/*****************************************************************************/
/* Hide grid. */
/*****************************************************************************/
gl_view_update (view);
}
+
/*****************************************************************************/
/* Set grid spacing. */
/*****************************************************************************/
gl_view_update (view);
}
+
/*****************************************************************************/
/* Show markup. */
/*****************************************************************************/
gl_view_update (view);
}
+
/*****************************************************************************/
/* Hide markup. */
/*****************************************************************************/
gl_view_update (view);
}
+
/*****************************************************************************/
/* Set arrow mode. */
/*****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+
/*****************************************************************************/
/* Set create text object mode. */
/*****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+
/*****************************************************************************/
/* Select given object (adding to current selection). */
/*****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+
/*****************************************************************************/
/* Unselect given object (removing from current selection). */
/*****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+
/*****************************************************************************/
/* Select all items. */
/*****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+
/*****************************************************************************/
/* Remove all selections */
/*****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+
/*****************************************************************************/
/* Select all objects within given rectangular region (adding to selection). */
/*****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. Select an object. */
/*---------------------------------------------------------------------------*/
gl_debug (DEBUG_VIEW, "END");
}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. Un-select object. */
/*---------------------------------------------------------------------------*/
gl_debug (DEBUG_VIEW, "END");
}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. Return object at (x,y). */
/*---------------------------------------------------------------------------*/
return NULL;
}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. Return object handle at (x,y). */
/*---------------------------------------------------------------------------*/
return NULL;
}
+
/*****************************************************************************/
/* Is the object in our current selection? */
/*****************************************************************************/
return TRUE;
}
+
/*****************************************************************************/
/* Is our current selection empty? */
/*****************************************************************************/
}
}
+
/*****************************************************************************/
/* Is our current selection atomic? I.e. only one item selected. */
/*****************************************************************************/
return FALSE;
}
+
/*****************************************************************************/
/* Delete selected objects. (Bypass clipboard) */
/*****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+
/*****************************************************************************/
/* Get object property editor of first selected object. */
/*****************************************************************************/
return editor;
}
+
/*****************************************************************************/
/* Raise selected items to top. */
/*****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+
/*****************************************************************************/
/* Lower selected items to bottom. */
/*****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+
/*****************************************************************************/
/* Rotate selected objects by given angle. */
/*****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+
/*****************************************************************************/
/* Rotate selected objects 90 degrees left. */
/*****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+
/*****************************************************************************/
/* Rotate selected objects 90 degrees right. */
/*****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+
/*****************************************************************************/
/* Flip selected objects horizontally. */
/*****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+
/*****************************************************************************/
/* Flip selected objects vertically. */
/*****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+
/*****************************************************************************/
/* Align selected objects to left most edge. */
/*****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+
/*****************************************************************************/
/* Align selected objects to horizontal center of objects. */
/*****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+
/*****************************************************************************/
/* Align selected objects to top most edge. */
/*****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+
/*****************************************************************************/
/* Align selected objects to bottom most edge. */
/*****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+
/*****************************************************************************/
/* Align selected objects to viertical center of objects. */
/*****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+
/*****************************************************************************/
/* Center selected objects to in center of label. */
/*****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+
/*****************************************************************************/
/* Can text properties be set for selection? */
/*****************************************************************************/
return FALSE;
}
+
/*****************************************************************************/
/* Set font family for all text contained in selected objects. */
/*****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+
/*****************************************************************************/
/* Set font size for all text contained in selected objects. */
/*****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+
/*****************************************************************************/
/* Set font weight for all text contained in selected objects. */
/*****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+
/*****************************************************************************/
/* Set font italic flag for all text contained in selected objects. */
/*****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+
/*****************************************************************************/
/* Set text alignment for all text contained in selected objects. */
/*****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+
/*****************************************************************************/
/* Set text line spacing for all text contained in selected objects. */
/*****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+
+
/*****************************************************************************/
/* Set text color for all text contained in selected objects. */
/*****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+
/*****************************************************************************/
/* Can fill properties be set for selection? */
/*****************************************************************************/
return FALSE;
}
+
/*****************************************************************************/
/* Set fill color for all selected objects. */
/*****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+
/*****************************************************************************/
/* Can line color properties be set for selection? */
/*****************************************************************************/
return FALSE;
}
+
/*****************************************************************************/
/* Set line color for all selected objects. */
/*****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+
/*****************************************************************************/
/* Can line width properties be set for selection? */
/*****************************************************************************/
return FALSE;
}
+
/*****************************************************************************/
/* Set line width for all selected objects. */
/*****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+
/*****************************************************************************/
/* "Cut" selected items and place in clipboard selections. */
/*****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+
/*****************************************************************************/
/* "Copy" selected items to clipboard selections. */
/*****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+
/*****************************************************************************/
/* "Paste" from private clipboard selection. */
/*****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+
/*****************************************************************************/
/* Zoom in one "notch" */
/*****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+
/*****************************************************************************/
/* Zoom out one "notch" */
/*****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+
/*****************************************************************************/
/* Set zoom to best fit. */
/*****************************************************************************/
set_zoom_real (view, scale/view->home_scale, TRUE);
}
+
/*****************************************************************************/
/* Set current zoom factor to explicit value. */
/*****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. Set canvas scale. */
/*---------------------------------------------------------------------------*/
return view->zoom;
}
+
/*****************************************************************************/
/* Is this the maximum zoom level. */
/*****************************************************************************/
return view->zoom >= zooms[0];
}
+
/*****************************************************************************/
/* Is this the minimum zoom level. */
/*****************************************************************************/
return view->zoom <= zooms[N_ZOOMS-1];
}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. Handle "selection-clear" signal. */
/*---------------------------------------------------------------------------*/
gl_debug (DEBUG_VIEW, "END");
}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. Handle "selection-get" signal. */
/*---------------------------------------------------------------------------*/
gl_debug (DEBUG_VIEW, "END");
}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. Handle "selection-received" signal. (Result of Paste) */
/*---------------------------------------------------------------------------*/
gl_debug (DEBUG_VIEW, "END");
}
+
/****************************************************************************/
/* Set default font family. */
/****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+
/****************************************************************************/
/* Set default text line spacing. */
/****************************************************************************/
}
-
/****************************************************************************/
/* Get default font family. */
/****************************************************************************/
return view->default_text_alignment;
}
+
/****************************************************************************/
/* Get default text line spacing. */
/****************************************************************************/
}
-
/****************************************************************************/
/* Get default line width. */
/****************************************************************************/
return view->default_fill_color;
}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. Focus in event handler. */
/*---------------------------------------------------------------------------*/
return FALSE;
}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. Focus out event handler. */
/*---------------------------------------------------------------------------*/
return FALSE;
}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. Enter notify event handler. */
/*---------------------------------------------------------------------------*/
return FALSE;
}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. Leave notify event handler. */
/*---------------------------------------------------------------------------*/
return FALSE;
}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. Motion notify event handler. */
/*---------------------------------------------------------------------------*/
return return_value;
}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. Button press event handler. */
/*---------------------------------------------------------------------------*/
return return_value;
}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. Button release event handler. */
/*---------------------------------------------------------------------------*/
return return_value;
}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. Key press event handler. */
/*---------------------------------------------------------------------------*/
return TRUE; /* We handled this or we were dragging. */
}
+
+
+/*
+ * Local Variables: -- emacs
+ * mode: C -- emacs
+ * c-basic-offset: 8 -- emacs
+ * tab-width: 8 -- emacs
+ * indent-tabs-mode: nil -- emacs
+ * End: -- emacs
+ */