sp-canvas.h revision 605f7fa17f07754ccf23b434d0e85723edaba6a8
#ifndef SEEN_SP_CANVAS_H
#define SEEN_SP_CANVAS_H
/** \file
* SPCanvas, SPCanvasBuf, and SPCanvasItem.
*
* Authors:
* Federico Mena <federico@nuclecu.unam.mx>
* Raph Levien <raph@gimp.org>
* Lauris Kaplinski <lauris@kaplinski.com>
*
* Copyright (C) 1998 The Free Software Foundation
* Copyright (C) 2002 Lauris Kaplinski
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_INTTYPES_H
# include <inttypes.h>
#else
# ifdef HAVE_STDINT_H
# include <stdint.h>
# endif
#endif
#include <gdk/gdkevents.h>
#include <gtk/gtkobject.h>
#include <gtk/gtkwidget.h>
#include <libnr/nr-rect-l.h>
struct SPCanvas;
struct SPCanvasGroup;
typedef struct _SPCanvasItemClass SPCanvasItemClass;
enum {
SP_CANVAS_UPDATE_REQUESTED = 1 << 0,
};
/**
* The canvas buf contains the actual pixels.
*/
struct SPCanvasBuf{
int buf_rowstride;
/// Background color, given as 0xrrggbb
// If empty, ignore contents of buffer and use a solid area of bg_color
bool is_empty;
};
/**
* An SPCanvasItem refers to a SPCanvas and to its parent item; it has
* four coordinates, a bounding rectangle, and a transformation matrix.
*/
};
/**
* The vtable of an SPCanvasItem.
*/
};
SPCanvasItem *sp_canvas_item_new(SPCanvasGroup *parent, GtkType type, const gchar *first_arg_name, ...);
#define sp_canvas_item_set gtk_object_set
int sp_canvas_item_grab(SPCanvasItem *item, unsigned int event_mask, GdkCursor *cursor, guint32 etime);
/* get item z-order in parent group */
// SPCanvas -------------------------------------------------
/**
* Port of GnomeCanvas for inkscape needs.
*/
struct SPCanvas {
/* Area that needs redrawing, stored as a microtile array */
/* Last known modifier state, for deferred repick when a button is down */
int state;
/* The item containing the mouse pointer, or NULL if none */
/* Item that is about to become current (used to track deletions and such) */
/* Item that holds a pointer grab, or NULL if none */
/* Event mask specified when grabbing an item */
/* If non-NULL, the currently focused item */
/* Event on which selection of current item is based */
int close_enough;
/* GC for temporary draw pixmap */
unsigned int need_update : 1;
unsigned int need_redraw : 1;
unsigned int need_repick : 1;
int forced_redraw_count;
int forced_redraw_limit;
/* For use by internal pick_current_item() function */
unsigned int left_grabbed_item : 1;
/* For use by internal pick_current_item() function */
unsigned int in_repick : 1;
// In most tools Inkscape only generates enter and leave events
// on the current item, but no other enter events if a mouse button
// is depressed -- see function pick_current_item(). Some tools
// may wish the canvas to generate to all enter events, (e.g., the
// connector tool). If so, they may temporarily set this flag to
// 'true'.
bool gen_all_enter_events;
/* For scripting, sometimes we want to delay drawing. */
bool drawing_disabled;
int rendermode;
#if ENABLE_LCMS
bool enable_cms_display_adj;
#endif // ENABLE_LCMS
bool is_scrolling;
};
void sp_canvas_scroll_to(SPCanvas *canvas, double cx, double cy, unsigned int clear, bool is_scrolling = false);
void sp_canvas_window_to_world(SPCanvas const *canvas, double winx, double winy, double *worldx, double *worldy);
void sp_canvas_world_to_window(SPCanvas const *canvas, double worldx, double worldy, double *winx, double *winy);
#endif // SEEN_SP_CANVAS_H
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :